Strange homing behavior
On the video you can see near -250 the homing switch being triggered. Y is reset to 0 and it starts looking for index in the opposite direction. But after index is found at 3-4 it resets Y to -250 and travels to 0 at HOME_FINAL_VEL speed.
The soft limit error is triggered at the very end of the homing, when the axis is back at its initial power-on position.
The whole thing is very weird...
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
- Posts: 5000
- Thank you received: 1409
Please Log in or Create an account to join the conversation.
Also the encoder position feedback from the drives is wired but currently not used in LinuxCNC, only the index pulse is.
Here's the relevant HAL config for the axis:
net y-home hm2_7i94.0.7i84.0.1.input-00 => joint.1.home-sw-in
net y-limit-min hm2_7i94.0.7i84.0.1.input-01-not => joint.1.neg-lim-sw-in
net y-limit-max hm2_7i94.0.7i84.0.1.input-02-not => joint.1.pos-lim-sw-in
net y-enable joint.1.amp-enable-out => hm2_7i94.0.stepgen.01.enable pid.1.enable
# position command and feedback
net y-pos-cmd joint.1.motor-pos-cmd => pid.1.command
net y-pos-fb hm2_7i94.0.stepgen.01.position-fb => joint.1.motor-pos-fb pid.1.feedback
net y-command pid.1.output hm2_7i94.0.stepgen.01.velocity-cmd
setp hm2_7i94.0.stepgen.01.control-type 1
setp hm2_7i94.0.stepgen.01.step_type 0
setp hm2_7i94.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
setp hm2_7i94.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
setp hm2_7i94.0.stepgen.01.steplen [JOINT_1]STEPLEN
setp hm2_7i94.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
setp hm2_7i94.0.stepgen.01.position-scale [JOINT_1]SCALE
setp hm2_7i94.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAX_VEL
setp hm2_7i94.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAX_ACC
setp pid.1.error-previous-target true
setp pid.1.Pgain [STEPGEN_PID]P
setp pid.1.Igain [STEPGEN_PID]I
setp pid.1.Dgain [STEPGEN_PID]D
setp pid.1.bias [STEPGEN_PID]BIAS
setp pid.1.FF0 [STEPGEN_PID]FF0
setp pid.1.FF1 [STEPGEN_PID]FF1
setp pid.1.FF2 [STEPGEN_PID]FF2
setp pid.1.deadband [STEPGEN_PID]DEADBAND
setp pid.1.maxoutput [STEPGEN_PID]MAX_OUTPUT
setp pid.1.maxerror [STEPGEN_PID]MAX_ERROR
# Y Encoder
setp hm2_7i94.0.encoder.01.counter-mode 0
setp hm2_7i94.0.encoder.01.filter 1
setp hm2_7i94.0.encoder.01.scale 1000
net y-index-enable hm2_7i94.0.encoder.01.index-enable <=> joint.1.index-enable
Please Log in or Create an account to join the conversation.
LinuxCNC expects the feedback position to be cleared on index
(encoder position is cleared on index but stepgen position is not)
Possible fixes are
1. Use the encoders for feedback (possibly just looping back the step/dir signals to the encoder inputs)
2. Use firmware with stepgen index support
Please Log in or Create an account to join the conversation.
HOME_INDEX_NO_ENCODER_RESET
which is meant to be used where the encoder does not reset.
I just stumbled on this the other day
Please Log in or Create an account to join the conversation.
So with index homing LinuxCNC expects joint.X.motor-pos-fb to be reset to 0 on the index pulse. This is unfortunately not documented anywhere.
HOME_INDEX_NO_ENCODER_RESET is interesting... Yes it should solve my issue, but it also throws away the repeatability of the index. I'll look into this stepgen with index support feature.
Before going further I'm trying to scale the encoder position feedback correctly. The servo drive is configured to output 10'000 encoder pulses per revolution. I have a 10mm pitch ballscrew so this means 1000 pulses per mm, so encoder scale is set to 1000. It's a quadrature encoder.
However the encoder position is consistently off by a factor of 4. When DRO position = 1, encoder position = 4. Are Mesa encoders configured to count 4x per PPR?
EDIT: it seems so:
scale - (Float, RW) Converts from count units to position units. A quadrature encoder will normally have 4 counts per pulse so a 100 PPR encoder would be 400 counts per revolution.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
- Posts: 5000
- Thank you received: 1409
Please Log in or Create an account to join the conversation.
This leads to 2 more questions:
1. Should the joint index-enable pin be also connected to the pid index-enable?
2. I see there is support in hostmot2 firmware for a shared index pin between stepgen and muxed encoder. Is there something alike for a non-muxed encoder?
Please Log in or Create an account to join the conversation.
2. Yes: (from IDROMConts) constant SharedSDQCIdxPin : std_logic_vector(7 downto 0) := x"06";
Please Log in or Create an account to join the conversation.
However I can't find this SharedSDQCIdxPin reference anywhere.
I tried firmware from www.mesanet.com/software/parallel/hostmot2.zip
and freeby.mesanet.com/software/parallel/hostmot2.zip
Please Log in or Create an account to join the conversation.