Remapped M6 hangs
16 Mar 2023 20:54 - 16 Mar 2023 20:58 #266864
by nwallace
Remapped M6 hangs was created by nwallace
I am currently working on remapping m6 to work with an existing tool changer on a CNC router. I am using classicladder to control the atc and everything is working there. It properly rotates to the right tool pockets when the right digital I/O is triggered. I have written a change.ngc file to handle the tool change and am having difficulty getting it to work. Running tX m6 from mdi results in a forever running macro. You can interupt it but you need to restart linuxcnc afterward in order to use mdi again. I have started linuxcnc from the command line and I get no errors when I attempt to run an m6. I added a bunch of (print, ...) comments to see if I could find out where it would stop working but none of them show in the terminal window. Here is my m6 code (change.ngc) as well as my ini.
change.ngc
;Digital Inputs:
; 0 = ATC Servos In Position
; 1 = ATC Tool Sensor
;Digital outputs:
; 0 = Change to current tool pocket - ClassicLadder
; 1 = Change to selected tool pocket - ClassicLadder
; 2 = Dust Boot
; 3 = Spindle Drawbar
; 4 = ATC Door
; 5 = Tool Blow off
o<change> sub
(print, M6 Triggered)
#<current_tool> = #5400
o100 if [#<current_tool> EQ #<selected_tool>]
(print, current tool = selected tool)
o<change> return [1]
o100 endif
M66 P0 L0
o101 if #5399 EQ 0] OR [#5399 EQ -1
(print, Setup - atc servos not ready)
o<change> return [-13]
o101 endif
(Get current modal state)
#<current_absolute> = #<_absolute>
#<current_upm> = #<_units_per_minute>
#<current_feed_ov> = #<_feed_override>
M50 P0
M5
G90
M64 P2 (Raise dust hood)
G0 G53 Z-0.5
o102 if #<current_tool> GT 0] AND [#<current_tool> LE 16
(ATC-ATC)
o110 if #<selected_tool> GT 0] AND [#<selected_tool> LE 16
G0 G53 X#<_ini[atc]outxpos> Y#<_ini[atc]ypos> (Move to ATC XY Load/Unload position)
M64 P0 (Tell ATC to move to current tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P0
(If statement to check atc pocket rotate status)
o111 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-ATC current tool index fail)
o<change> return [-1]
o111 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket empty)
o112 if [#5399 EQ 1]
(print, ATC-ATC current tool pocket not empty)
o<change> return [-2]
o112 endif
M64 P4 (open ATC door)
M66 P0 L1 Q2 (Wait for atc door in position signal)
(If statement to check door status)
o113 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-ATC door open fail)
o<change> return [-3]
o113 endif
G0 G53 Z#<_ini[atc]zpos> (Move to ATC Z position)
G1 G53 X#<_ini[atc]xpos> F75
M62 P3 (With next motion, release tool)
G1 G53 Z[#<_ini[atc]zpos> + 0.5] F20
G0 G53 Z[#<_ini[atc]zpos> + 4]
M64 P1 (Tell atc to move to selected tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P1
(If statement to check atc pocket rotate status)
o114 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-ATC selected tool index fail)
o<change> return [-4]
o114 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket full)
o115 if [#5399 EQ 0]
(print, ATC-ATC selected tool pocket empty)
o<change> return [-5]
o115 endif
M64 P5 (Turn on blow off tool)
G4 P0.5
M65 P5 (Turn off blow off tool)
G0 G53 Z[#<_ini[atc]zpos> + 0.5]
M63 P3 (Close drawbar with next motion)
G1 G53 Z#<_ini[atc]zpos> F15
G1 G53 X#<_ini[atc]outxpos> F75
G0 G53 Z-0.5
G0 G53 X[#<_ini[atc]outxpos> + 6]
M65 P4 (Close atc door)
M65 P2 (Lower dust hood)
(ATC-MTC)
o110 elseif #<selected_tool> GT 16] AND [#<selected_tool> LE 99
G0 G53 X#<_ini[atc]outxpos> Y#<_ini[atc]ypos> (Move to ATC XY Load/Unload position)
M64 P0 (Tell ATC to move to current tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P0
(If statement to check atc pocket rotate status)
o116 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-MTC current tool index fail)
o<change> return [-6]
o116 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket empty)
o117 if [#5399 EQ 1]
(print, ATC-MTC current tool pocket not empty)
o<change> return [-7]
o117 endif
M64 P4 (open ATC door)
M66 P0 L1 Q2 (Wait for atc door in position signal)
(If statement to check door status)
o118 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-MTC door open fail)
o<change> return [-8]
o118 endif
G0 G53 Z#<_ini[atc]zpos> (Move to ATC Z position)
G1 G53 X#<_ini[atc]xpos> F75 (Move into tool pocket)
M62 P3 (With next motion, release tool)
G1 G53 Z[#<_ini[atc]zpos> + 0.5] F20
G0 G53 Z-0.5
M65 P3
G0 G53 X#<_ini[mtc]xpos> Y#<_ini[mtc]ypos> (Move to MTC XY)
G0 G53 Z#<_ini[mtc]zpos> (Move to MTC Z)
(MSG, Insert tool #<selected_tool>
M0
G0 G53 Z-0.5
M65 P2 (Lower dust hood)
o119 if [#<selected_tool> NE 99]
o<measure_tool> call [#<selected_tool>]
o119 endif
o110 else
(abort, Invalid selected tool)
o<change> return [-13]
o110 endif
o102 elseif #<current_tool> GT 16] AND [#<current_tool> LE 99
(MTC-ATC)
o120 if #<selected_tool> GT 0] AND [#<selected_tool> LE 16
G0 G53 X#<_ini[mtc]xpos> Y#<_ini[mtc]ypos> (Move to MTC XY)
G0 G53 Z#<_ini[mtc]zpos> (Move to MTC Z)
(MSG, Remove tool #<current_tool>
M0
G0 G53 Z-0.5
G0 G53 X#<_ini[atc]xpos> Y#<_ini[atc]ypos> (Move to ATC XY position)
M64 P0 (Tell ATC to move to selected tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P0
(If statement to check atc pocket rotate status)
o121 if #5399 EQ 0] OR [#5399 EQ -1
(print, MTC-ATC selected tool index fail)
o<change> return [-9]
o121 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket full)
o122 if [#5399 EQ 0]
(print, MTC-ATC selected tool pocket empty)
o<change> return [-10]
o122 endif
M64 P4 (open ATC door)
M66 P0 L1 Q2 (Wait for atc door in position signal)
(If statement to check door status)
o123 if #5399 EQ 0] OR [#5399 EQ -1
(print, MTC-ATC door open fail)
o<change> return [-11]
o123 endif
M64 P5 (Turn on blow off tool)
G4 P0.5
M65 P5 (Turn off blow off tool)
M64 P3 (open drawbar)
G0 G53 Z[#<_ini[atc]zpos> + 0.5]
M63 P3 (Close drawbar with next motion)
G1 G53 Z#<_ini[atc]zpos> F15
G1 G53 X#<_ini[atc]outxpos> F75
G0 G53 Z-0.5
G0 G53 X[#<_ini[atc]outxpos> + 6]
M65 P4 (Close atc door)
M65 P2 (Lower dust hood)
(MTC-MTC)
o120 elseif #<selected_tool> GT 16] AND [#<selected_tool> LE 99
G0 G53 X#<_ini[mtc]xpos> Y#<_ini[mtc]ypos> (Move to MTC XY)
G0 G53 Z#<_ini[mtc]zpos> (Move to MTC Z)
(MSG, Remove tool #<current_tool> and insert #<selected_tool>
M0
G0 G53 Z-0.5
M65 P2 (Lower dust hood)
o124 if [#<selected_tool> NE 99]
o<measure_tool> call [#<selected_tool>]
o124 endif
o120 else
(abort, Invalid selected tool)
o<change> return [-13]
o120 endif
o102 else
(abort, Invalid current tool)
o<change> return [-12]
o102 endif
(Restore modal state)
o103 if [#<current_absolute> EQ 1]
G90
o103 endif
o104 if [#<current_upm> EQ 0]
G93
o104 endif
o105 if [#<current_feed_ov> EQ 1]
M50 P1
o105 endif
o<change> endsub [1]
M2
INI file
# Generated by PNCconf at Mon Mar 13 16:43:06 2023
# Using LinuxCNC version: Master (2.9)
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
[EMC]
MACHINE = ww_cnc_4axis_gmoccapy
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = gmoccapy
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.500000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/cnc/linuxcnc/nc_files
INCREMENTS = 1in .1in .01in .001in
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 3.333333
MAX_LINEAR_VELOCITY = 13.333333
MIN_LINEAR_VELOCITY = 0.016667
DEFAULT_ANGULAR_VELOCITY = 16.666667
MAX_ANGULAR_VELOCITY = 250.000000
MIN_ANGULAR_VELOCITY = 1.666667
EDITOR = geany
GEOMETRY = xyz
CYCLE_TIME = 100
[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
RS274NGC_STARTUP_CODE = G20 G40 G90 G94 G97 G64 P0.001
SUBROUTINE_PATH = /home/cnc/linuxcnc/configs/ww_cnc_4axis_gmoccapy/subroutines
#REMAP
REMAP=M6 modalgroup=6 prolog=change_prolog ngc=change epilog=change_epilog
[PYTHON]
TOPLEVEL=/home/cnc/linuxcnc/configs/ww_cnc_4axis_gmoccapy/python/toplevel.py
PATH_APPEND=/home/cnc/linuxcnc/configs/ww_cnc_4axis_gmoccapy/python
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1270062
[HMOT]
CARD0=hm2_7i96s.0
[HAL]
HALUI = halui
HALFILE = ww_cnc_4axis_gmoccapy.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal
SHUTDOWN = shutdown.hal
[HALUI]
[KINS]
JOINTS = 5
KINEMATICS = trivkins coordinates=XYYZA kinstype=BOTH
[TRAJ]
COORDINATES = XYYZA
MAX_ANGULAR_VELOCITY = 250.00
DEFAULT_ANGULAR_VELOCITY = 25.00
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.33
MAX_LINEAR_VELOCITY = 13.33
NO_FORCE_HOMING = 0
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[ATC]
XPOS = 0.057
YPOS = 123.34
ZPOS = -14.09
OUTXPOS = 3.057
[MTC]
XPOS = 67
YPOS = 0.5
ZPOS = -5
[TOOL_PROBE]
XPOS = 13.3125
YPOS = 124
ZSTART = 0
TOOL_PROBE_OFFSET = 0
#******************************************
[AXIS_X]
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
MIN_LIMIT = -0.001
MAX_LIMIT = 73.3
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
# 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 = 16.67
STEPGEN_MAXACCEL = 31.25
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = -2038.0
MIN_LIMIT = -0.001
MAX_LIMIT = 73.3
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.833333
HOME_LATCH_VEL = 0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 2
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
MIN_LIMIT = -0.001
MAX_LIMIT = 124.25
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
# 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 = 16.67
STEPGEN_MAXACCEL = 31.25
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = 2038.0
MIN_LIMIT = -0.001
MAX_LIMIT = 124.25
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.833333
HOME_LATCH_VEL = 0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = -1
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
# 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 = 16.67
STEPGEN_MAXACCEL = 31.25
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = -2038.0
MIN_LIMIT = -0.001
MAX_LIMIT = 124.25
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.833333
HOME_LATCH_VEL = 0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = -1
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 30.0
MIN_LIMIT = -14.5
MAX_LIMIT = 0.001
[JOINT_3]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 30.0
# 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 = 4.17
STEPGEN_MAXACCEL = 37.50
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = 5080.0
MIN_LIMIT = -14.5
MAX_LIMIT = 0.001
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.833333
HOME_LATCH_VEL = -0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#******************************************
#******************************************
[AXIS_A]
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 800.0
MIN_LIMIT = -9999.0
MAX_LIMIT = 9999.0
[JOINT_4]
TYPE = ANGULAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 800.0
# 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 = 312.50
STEPGEN_MAXACCEL = 1000.00
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = 55.5555
MIN_LIMIT = -9999.0
MAX_LIMIT = 9999.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -12.000000
HOME_LATCH_VEL = 0.600000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_SEQUENCE = 2
#******************************************
[SPINDLE_0]
P = 0.0
I = 0.0
D = 0.0
FF0 = 1.0
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 18000.0
OUTPUT_SCALE = 18000
OUTPUT_MIN_LIMIT = 0
OUTPUT_MAX_LIMIT = 18000
As far as I can tell, this should work. Obviously, I am wrong. I have read through all the documentation on o-codes and remaps and think I have a pretty good understanding of it. I assume I have missed something small or my understanding of how a remap works is flawed in some way. I would appreciate any help I can get.
change.ngc
Warning: Spoiler!
;Digital Inputs:
; 0 = ATC Servos In Position
; 1 = ATC Tool Sensor
;Digital outputs:
; 0 = Change to current tool pocket - ClassicLadder
; 1 = Change to selected tool pocket - ClassicLadder
; 2 = Dust Boot
; 3 = Spindle Drawbar
; 4 = ATC Door
; 5 = Tool Blow off
o<change> sub
(print, M6 Triggered)
#<current_tool> = #5400
o100 if [#<current_tool> EQ #<selected_tool>]
(print, current tool = selected tool)
o<change> return [1]
o100 endif
M66 P0 L0
o101 if #5399 EQ 0] OR [#5399 EQ -1
(print, Setup - atc servos not ready)
o<change> return [-13]
o101 endif
(Get current modal state)
#<current_absolute> = #<_absolute>
#<current_upm> = #<_units_per_minute>
#<current_feed_ov> = #<_feed_override>
M50 P0
M5
G90
M64 P2 (Raise dust hood)
G0 G53 Z-0.5
o102 if #<current_tool> GT 0] AND [#<current_tool> LE 16
(ATC-ATC)
o110 if #<selected_tool> GT 0] AND [#<selected_tool> LE 16
G0 G53 X#<_ini[atc]outxpos> Y#<_ini[atc]ypos> (Move to ATC XY Load/Unload position)
M64 P0 (Tell ATC to move to current tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P0
(If statement to check atc pocket rotate status)
o111 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-ATC current tool index fail)
o<change> return [-1]
o111 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket empty)
o112 if [#5399 EQ 1]
(print, ATC-ATC current tool pocket not empty)
o<change> return [-2]
o112 endif
M64 P4 (open ATC door)
M66 P0 L1 Q2 (Wait for atc door in position signal)
(If statement to check door status)
o113 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-ATC door open fail)
o<change> return [-3]
o113 endif
G0 G53 Z#<_ini[atc]zpos> (Move to ATC Z position)
G1 G53 X#<_ini[atc]xpos> F75
M62 P3 (With next motion, release tool)
G1 G53 Z[#<_ini[atc]zpos> + 0.5] F20
G0 G53 Z[#<_ini[atc]zpos> + 4]
M64 P1 (Tell atc to move to selected tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P1
(If statement to check atc pocket rotate status)
o114 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-ATC selected tool index fail)
o<change> return [-4]
o114 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket full)
o115 if [#5399 EQ 0]
(print, ATC-ATC selected tool pocket empty)
o<change> return [-5]
o115 endif
M64 P5 (Turn on blow off tool)
G4 P0.5
M65 P5 (Turn off blow off tool)
G0 G53 Z[#<_ini[atc]zpos> + 0.5]
M63 P3 (Close drawbar with next motion)
G1 G53 Z#<_ini[atc]zpos> F15
G1 G53 X#<_ini[atc]outxpos> F75
G0 G53 Z-0.5
G0 G53 X[#<_ini[atc]outxpos> + 6]
M65 P4 (Close atc door)
M65 P2 (Lower dust hood)
(ATC-MTC)
o110 elseif #<selected_tool> GT 16] AND [#<selected_tool> LE 99
G0 G53 X#<_ini[atc]outxpos> Y#<_ini[atc]ypos> (Move to ATC XY Load/Unload position)
M64 P0 (Tell ATC to move to current tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P0
(If statement to check atc pocket rotate status)
o116 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-MTC current tool index fail)
o<change> return [-6]
o116 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket empty)
o117 if [#5399 EQ 1]
(print, ATC-MTC current tool pocket not empty)
o<change> return [-7]
o117 endif
M64 P4 (open ATC door)
M66 P0 L1 Q2 (Wait for atc door in position signal)
(If statement to check door status)
o118 if #5399 EQ 0] OR [#5399 EQ -1
(print, ATC-MTC door open fail)
o<change> return [-8]
o118 endif
G0 G53 Z#<_ini[atc]zpos> (Move to ATC Z position)
G1 G53 X#<_ini[atc]xpos> F75 (Move into tool pocket)
M62 P3 (With next motion, release tool)
G1 G53 Z[#<_ini[atc]zpos> + 0.5] F20
G0 G53 Z-0.5
M65 P3
G0 G53 X#<_ini[mtc]xpos> Y#<_ini[mtc]ypos> (Move to MTC XY)
G0 G53 Z#<_ini[mtc]zpos> (Move to MTC Z)
(MSG, Insert tool #<selected_tool>
M0
G0 G53 Z-0.5
M65 P2 (Lower dust hood)
o119 if [#<selected_tool> NE 99]
o<measure_tool> call [#<selected_tool>]
o119 endif
o110 else
(abort, Invalid selected tool)
o<change> return [-13]
o110 endif
o102 elseif #<current_tool> GT 16] AND [#<current_tool> LE 99
(MTC-ATC)
o120 if #<selected_tool> GT 0] AND [#<selected_tool> LE 16
G0 G53 X#<_ini[mtc]xpos> Y#<_ini[mtc]ypos> (Move to MTC XY)
G0 G53 Z#<_ini[mtc]zpos> (Move to MTC Z)
(MSG, Remove tool #<current_tool>
M0
G0 G53 Z-0.5
G0 G53 X#<_ini[atc]xpos> Y#<_ini[atc]ypos> (Move to ATC XY position)
M64 P0 (Tell ATC to move to selected tool pocket)
M66 P0 L1 Q3 (Wait for atc in position signal)
M65 P0
(If statement to check atc pocket rotate status)
o121 if #5399 EQ 0] OR [#5399 EQ -1
(print, MTC-ATC selected tool index fail)
o<change> return [-9]
o121 endif
M66 P1 L0 (Read tool sensor)
(If statement to check pocket full)
o122 if [#5399 EQ 0]
(print, MTC-ATC selected tool pocket empty)
o<change> return [-10]
o122 endif
M64 P4 (open ATC door)
M66 P0 L1 Q2 (Wait for atc door in position signal)
(If statement to check door status)
o123 if #5399 EQ 0] OR [#5399 EQ -1
(print, MTC-ATC door open fail)
o<change> return [-11]
o123 endif
M64 P5 (Turn on blow off tool)
G4 P0.5
M65 P5 (Turn off blow off tool)
M64 P3 (open drawbar)
G0 G53 Z[#<_ini[atc]zpos> + 0.5]
M63 P3 (Close drawbar with next motion)
G1 G53 Z#<_ini[atc]zpos> F15
G1 G53 X#<_ini[atc]outxpos> F75
G0 G53 Z-0.5
G0 G53 X[#<_ini[atc]outxpos> + 6]
M65 P4 (Close atc door)
M65 P2 (Lower dust hood)
(MTC-MTC)
o120 elseif #<selected_tool> GT 16] AND [#<selected_tool> LE 99
G0 G53 X#<_ini[mtc]xpos> Y#<_ini[mtc]ypos> (Move to MTC XY)
G0 G53 Z#<_ini[mtc]zpos> (Move to MTC Z)
(MSG, Remove tool #<current_tool> and insert #<selected_tool>
M0
G0 G53 Z-0.5
M65 P2 (Lower dust hood)
o124 if [#<selected_tool> NE 99]
o<measure_tool> call [#<selected_tool>]
o124 endif
o120 else
(abort, Invalid selected tool)
o<change> return [-13]
o120 endif
o102 else
(abort, Invalid current tool)
o<change> return [-12]
o102 endif
(Restore modal state)
o103 if [#<current_absolute> EQ 1]
G90
o103 endif
o104 if [#<current_upm> EQ 0]
G93
o104 endif
o105 if [#<current_feed_ov> EQ 1]
M50 P1
o105 endif
o<change> endsub [1]
M2
INI file
Warning: Spoiler!
# Generated by PNCconf at Mon Mar 13 16:43:06 2023
# Using LinuxCNC version: Master (2.9)
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
[EMC]
MACHINE = ww_cnc_4axis_gmoccapy
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = gmoccapy
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.500000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/cnc/linuxcnc/nc_files
INCREMENTS = 1in .1in .01in .001in
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 3.333333
MAX_LINEAR_VELOCITY = 13.333333
MIN_LINEAR_VELOCITY = 0.016667
DEFAULT_ANGULAR_VELOCITY = 16.666667
MAX_ANGULAR_VELOCITY = 250.000000
MIN_ANGULAR_VELOCITY = 1.666667
EDITOR = geany
GEOMETRY = xyz
CYCLE_TIME = 100
[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
RS274NGC_STARTUP_CODE = G20 G40 G90 G94 G97 G64 P0.001
SUBROUTINE_PATH = /home/cnc/linuxcnc/configs/ww_cnc_4axis_gmoccapy/subroutines
#REMAP
REMAP=M6 modalgroup=6 prolog=change_prolog ngc=change epilog=change_epilog
[PYTHON]
TOPLEVEL=/home/cnc/linuxcnc/configs/ww_cnc_4axis_gmoccapy/python/toplevel.py
PATH_APPEND=/home/cnc/linuxcnc/configs/ww_cnc_4axis_gmoccapy/python
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1270062
[HMOT]
CARD0=hm2_7i96s.0
[HAL]
HALUI = halui
HALFILE = ww_cnc_4axis_gmoccapy.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal
SHUTDOWN = shutdown.hal
[HALUI]
[KINS]
JOINTS = 5
KINEMATICS = trivkins coordinates=XYYZA kinstype=BOTH
[TRAJ]
COORDINATES = XYYZA
MAX_ANGULAR_VELOCITY = 250.00
DEFAULT_ANGULAR_VELOCITY = 25.00
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.33
MAX_LINEAR_VELOCITY = 13.33
NO_FORCE_HOMING = 0
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[ATC]
XPOS = 0.057
YPOS = 123.34
ZPOS = -14.09
OUTXPOS = 3.057
[MTC]
XPOS = 67
YPOS = 0.5
ZPOS = -5
[TOOL_PROBE]
XPOS = 13.3125
YPOS = 124
ZSTART = 0
TOOL_PROBE_OFFSET = 0
#******************************************
[AXIS_X]
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
MIN_LIMIT = -0.001
MAX_LIMIT = 73.3
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
# 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 = 16.67
STEPGEN_MAXACCEL = 31.25
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = -2038.0
MIN_LIMIT = -0.001
MAX_LIMIT = 73.3
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.833333
HOME_LATCH_VEL = 0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 2
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
MIN_LIMIT = -0.001
MAX_LIMIT = 124.25
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
# 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 = 16.67
STEPGEN_MAXACCEL = 31.25
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = 2038.0
MIN_LIMIT = -0.001
MAX_LIMIT = 124.25
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.833333
HOME_LATCH_VEL = 0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = -1
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 13.333333333333334
MAX_ACCELERATION = 25.0
# 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 = 16.67
STEPGEN_MAXACCEL = 31.25
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = -2038.0
MIN_LIMIT = -0.001
MAX_LIMIT = 124.25
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.833333
HOME_LATCH_VEL = 0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = -1
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 30.0
MIN_LIMIT = -14.5
MAX_LIMIT = 0.001
[JOINT_3]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 30.0
# 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 = 4.17
STEPGEN_MAXACCEL = 37.50
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = 5080.0
MIN_LIMIT = -14.5
MAX_LIMIT = 0.001
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.833333
HOME_LATCH_VEL = -0.050000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#******************************************
#******************************************
[AXIS_A]
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 800.0
MIN_LIMIT = -9999.0
MAX_LIMIT = 9999.0
[JOINT_4]
TYPE = ANGULAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 800.0
# 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 = 312.50
STEPGEN_MAXACCEL = 1000.00
P = 787.3631366027801
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 3000
STEPSPACE = 3000
STEP_SCALE = 55.5555
MIN_LIMIT = -9999.0
MAX_LIMIT = 9999.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -12.000000
HOME_LATCH_VEL = 0.600000
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_SEQUENCE = 2
#******************************************
[SPINDLE_0]
P = 0.0
I = 0.0
D = 0.0
FF0 = 1.0
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 18000.0
OUTPUT_SCALE = 18000
OUTPUT_MIN_LIMIT = 0
OUTPUT_MAX_LIMIT = 18000
As far as I can tell, this should work. Obviously, I am wrong. I have read through all the documentation on o-codes and remaps and think I have a pretty good understanding of it. I assume I have missed something small or my understanding of how a remap works is flawed in some way. I would appreciate any help I can get.
Last edit: 16 Mar 2023 20:58 by nwallace. Reason: fix formating
Please Log in or Create an account to join the conversation.
17 Mar 2023 01:15 #266875
by nwallace
Replied by nwallace on topic Remapped M6 hangs
I feel silly. The problem was that I had not connected the iocontrol tool-prepare pin to the tool-prepared pin. The system was just waiting for a signal that the tool was ready.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
Time to create page: 0.149 seconds