Index Homing odd offset
- OT-CNC
- Offline
- Platinum Member
- Posts: 622
- Thank you received: 75
Thanks for looking at all this.
I will update my hal file to see if it loads. Let me know if you still see anything obviously wrong with it.
Thanks for confirming that the index homing looks correct.
PCW, on a side note, I sent you a pm for 5i25 and 7i85 custom firmware request to get 1 pwm out on my stepper configuration to wire the spinx1 for spindle control.
Is there a possibility you could configure one assuming it doesn't already exist? Please let me know as I need to get my spindle up and running.
Many thanks!
www.linuxcnc.org/index.php/english/forum...spinx1-to-7i85#64354
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
- Posts: 17983
- Thank you received: 4834
Please Log in or Create an account to join the conversation.
- OT-CNC
- Offline
- Platinum Member
- Posts: 622
- Thank you received: 75
Please Log in or Create an account to join the conversation.
- OT-CNC
- Offline
- Platinum Member
- Posts: 622
- Thank you received: 75
The home routine still didn't zero out the dro on index, mostly failed during joint following error as expected.
I'm re-attaching the Z axis section of hal please someone point out what is missing.
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_pci config=" num_encoders=5 num_pwmgens=1 num_stepgens=3 sserial_port_0=20xxxxx"
setp hm2_5i25.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.z,pid.s
loadrt abs names=abs.spindle
loadrt lowpass names=lowpass.spindle
addf hm2_5i25.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.z.do-pid-calcs servo-thread
addf pid.s.do-pid-calcs servo-thread
addf abs.spindle servo-thread
addf lowpass.spindle servo-thread
addf hm2_5i25.0.write servo-thread
#*******************
# AXIS Z
#*******************
setp pid.z.Pgain [AXIS_2]P
setp pid.z.Igain [AXIS_2]I
setp pid.z.Dgain [AXIS_2]D
setp pid.z.bias [AXIS_2]BIAS
setp pid.z.FF0 [AXIS_2]FF0
setp pid.z.FF1 [AXIS_2]FF1
setp pid.z.FF2 [AXIS_2]FF2
setp pid.z.deadband [AXIS_2]DEADBAND
setp pid.z.maxoutput [AXIS_2]MAX_OUTPUT
setp pid.z.error-previous-target true
setp pid.z.maxerror .005
net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-vel-cmd => pid.z.command-deriv
net z-pos-fb => pid.z.feedback
net z-output => pid.z.output
# Step Gen signals/setup
setp hm2_5i25.0.stepgen.02.dirsetup [AXIS_2]DIRSETUP
setp hm2_5i25.0.stepgen.02.dirhold [AXIS_2]DIRHOLD
setp hm2_5i25.0.stepgen.02.steplen [AXIS_2]STEPLEN
setp hm2_5i25.0.stepgen.02.stepspace [AXIS_2]STEPSPACE
setp hm2_5i25.0.stepgen.02.position-scale [AXIS_2]STEP_SCALE
setp hm2_5i25.0.stepgen.02.step_type 0
setp hm2_5i25.0.stepgen.02.control-type 1
setp hm2_5i25.0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL
setp hm2_5i25.0.stepgen.02.maxvel [AXIS_2]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net z-pos-cmd <= axis.2.motor-pos-cmd
net z-vel-cmd <= axis.2.joint-vel-cmd
net z-output <= hm2_5i25.0.stepgen.02.velocity-cmd
net z-pos-fb <= hm2_5i25.0.stepgen.02.position-fb
net z-enable <= axis.2.amp-enable-out
net z-enable => hm2_5i25.0.stepgen.02.enable
# ---Encoder feedback signals/setup---
setp hm2_5i25.0.encoder.02.counter-mode 0
setp hm2_5i25.0.encoder.02.filter 1
setp hm2_5i25.0.encoder.02.index-invert 0
setp hm2_5i25.0.encoder.02.index-mask 0
setp hm2_5i25.0.encoder.02.index-mask-invert 0
setp hm2_5i25.0.encoder.02.scale [AXIS_2]ENCODER_SCALE
net z-pos-fb <= hm2_5i25.0.encoder.02.position
net z-vel-fb <= hm2_5i25.0.encoder.02.velocity
net z-pos-fb => axis.2.motor-pos-fb
net z-index-enable axis.2.index-enable <=> hm2_5i25.0.encoder.02.index-enable
net z-pos-rawcounts <= hm2_5i25.0.encoder.02.rawcounts
# ---setup home / limit switch signals---
net home-z => axis.2.home-sw-in
net min-z => axis.2.neg-lim-sw-in
net max-z => axis.2.pos-lim-sw-in
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
- Posts: 17983
- Thank you received: 4834
What I would suggest is setting the following error (and min following error) fairly large, say 1 inch
and then plotting the following error in halscope
It will be very difficult to tune unless the encoder scale and step/dir scale match (at least with FF1=1)
That is you should be able to set P=0 and still get approximately correct motion by velocity command only (courtesy of FF1)
Please Log in or Create an account to join the conversation.
- OT-CNC
- Offline
- Platinum Member
- Posts: 622
- Thank you received: 75
The hal file looks basically correct (but the INI file needs looking at also)
What I would suggest is setting the following error (and min following error) fairly large, say 1 inch
and then plotting the following error in halscope
It will be very difficult to tune unless the encoder scale and step/dir scale match (at least with FF1=1)
That is you should be able to set P=0 and still get approximately correct motion by velocity command only (courtesy of FF1)
I did the above, and it looks like the motion is correct when run at 12ipm and FF1=1.
A short vid here:
Something is still way off when p get's introduced. The following errors are large and the axis either creeps or bounced back and forth. I tried I and D to see if anything would improve.
Should I be looking at the encoder channel as well?
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
- Posts: 17983
- Thank you received: 4834
BTW I think a screen shot of halscope stopped at an appropriate time would be a lot easier to see
Please Log in or Create an account to join the conversation.
- OT-CNC
- Offline
- Platinum Member
- Posts: 622
- Thank you received: 75
If I understand correctly, the system is trying to keep the following error between FERROR (rapid move) and MIN_FERROR (slow feed rate) values.
How does this come into play in the hal file? Should this be the same number as the FERROR?
setp pid.z.maxerror .0005
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23178
- Thank you received: 4860
How does this come into play in the hal file? Should this be the same number as the FERROR?
setp pid.z.maxerror .0005
No, the pid error limits are all about controlling the way the pid works, mainly to prevent wind up.
The parameters are all described here:
www.linuxcnc.org/docs/html/man/man9/pid.9.html
Please Log in or Create an account to join the conversation.
- OT-CNC
- Offline
- Platinum Member
- Posts: 622
- Thank you received: 75
That part seems to work now for me.
Currently, I'm still having tuning issues. It does not seem to matter what I do, I can't see any clear progress. I'm re-attaching the ini file in case something is missing there.
Also, PCW how is progress on the custom 5i25 firmware for the SpinX? Thank you for your time.
# Generated by PNCconf at Wed Aug 19 18:14:48 2015
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
[EMC]
MACHINE = lathe_v6
DEBUG = 0
[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/ot/linuxcnc/nc_files
PYVCP = pyvcp-panel.xml
INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in
LATHE = 1
DEFAULT_LINEAR_VELOCITY = 0.250000
MAX_LINEAR_VELOCITY = 5.000000
MIN_LINEAR_VELOCITY = 0.010000
DEFAULT_ANGULAR_VELOCITY = 0.250000
MAX_ANGULAR_VELOCITY = 1.000000
MIN_ANGULAR_VELOCITY = 0.010000
EDITOR = gedit
GEOMETRY = xyz
[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
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
SERVO_PERIOD = 1000000
[HOSTMOT2]
# **** This is for info only ****
# DRIVER0=hm2_pci
# BOARD0=5i25
[HAL]
HALUI = halui
HALFILE = lathe_v6.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
[HALUI]
[TRAJ]
AXES = 3
COORDINATES = X Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 0.10
MAX_LINEAR_VELOCITY = 5.0
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
TOOL_CHANGE_WITH_SPINDLE_ON = 1
#********************
# Axis X
#********************
[AXIS_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.5
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 30
# 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 = 6.0
STEPGEN_MAXACCEL = 37.50
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 6.0
ENCODER_SCALE = 20000.0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
STEP_SCALE = 20000.0
MIN_LIMIT = -0.25
MAX_LIMIT = 12.0
HOME_OFFSET = 0.02500
HOME_SEARCH_VEL = 0.050000
HOME_LATCH_VEL = -0.030000
HOME_FINAL_VEL = 0.030000
HOME_USE_INDEX = YES
HOME_SEQUENCE = 1
#********************
# Axis Z
#********************
[AXIS_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.5
MIN_FERROR = 0.5
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 30
# 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 = 6.0
STEPGEN_MAXACCEL = 37.50
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 6.0
ENCODER_SCALE = -20000.0
# these are in nanoseconds
DIRSETUP = 1000
DIRHOLD = 1000
STEPLEN = 1000
STEPSPACE = 1000
STEP_SCALE = -20000.0
MIN_LIMIT = -10.000
MAX_LIMIT = 0.010
HOME_OFFSET =0.02500
HOME_SEARCH_VEL = 0.050000
HOME_LATCH_VEL = -0.030000
HOME_FINAL_VEL = 0.030000
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0
#********************
# Spindle
#********************
[SPINDLE_9]
P = 0
I = 0
D = 0
FF0 = 1
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 2000
Please Log in or Create an account to join the conversation.