Thanks Todd for the help.
Lets assume that I do not have any lost motion or missed steps (although I would like to know exactly how to check this). I am fairly positive that it is calibration issue as I did a quick and not so accurate calibration when I first set the machine up. I was expecting/planning to do a more accurate calibration once I worked out most of the bugs and got the machine broke-in.
I just finished calibrating the Z-axis. I am within about .0005"-.001" tolerance. I think for wood applications that is acceptable. Now I need to figure out the touch plate. Once I get the touch plate thickness working correctly, then Z0.0 should be just touching the spoilboard (provided I have the calibration correct)?
I decided this morning to swap out my touch plate for a more accurate piece of aluminum because the touch plate I was using is a cheap one that has too much variance for me. After changing the touch plate and the offset (thickness) in the 100.ngc file I did a touch off and then ran Z0.0 and it stopped .8035" (which is the difference between the old touch plate and the new) above the spoilboard. So from what I can tell, changing the offset in 100.ngc file does not appear to do anything. So where do I actually put the offset (touch plate thickness) value for the touch plate?
Here is my 100.ngc file. My new touch plate is 1.572" thick. See the bolded section.
Code:
<pre>
o100 sub
G20
( Set current Z position to 0 so that we will always be moving down )
G10 L20 P0 Z0
( Probe to Z-.5 at F2 [Uses machine units, I work in inch, this is meant to be slow!] )
G38.2 Z-.25 f2
[b]( Set Z0 at point where probe triggers with offset of +1.004 [this is the thickness of my touch plate. You must adjust this for your plate / setup] )
(G10 L20 = Set Coordinate System // P - coordinate system 0-9 0 = Not active)
G10 L20 P1 Z1.572[/b]
( Rapid up to Z.5 above the material )
(G10 L20 P1)
(Use machine coordinates)
G90
G53 G0
(Incremental mode)
G91
(Rapid Z up 1 inches)
G0 Z1
o100 endsub
</pre>
Here is the Z axis section of my INI file.
Code:
# Generated by PNCconf at Fri Mar 3 16:12:30 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 = lcnc
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = gmoccapy
EMBED_TAB_NAME = Center_panel
EMBED_TAB_LOCATION = ntb_preview
EMBED_TAB_COMMAND = gladevcp -c gladevcp -H gvcp_call_list.hal -x {XID} gvcp-panel.ui
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/shawn/linuxcnc/nc_files
INCREMENTS = 20in 10in 1in .5in .1in .05in .01in .005in .001in .0005in .0001in
POSITION_FEEDBACK = ACTUAL
# Jog Speed - Also sets Jog Speed in LCNC Axis Manual Control Screen only if lower than MAX_LINEAR_VELOCITY. Otherwise MAX_LINEAR_VELOCITY sets this value. #
DEFAULT_LINEAR_VELOCITY = 2.00000
# Sets the Jog Speed/Max Velocity in LCNC Axis Manual Control Screen #
MAX_LINEAR_VELOCITY = 2.00000
MIN_LINEAR_VELOCITY = 0.016670
DEFAULT_ANGULAR_VELOCITY = 12.000000
MAX_ANGULAR_VELOCITY = 180.000000
MIN_ANGULAR_VELOCITY = 1.6666671
EDITOR = gedit
GEOMETRY = xyz
CYCLE_TIME = 100
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .ngc,.NGC,.nc,.NC,.txt,.tap Gcode file
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
SUBROUTINE_PATH = macros
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 2000000
[HMOT]
# **** This is for info only ****
CARD0=hm2_7i76e.0
[HAL]
HALUI = halui
HALFILE = lcnc.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal
SHUTDOWN = shutdown.hal
[HALUI]
# MDI_COMMAND=o100 call
[KINS]
JOINTS = 4
KINEMATICS = trivkins coordinates=XYYZ kinstype=BOTH
[TRAJ]
COORDINATES = XYYZ
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 0.33
MAX_LINEAR_VELOCITY = 3.33
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
TOOL_CHANGE_QUILL_UP = 1
[MACROS]
MACRO = touch_plate_z
#******************************************
[AXIS_X]
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 90.0
MIN_LIMIT = -0.001
MAX_LIMIT = 44.761
[JOINT_0]
TYPE = LINEAR
HOME = 0.2
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 90
# 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 = 112.5
P = 500
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 8000
DIRHOLD = 5000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = 10170.17
MIN_LIMIT = -0.001
MAX_LIMIT = 44.761
# Distance traveled off limit switch once switch is triggered
HOME_OFFSET = -0.100000
HOME_SEARCH_VEL = -0.833333
HOME_LATCH_VEL = 0.033333
# Speed from HOME_OFFSET to final HOME location
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 90.0
MIN_LIMIT = -0.001
MAX_LIMIT = 49.851
[JOINT_1]
TYPE = LINEAR
HOME = 2.703
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 90
# 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 = 112.5
P = 500
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 8000
DIRHOLD = 5000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = -10159.9564
MIN_LIMIT = -0.001
MAX_LIMIT = 49.851
HOME_OFFSET = 0.100000
HOME_SEARCH_VEL = -0.933333
HOME_LATCH_VEL = 0.333333
HOME_FINAL_VEL = 0.900000
HOME_IGNORE_LIMITS = YES
HOME_USE_INDEX = NO
HOME_SEQUENCE = -2
[JOINT_2]
TYPE = LINEAR
HOME = 2.703
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 3.3333333333333335
MAX_ACCELERATION = 90
# 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 = 112.5
P = 500
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 8000
DIRHOLD = 5000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = -10159.9564
MIN_LIMIT = -0.001
MAX_LIMIT = 49.851
HOME_OFFSET = 0.100000
HOME_SEARCH_VEL = -0.933333
HOME_LATCH_VEL = 0.333333
HOME_FINAL_VEL = 0.900000
HOME_IGNORE_LIMITS = YES
HOME_USE_INDEX = NO
HOME_SEQUENCE = -2
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 0.5
MAX_ACCELERATION = 50.0
MIN_LIMIT = -5.251
MAX_LIMIT = 0.001
[JOINT_3]
TYPE = LINEAR
HOME = -0.2
FERROR = 0.5
MIN_FERROR = 0.05
MAX_VELOCITY = 0.5
MAX_ACCELERATION = 50.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 = 0.62
STEPGEN_MAXACCEL = 62.5
P = 500
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 8000
DIRHOLD = 5000
STEPLEN = 2500
STEPSPACE = 2500
STEP_SCALE = 10304.26
MIN_LIMIT = -5.251
MAX_LIMIT = 0.001
HOME_OFFSET = -0.100000
HOME_SEARCH_VEL = 0.500000
HOME_LATCH_VEL = -0.033333
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#******************************************
Here is my HAL file in case it helps.
Code:
# Generated by PNCconf at Fri Mar 3 16:12:30 2023
# Using LinuxCNC version: Master (2.9)
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config="num_encoders=1 num_pwmgens=0 num_stepgens=4 sserial_port_0=00xxxx"
setp hm2_7i76e.0.watchdog.timeout_ns 5000000
loadusr -W hal_input -KRAL Logitech Gamepad F310
loadrt pid names=pid.x,pid.y1,pid.y2,pid.z,pid.s
loadrt mux16 names=jogspeed
addf hm2_7i76e.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.y1.do-pid-calcs servo-thread
addf pid.y2.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf pid.s.do-pid-calcs servo-thread
addf jogspeed servo-thread
addf hm2_7i76e.0.write servo-thread
setp hm2_7i76e.0.dpll.01.timer-us -50
setp hm2_7i76e.0.stepgen.timer-number 1
# external output signals
# --- ESTOP-OUT ---
net estop-out => hm2_7i76e.0.7i76.0.0.output-00
# --- ROUTER-ON ---
net coolant-mist => hm2_7i76e.0.7i76.0.0.output-08
# --- DUST-COLLECTOR-ON
net coolant-flood => hm2_7i76e.0.7i76.0.0.output-01
# external input signals
# --- ESTOP-EXT ---
net estop-ext <= hm2_7i76e.0.7i76.0.0.input-04
# --- BOTH-HOME-X ---
net both-home-x <= hm2_7i76e.0.7i76.0.0.input-05-not
# --- HOME-Y1 ---
net home-y1 <= hm2_7i76e.0.7i76.0.0.input-06-not
# --- BOTH-HOME-Y2 ---
net both-home-y2 <= hm2_7i76e.0.7i76.0.0.input-07-not
# --- BOTH-HOME-Z ---
net both-home-z <= hm2_7i76e.0.7i76.0.0.input-08-not
#*******************
# AXIS X JOINT 0
#*******************
setp pid.x.Pgain [JOINT_0]P
setp pid.x.Igain [JOINT_0]I
setp pid.x.Dgain [JOINT_0]D
setp pid.x.bias [JOINT_0]BIAS
setp pid.x.FF0 [JOINT_0]FF0
setp pid.x.FF1 [JOINT_0]FF1
setp pid.x.FF2 [JOINT_0]FF2
setp pid.x.deadband [JOINT_0]DEADBAND
setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp pid.x.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.x.maxerror 0.000500
net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-pos-cmd => pid.x.command
net x-pos-fb => pid.x.feedback
net x-output <= pid.x.output
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP
setp hm2_7i76e.0.stepgen.00.dirhold [JOINT_0]DIRHOLD
setp hm2_7i76e.0.stepgen.00.steplen [JOINT_0]STEPLEN
setp hm2_7i76e.0.stepgen.00.stepspace [JOINT_0]STEPSPACE
setp hm2_7i76e.0.stepgen.00.position-scale [JOINT_0]STEP_SCALE
setp hm2_7i76e.0.stepgen.00.step_type 0
setp hm2_7i76e.0.stepgen.00.control-type 1
setp hm2_7i76e.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net x-pos-cmd <= joint.0.motor-pos-cmd
net x-vel-cmd <= joint.0.vel-cmd
net x-output => hm2_7i76e.0.stepgen.00.velocity-cmd
net x-pos-fb <= hm2_7i76e.0.stepgen.00.position-fb
net x-pos-fb => joint.0.motor-pos-fb
net x-enable <= joint.0.amp-enable-out
net x-enable => hm2_7i76e.0.stepgen.00.enable
# ---setup home / limit switch signals---
net both-home-x => joint.0.home-sw-in
net both-home-x => joint.0.neg-lim-sw-in
net both-home-x => joint.0.pos-lim-sw-in
#*******************
# AXIS Y1 JOINT 1
#*******************
setp pid.y1.Pgain [JOINT_1]P
setp pid.y1.Igain [JOINT_1]I
setp pid.y1.Dgain [JOINT_1]D
setp pid.y1.bias [JOINT_1]BIAS
setp pid.y1.FF0 [JOINT_1]FF0
setp pid.y1.FF1 [JOINT_1]FF1
setp pid.y1.FF2 [JOINT_1]FF2
setp pid.y1.deadband [JOINT_1]DEADBAND
setp pid.y1.maxoutput [JOINT_1]MAX_OUTPUT
setp pid.y1.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.y1.maxerror 0.000500
net y1-index-enable <=> pid.y1.index-enable
net y1-enable => pid.y1.enable
net y1-pos-cmd => pid.y1.command
net y1-pos-fb => pid.y1.feedback
net y1-output <= pid.y1.output
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
setp hm2_7i76e.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
setp hm2_7i76e.0.stepgen.01.steplen [JOINT_1]STEPLEN
setp hm2_7i76e.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
setp hm2_7i76e.0.stepgen.01.position-scale [JOINT_1]STEP_SCALE
setp hm2_7i76e.0.stepgen.01.step_type 0
setp hm2_7i76e.0.stepgen.01.control-type 1
setp hm2_7i76e.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net y1-pos-cmd <= joint.1.motor-pos-cmd
net y1-vel-cmd <= joint.1.vel-cmd
net y1-output => hm2_7i76e.0.stepgen.01.velocity-cmd
net y1-pos-fb <= hm2_7i76e.0.stepgen.01.position-fb
net y1-pos-fb => joint.1.motor-pos-fb
net y1-enable <= joint.1.amp-enable-out
net y1-enable => hm2_7i76e.0.stepgen.01.enable
# ---setup home / limit switch signals---
net home-y1 => joint.1.home-sw-in
net home-y1 => joint.1.neg-lim-sw-in
# net home-y1 => joint.2.pos-lim-sw-in
#*******************
# Tandem AXIS Y2 JOINT 2
#*******************
setp pid.y2.Pgain [JOINT_2]P
setp pid.y2.Igain [JOINT_2]I
setp pid.y2.Dgain [JOINT_2]D
setp pid.y2.bias [JOINT_2]BIAS
setp pid.y2.FF0 [JOINT_2]FF0
setp pid.y2.FF1 [JOINT_2]FF1
setp pid.y2.FF2 [JOINT_2]FF2
setp pid.y2.deadband [JOINT_2]DEADBAND
setp pid.y2.maxoutput [JOINT_2]MAX_OUTPUT
setp pid.y2.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.y2.maxerror 0.000500
net y2-index-enable <=> pid.y2.index-enable
net y2-enable => pid.y2.enable
net y2-pos-cmd => pid.y2.command
net y2-pos-fb => pid.y2.feedback
net y2-output <= pid.y2.output
# Step Gen signals/setup for tandem axis
setp hm2_7i76e.0.stepgen.02.dirsetup [JOINT_2]DIRSETUP
setp hm2_7i76e.0.stepgen.02.dirhold [JOINT_2]DIRHOLD
setp hm2_7i76e.0.stepgen.02.steplen [JOINT_2]STEPLEN
setp hm2_7i76e.0.stepgen.02.stepspace [JOINT_2]STEPSPACE
setp hm2_7i76e.0.stepgen.02.position-scale [JOINT_2]STEP_SCALE
setp hm2_7i76e.0.stepgen.02.step_type 0
setp hm2_7i76e.0.stepgen.02.control-type 1
setp hm2_7i76e.0.stepgen.02.maxaccel [JOINT_2]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.02.maxvel [JOINT_2]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net y2-pos-cmd <= joint.2.motor-pos-cmd
net y2-vel-cmd <= joint.2.vel-cmd
net y2-output => hm2_7i76e.0.stepgen.02.velocity-cmd
net y2-pos-fb <= hm2_7i76e.0.stepgen.02.position-fb
net y2-pos-fb => joint.2.motor-pos-fb
net y2-enable <= joint.2.amp-enable-out
net y2-enable => hm2_7i76e.0.stepgen.02.enable
# ---setup home / limit switch signals---
net both-home-y2 => joint.2.home-sw-in
net both-home-y2 => joint.2.neg-lim-sw-in
net both-home-y2 => joint.2.pos-lim-sw-in
#*******************
# AXIS Z JOINT 3
#*******************
setp pid.z.Pgain [JOINT_3]P
setp pid.z.Igain [JOINT_3]I
setp pid.z.Dgain [JOINT_3]D
setp pid.z.bias [JOINT_3]BIAS
setp pid.z.FF0 [JOINT_3]FF0
setp pid.z.FF1 [JOINT_3]FF1
setp pid.z.FF2 [JOINT_3]FF2
setp pid.z.deadband [JOINT_3]DEADBAND
setp pid.z.maxoutput [JOINT_3]MAX_OUTPUT
setp pid.z.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.z.maxerror 0.000500
net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-pos-fb => pid.z.feedback
net z-output <= pid.z.output
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.03.dirsetup [JOINT_3]DIRSETUP
setp hm2_7i76e.0.stepgen.03.dirhold [JOINT_3]DIRHOLD
setp hm2_7i76e.0.stepgen.03.steplen [JOINT_3]STEPLEN
setp hm2_7i76e.0.stepgen.03.stepspace [JOINT_3]STEPSPACE
setp hm2_7i76e.0.stepgen.03.position-scale [JOINT_3]STEP_SCALE
setp hm2_7i76e.0.stepgen.03.step_type 0
setp hm2_7i76e.0.stepgen.03.control-type 1
setp hm2_7i76e.0.stepgen.03.maxaccel [JOINT_3]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.03.maxvel [JOINT_3]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net z-pos-cmd <= joint.3.motor-pos-cmd
net z-vel-cmd <= joint.3.vel-cmd
net z-output => hm2_7i76e.0.stepgen.03.velocity-cmd
net z-pos-fb <= hm2_7i76e.0.stepgen.03.position-fb
net z-pos-fb => joint.3.motor-pos-fb
net z-enable <= joint.3.amp-enable-out
net z-enable => hm2_7i76e.0.stepgen.03.enable
# ---setup home / limit switch signals---
net both-home-z => joint.3.home-sw-in
net both-home-z => joint.3.neg-lim-sw-in
net both-home-z => joint.3.pos-lim-sw-in
#******************************
# connect miscellaneous signals
#******************************
# ---coolant signals---
net coolant-mist <= iocontrol.0.coolant-mist
net coolant-flood <= iocontrol.0.coolant-flood
# ---probe signal---
net probe-in => motion.probe-input
#limits debounce to stop false triggers
loadrt debounce cfg=1 #change to the number you want
setp debounce.0.delay 100 #this sets the delay 100 iterations of the servo-thread
addf debounce.0 servo-thread
net deb-probe-in debounce.0.0.in <= hm2_7i76e.0.7i76.0.0.input-09-not
net probe-in debounce.0.0.out
net probe-in => motion.probe-input
# ---motion control signals---
net in-position <= motion.in-position
net machine-is-enabled <= motion.motion-enabled
# ---digital in / out signals---
# ---estop signals---
net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in
# ---toolchange signals for custom tool changer---
net tool-number <= iocontrol.0.tool-prep-number
net tool-change-request <= iocontrol.0.tool-change
net tool-change-confirmed => iocontrol.0.tool-changed
net tool-prepare-request <= iocontrol.0.tool-prepare
net tool-prepare-confirmed => iocontrol.0.tool-prepared
Thanks