[REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
28 Aug 2021 11:36 - 28 Aug 2021 11:42 #218983
by mugurlu
Attachments:
Last edit: 28 Aug 2021 11:42 by mugurlu.
Please Log in or Create an account to join the conversation.
28 Aug 2021 11:47 #218985
by andypugh
Replied by andypugh on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
Do you by any chance have an M6 in the [RS274NGC]STARTHUP_GCODES in the .ini file?
Please Log in or Create an account to join the conversation.
28 Aug 2021 11:55 - 28 Aug 2021 12:14 #218986
by Aciera
Replied by Aciera on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
Not sure why it's running at startup.
But as to why you have a tool offset but no tool loaded:
In line 23 of your 'tool_change.ngc' you are only telling the controller to enable tool length compensation using the tool length offset value of the 'selected_tool' but you never actually tell the controller to change the tool.
Note that you can actually use M6 inside a custom remap:
Have a look at section 5.6 here:
linuxcnc.org/docs/html/remap/remap.html#...lated_codes_t_m6_m61
So maybe changing line 23 to this will do what you want:
T#<_selected_tool> M6 G43
But as to why you have a tool offset but no tool loaded:
In line 23 of your 'tool_change.ngc' you are only telling the controller to enable tool length compensation using the tool length offset value of the 'selected_tool' but you never actually tell the controller to change the tool.
Note that you can actually use M6 inside a custom remap:
Have a look at section 5.6 here:
linuxcnc.org/docs/html/remap/remap.html#...lated_codes_t_m6_m61
So maybe changing line 23 to this will do what you want:
T#<_selected_tool> M6 G43
Last edit: 28 Aug 2021 12:14 by Aciera.
Please Log in or Create an account to join the conversation.
28 Aug 2021 12:57 - 28 Aug 2021 13:01 #218995
by mugurlu
# Generated by PNCconf at Sun Feb 21 11:35:31 2021
# Using LinuxCNC version: 2.8
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
[EMC]
MACHINE = brother
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = axis
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/brother/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 6.000000
MAX_LINEAR_VELOCITY = 416.666666
MIN_LINEAR_VELOCITY = 0.500000
DEFAULT_ANGULAR_VELOCITY = 12.000000
MAX_ANGULAR_VELOCITY = 180.000000
MIN_ANGULAR_VELOCITY = 1.666667
EDITOR = gedit
GEOMETRY = xyz
PYVCP = spindle.xml
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
HAL_PIN_VARS = 1
NO_DOWNCASE_OWORD = 1
# turn on all optional features except RETAIN_G43
FEATURES= 30
REMAP=M06 modalgroup=6 ngc=tool_change
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000
[HMOT]
# **** This is for info only ****
CARD0=hm2_5i25.0
[HAL]
HALUI = halui
HALFILE = brother.hal
HALFILE = custom.hal
HALFILE = jog_pendant.hal
HALFILE = spindle.hal
HALFILE = dynamic_table.hal
HALFILE = toolchanger.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
[HALUI]
[KINS]
JOINTS = 3
KINEMATICS = trivkins coordinates=XYZ
[TRAJ]
COORDINATES = XYZ
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 41.67
MAX_LINEAR_VELOCITY = 416.67
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
#******************************************
[AXIS_X]
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
MIN_LIMIT = -85.0
MAX_LIMIT = 580.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 5
MIN_FERROR = 1
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
BACKLASH=0.025
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 460
STEPGEN_MAXACCEL = 400
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 250
STEPSPACE = 50
STEP_SCALE = 500
MIN_LIMIT = -85.0
MAX_LIMIT = 580.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = -50.0
HOME_LATCH_VEL = -5.00
HOME_FINAL_VEL = -5.00
HOME_SEQUENCE = 2
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
MIN_LIMIT = -70.0
MAX_LIMIT = 220.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 5
MIN_FERROR = 1
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
BACKLASH=0.02
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 460
STEPGEN_MAXACCEL = 400
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 250
STEPSPACE = 50
STEP_SCALE = 500
MIN_LIMIT = -70.0
MAX_LIMIT = 220.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = -50.0
HOME_LATCH_VEL = -5.00
HOME_FINAL_VEL = -5.00
HOME_SEQUENCE = 1
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 333
MAX_ACCELERATION = 100
MIN_LIMIT = -190.0
MAX_LIMIT = 190.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 5
MIN_FERROR = 1
MAX_VELOCITY = 333
MAX_ACCELERATION = 100
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 350
STEPGEN_MAXACCEL = 200
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 250
STEPSPACE = 50
STEP_SCALE = 1000
MIN_LIMIT = -190.0
MAX_LIMIT = 190.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 50.0
HOME_LATCH_VEL = 5.00
HOME_FINAL_VEL = 5.00
HOME_SEQUENCE = 0
#******************************************
[SPINDLE_0]
P = 100
I = 0
D = 0
FF0 = 0
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 500
# Step/Dir
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
STEPGEN_MAXACCEL = 30000
STEPGEN_MAXVEL = 50000
ENCODER_SCALE = 1024
# 1024/60 17.0666
OUTPUT_SCALE = 1
ACCELERATION = 2000
MAX_ERROR = 0.2
OFF_DELAY = 1.5
[PYTHON]
#TOPLEVEL= /home/brother/linuxcnc/configs/brother/python/toplevel.py
#PATH_APPEND= /home/brother/linuxcnc/configs/brother/python
Replied by mugurlu on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
No, my ini file:Do you by any chance have an M6 in the [RS274NGC]STARTHUP_GCODES in the .ini file?
Warning: Spoiler!
# Generated by PNCconf at Sun Feb 21 11:35:31 2021
# Using LinuxCNC version: 2.8
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
[EMC]
MACHINE = brother
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = axis
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/brother/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 6.000000
MAX_LINEAR_VELOCITY = 416.666666
MIN_LINEAR_VELOCITY = 0.500000
DEFAULT_ANGULAR_VELOCITY = 12.000000
MAX_ANGULAR_VELOCITY = 180.000000
MIN_ANGULAR_VELOCITY = 1.666667
EDITOR = gedit
GEOMETRY = xyz
PYVCP = spindle.xml
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
HAL_PIN_VARS = 1
NO_DOWNCASE_OWORD = 1
# turn on all optional features except RETAIN_G43
FEATURES= 30
REMAP=M06 modalgroup=6 ngc=tool_change
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000
[HMOT]
# **** This is for info only ****
CARD0=hm2_5i25.0
[HAL]
HALUI = halui
HALFILE = brother.hal
HALFILE = custom.hal
HALFILE = jog_pendant.hal
HALFILE = spindle.hal
HALFILE = dynamic_table.hal
HALFILE = toolchanger.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
[HALUI]
[KINS]
JOINTS = 3
KINEMATICS = trivkins coordinates=XYZ
[TRAJ]
COORDINATES = XYZ
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 41.67
MAX_LINEAR_VELOCITY = 416.67
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
#******************************************
[AXIS_X]
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
MIN_LIMIT = -85.0
MAX_LIMIT = 580.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 5
MIN_FERROR = 1
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
BACKLASH=0.025
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 460
STEPGEN_MAXACCEL = 400
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 250
STEPSPACE = 50
STEP_SCALE = 500
MIN_LIMIT = -85.0
MAX_LIMIT = 580.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = -50.0
HOME_LATCH_VEL = -5.00
HOME_FINAL_VEL = -5.00
HOME_SEQUENCE = 2
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
MIN_LIMIT = -70.0
MAX_LIMIT = 220.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 5
MIN_FERROR = 1
MAX_VELOCITY = 416
MAX_ACCELERATION = 100
BACKLASH=0.02
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 460
STEPGEN_MAXACCEL = 400
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 250
STEPSPACE = 50
STEP_SCALE = 500
MIN_LIMIT = -70.0
MAX_LIMIT = 220.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = -50.0
HOME_LATCH_VEL = -5.00
HOME_FINAL_VEL = -5.00
HOME_SEQUENCE = 1
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 333
MAX_ACCELERATION = 100
MIN_LIMIT = -190.0
MAX_LIMIT = 190.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 5
MIN_FERROR = 1
MAX_VELOCITY = 333
MAX_ACCELERATION = 100
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 350
STEPGEN_MAXACCEL = 200
P = 1000
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 250
STEPSPACE = 50
STEP_SCALE = 1000
MIN_LIMIT = -190.0
MAX_LIMIT = 190.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 50.0
HOME_LATCH_VEL = 5.00
HOME_FINAL_VEL = 5.00
HOME_SEQUENCE = 0
#******************************************
[SPINDLE_0]
P = 100
I = 0
D = 0
FF0 = 0
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 500
# Step/Dir
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
STEPGEN_MAXACCEL = 30000
STEPGEN_MAXVEL = 50000
ENCODER_SCALE = 1024
# 1024/60 17.0666
OUTPUT_SCALE = 1
ACCELERATION = 2000
MAX_ERROR = 0.2
OFF_DELAY = 1.5
[PYTHON]
#TOPLEVEL= /home/brother/linuxcnc/configs/brother/python/toplevel.py
#PATH_APPEND= /home/brother/linuxcnc/configs/brother/python
Last edit: 28 Aug 2021 13:01 by mugurlu.
Please Log in or Create an account to join the conversation.
28 Aug 2021 13:02 #218997
by mugurlu
Replied by mugurlu on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
Please Log in or Create an account to join the conversation.
28 Aug 2021 14:05 - 28 Aug 2021 14:11 #219004
by mugurlu
Answer:
linuxcnc.org/docs/html/remap/remap.html#...lated_codes_t_m6_m61 [Step 1]
Section :4. Upgrading an existing configuration for remapping
Create stdglue.py file.
[Step]
Section 5.3. Specifying the M6 replacement
I edited stdglue.py for two headers as below;
everything is fine so far
However,
I can't find the answer to the question in the title.
What should I do to prevent tool change every time the machine is turned on? (M6 why are you working?)
Best regards,
mugurlu
Replied by mugurlu on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
Why does it stay in No Tool status? (P3 ... P4.png P5.png)
Answer:
linuxcnc.org/docs/html/remap/remap.html#...lated_codes_t_m6_m61 [Step 1]
Section :4. Upgrading an existing configuration for remapping
Create stdglue.py file.
[Step]
Section 5.3. Specifying the M6 replacement
I edited stdglue.py for two headers as below;
def change_prolog(self, **words):
try:
if self.selected_pocket < 0:
return "M6: no tool prepared"
if self.cutter_comp_side:
return "Cannot change tools with cutter radius compensation on"
self.params["tool_in_spindle"] = self.current_tool
self.params["selected_tool"] = self.selected_tool
self.params["current_pocket"] = self.current_pocket
self.params["selected_pocket"] = self.selected_pocket
return INTERP_OK
except Exception, e:
return "M6/change_prolog: %s" % (e)
def change_epilog(self, **words):
try:
if self.return_value > 0.0:
# commit change
self.selected_pocket = int(self.params["selected_pocket"])
emccanon.CHANGE_TOOL(self.selected_pocket)
# cause a sync()
self.tool_change_flag = True
self.set_tool_parameters()
return INTERP_OK
else:
return "M6 aborted (return code %.1f)" % (self.return_value)
except Exception, e:
return "M6/change_epilog: %s" % (e)
everything is fine so far
However,
I can't find the answer to the question in the title.
What should I do to prevent tool change every time the machine is turned on? (M6 why are you working?)
Best regards,
mugurlu
Last edit: 28 Aug 2021 14:11 by mugurlu.
Please Log in or Create an account to join the conversation.
28 Aug 2021 14:17 - 28 Aug 2021 14:28 #219006
by bevins
Replied by bevins on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
You have to test for milltask mode in ypur remap and return if it is not so it doesnt run the remap and move the machine. When Lcnc loads a file it is in preview mode. Thats the best way I can explain it. Maybe someone can chime in.
if self.task==0:
return INTERP_OK
Last edit: 28 Aug 2021 14:28 by bevins.
Please Log in or Create an account to join the conversation.
28 Aug 2021 14:41 #219007
by mugurlu
Replied by mugurlu on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
Hi,
but i use to .ngc file...Where should I add the part you mentioned?
but i use to .ngc file...
REMAP=M6 modalgroup=6 prolog=change_prolog ngc=tool_change epilog=change_epilog
if self.task==0:
return INTERP_OK
Please Log in or Create an account to join the conversation.
28 Aug 2021 14:54 - 28 Aug 2021 14:55 #219009
by bevins
Replied by bevins on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
/Edit Sorry I didnt see that. Your remap line up farther didnt show it.
Last edit: 28 Aug 2021 14:55 by bevins.
Please Log in or Create an account to join the conversation.
28 Aug 2021 14:55 - 28 Aug 2021 15:41 #219010
by Aciera
Replied by Aciera on topic [REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?
Unrelated: Note that the FEATURES tag in the [RS274NGC] Section does no longer work in Version 2.8 and up.
linuxcnc.org/docs/html/config/ini-config...l#gcode:ini-features
linuxcnc.org/docs/html/config/ini-config...l#gcode:ini-features
Last edit: 28 Aug 2021 15:41 by Aciera.
Please Log in or Create an account to join the conversation.
Time to create page: 0.151 seconds