Homing with 2 inputs/sensors?

More
23 Aug 2025 17:06 #333817 by hitchhiker
Replied by hitchhiker on topic Homing with 2 inputs/sensors?
But its open loop... i was thinking velocity mode is for closed loop.

Please Log in or Create an account to join the conversation.

More
23 Aug 2025 17:22 #333818 by PCW
Replied by PCW on topic Homing with 2 inputs/sensors?
Actually all LinuxCNC stepgens run in velocity mode. The velocity is typically
calculated with dp/dt (rate change of position). When index is detected, this causes
a step in the position (position is zeroed on index detection). The step will cause a large
bogus velocity calculation in position mode stepgens. This is bounded by the stepgen
acceleration bound so not huge but definitely will generate a detectable motion glitch.

In velocity mode, this is worked around by the fact that the PID component has an index-enable
input, so can work around this issue (by skipping the velocity calculation for the position step).

It would be possible to fix this issue in the position mode, but since in general, velocity mode works better
it has not been addressed.

Overall these issues show that LinuxCNCs index handling needs reworking, The encoder position should really
not be cleared (unless the hardware has no other option) , as it creates the need for all these ugly work-arounds
and in fact the index position offset should be applied at a higher level and not at the low (hal control loop) level

Please Log in or Create an account to join the conversation.

More
23 Aug 2025 17:27 #333819 by hitchhiker
Replied by hitchhiker on topic Homing with 2 inputs/sensors?
... i have no pid for x y z... but for s.. spindle in my hal.

Could this be a reason?
But then.. what a good values for the pid when its open loop?

P i d ff and the rest?

Thanks

Please Log in or Create an account to join the conversation.

More
23 Aug 2025 17:45 #333820 by PCW
Replied by PCW on topic Homing with 2 inputs/sensors?
But its open loop... i was thinking velocity mode is for closed loop.

Even with open loop stepgens there is a local closed loop that
takes the commanded position, the stepgen feedback position,
and current velocity and generates a new velocity command
every servo thread invocation.

In position mode, this loop is still there but embedded in the driver.
 

Please Log in or Create an account to join the conversation.

More
23 Aug 2025 19:06 #333822 by hitchhiker
Replied by hitchhiker on topic Homing with 2 inputs/sensors?
if its so.. then i got it...

on the table it works...

here my ini for the axis
#********************
# Axis Z
#********************
[AXIS_Z]
MIN_LIMIT = -2000.0
MAX_LIMIT = 2000.0
MAX_VELOCITY = 83
MAX_ACCELERATION = 500

[JOINT_2]
TYPE = LINEAR
MAX_VELOCITY = 83
MAX_ACCELERATION = 500
STEPGEN_MAXVEL = 150
STEPGEN_MAXACCEL = 1500
STEPSPACE  = 5000
STEP_SCALE = 400
STEPLEN    = 5000
MIN_LIMIT = -2000.0
MAX_LIMIT = 2000.0
HOME = 0.0
HOME_OFFSET = 0.0
FERROR = 1
MIN_FERROR = 0.25
HOME_SEQUENCE = 0
DIRSETUP   = 5000
DIRHOLD    = 5000

P = 1000
I = 0
D = 0
BIAS = 0
FF0 = 0
FF1 = 1
FF2 = 0
DEADBAND = 0.001
MAX_OUTPUT = 0
MAX_ERROR = 0.0001

HOME_SEARCH_VEL = -30.000000
HOME_LATCH_VEL = -0.100000
HOME_FINAL_VEL = -0.10000
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0

and here my hal for the axis
####Z-Axis Setup####

setp   pid.z.Pgain     [JOINT_2]P
setp   pid.z.Igain     [JOINT_2]I
setp   pid.z.Dgain     [JOINT_2]D
setp   pid.z.bias      [JOINT_2]BIAS
setp   pid.z.FF0       [JOINT_2]FF0
setp   pid.z.FF1       [JOINT_2]FF1
setp   pid.z.FF2       [JOINT_2]FF2
setp   pid.z.deadband  [JOINT_2]DEADBAND
setp   pid.z.maxoutput [JOINT_2]MAX_OUTPUT
setp   pid.z.error-previous-target true
setp   pid.z.maxerror [JOINT_2]MAX_ERROR

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

net z-pos-cmd    <= joint.2.motor-pos-cmd
net z-vel-cmd    <= joint.2.vel-cmd
net z-output     <= [HMOT](CARD0).stepgen.02.velocity-cmd
net z-pos-fb     <= [HMOT](CARD0).stepgen.02.position-fb
net z-pos-fb     => joint.2.motor-pos-fb
net z-enable     <= joint.2.amp-enable-out
net z-enable     => [HMOT](CARD0).stepgen.02.enable


setp   [HMOT](CARD0).stepgen.02.dirsetup        [JOINT_2]DIRSETUP
setp   [HMOT](CARD0).stepgen.02.dirhold         [JOINT_2]DIRHOLD
setp   [HMOT](CARD0).stepgen.02.steplen         [JOINT_2]STEPLEN
setp   [HMOT](CARD0).stepgen.02.stepspace       [JOINT_2]STEPSPACE
setp   [HMOT](CARD0).stepgen.02.position-scale  [JOINT_2]STEP_SCALE
setp   [HMOT](CARD0).stepgen.02.step_type        0
setp   [HMOT](CARD0).stepgen.02.control-type     1
setp   [HMOT](CARD0).stepgen.02.maxaccel         [JOINT_2]STEPGEN_MAXACCEL
setp   [HMOT](CARD0).stepgen.02.maxvel          [JOINT_2]STEPGEN_MAXVEL



net z-pos-fb => joint.2.motor-pos-fb
net z-index-enable    joint.2.index-enable  <=>  [HMOT](CARD0).stepgen.02.index-enable


i write it by hand... do i forget something? or does it looks ok?

on the table i only work with 2 button switches .. and it do what it should do.
if this was the solution it was not the big deal to do the changes...

Please Log in or Create an account to join the conversation.

More
26 Aug 2025 19:28 #333961 by hitchhiker
Replied by hitchhiker on topic Homing with 2 inputs/sensors?
works now perfect

Please Log in or Create an account to join the conversation.

Time to create page: 0.086 seconds
Powered by Kunena Forum