Problem homing with index
10 Jul 2021 16:22 #214191
by PCW
Replied by PCW on topic Problem homing with index
Yes I think you are stuck with encoder feedback
Please Log in or Create an account to join the conversation.
11 Jul 2021 09:25 - 11 Jul 2021 13:42 #214240
by Stigoe
Replied by Stigoe on topic Problem homing with index
Thanks, PCW.
So if I understand correctly, I need to add a pid-component for X and Z in .hal, something likewith the necessary values in the .ini-file and similar for Z-axis? This example was found at
Closed loop with linear encoders but still backlash?.
Another thing, in [/url] Encoder Feedback you said encoder 0 was on the 4i85, while the encoder on 7i76e was encoder 4. I don't know if it is different between 7i76 and 7i76e, but on my 7i76, the encoder is encoder 00.[/url][/code]
So if I understand correctly, I need to add a pid-component for X and Z in .hal, something like
loadrt pid names=pid.x,pid.z
setp pid.x.Pgain [AXIS_0]P
setp pid.x.Igain [AXIS_0]I
setp pid.x.Dgain [AXIS_0]D
setp pid.x.bias [AXIS_0]BIAS
setp pid.x.FF0 [AXIS_0]FF0
setp pid.x.FF1 [AXIS_0]FF1
setp pid.x.FF2 [AXIS_0]FF2
setp pid.x.deadband [AXIS_0]DEADBAND
setp pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp pid.x.error-previous-target true
setp pid.x.maxerror .000
setp hm2_5i25.0.encoder.00.counter-mode 0
setp hm2_5i25.0.encoder.00.filter 1
setp hm2_5i25.0.encoder.00.index-invert 0
setp hm2_5i25.0.encoder.00.index-mask 0
setp hm2_5i25.0.encoder.00.index-mask-invert 0
setp hm2_5i25.0.encoder.00.scale [AXIS_0]ENCODER_SCALE
# ---closedloop stepper signals---
net x-pos-cmd <= axis.0.motor-pos-cmd
net x-vel-cmd <= axis.0.vel-cmd
net x-output => hm2_5i25.0.stepgen.00.position-cmd
net x-pos-fb <= hm2_5i25.0.encoder.02.position
net x-pos-fb => axis.0.motor-pos-fb
net x-enable <= axis.0.amp-enable-out
net x-enable => hm2_5i25.0.stepgen.00.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
Another thing, in [/url] Encoder Feedback you said encoder 0 was on the 4i85, while the encoder on 7i76e was encoder 4. I don't know if it is different between 7i76 and 7i76e, but on my 7i76, the encoder is encoder 00.[/url][/code]
Last edit: 11 Jul 2021 13:42 by Stigoe. Reason: Found several mistakes in my first attempt
Please Log in or Create an account to join the conversation.
11 Jul 2021 14:28 #214263
by PCW
Replied by PCW on topic Problem homing with index
Yes basically that's right, except the stepgen must be run in velocity mode
and the PID output drives the stepgen velocity, not position
How encoders are arranged depends on the firmware used
and the PID output drives the stepgen velocity, not position
How encoders are arranged depends on the firmware used
Please Log in or Create an account to join the conversation.
- ldmarsaglia
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 2
02 Sep 2021 12:04 - 02 Sep 2021 12:06 #219431
by ldmarsaglia
Replied by ldmarsaglia on topic Problem homing with index
I don't know if you're still stuck with homing only with the switches or if you solved it closing the loop with the encoders but here's a solution I did on one of our machines (a Mazak lathe) to overcome the problem of homing with index using open loop configuration.
As Peter says, it's not possible at the moment (version 2.8) for LinuxCNC to reset the counters to zero with an index pulse if you're using an open loop configuration with steppers or servos. This is because the index pulse resets the Mesa encoder counters by hardware if I understand it right.
But, I could find a simple way of solving this with pretty good results. Basically I bypassed the home switch on the final homing stage (when the homing uses the latch velocity) by means of detecting the joint.N.home-state of the joints on the machine. So my homing sequence is working only with home switchs, but when the time comes to do the final home switch tripping, I just use the index pulse to fool LCNC and get a more accurate homing. This is not as good as hardware counter reset, but it's working flawleslly (tested with a dial indicator). The best way to be sure the repetability is good is to use a really slow latching speed.
I hope this serves to anyone facing this problem. This shows again how HAL is amazing when it comes to adapt LCNC to basically anything.
Thanks as always to everyone!
As Peter says, it's not possible at the moment (version 2.8) for LinuxCNC to reset the counters to zero with an index pulse if you're using an open loop configuration with steppers or servos. This is because the index pulse resets the Mesa encoder counters by hardware if I understand it right.
But, I could find a simple way of solving this with pretty good results. Basically I bypassed the home switch on the final homing stage (when the homing uses the latch velocity) by means of detecting the joint.N.home-state of the joints on the machine. So my homing sequence is working only with home switchs, but when the time comes to do the final home switch tripping, I just use the index pulse to fool LCNC and get a more accurate homing. This is not as good as hardware counter reset, but it's working flawleslly (tested with a dial indicator). The best way to be sure the repetability is good is to use a really slow latching speed.
I hope this serves to anyone facing this problem. This shows again how HAL is amazing when it comes to adapt LCNC to basically anything.
Thanks as always to everyone!
Last edit: 02 Sep 2021 12:06 by ldmarsaglia. Reason: Bad typing
Please Log in or Create an account to join the conversation.
07 Sep 2021 16:35 #219861
by hoffb77
I lost my ability to home to index on one of my machines when I installed Mach BRC's. Reason being, I couldnt get velocity mode to play nice so I run position mode and let the PID on the drives run velocity control. I wasnt sure why I lost index homing until I read what Peter said earlier in this thread.
I love this place!
Replied by hoffb77 on topic Problem homing with index
I never considered doing that. Thank you.Basically I bypassed the home switch on the final homing stage (when the homing uses the latch velocity) by means of detecting the joint.N.home-state of the joints on the machine. So my homing sequence is working only with home switchs, but when the time comes to do the final home switch tripping, I just use the index pulse to fool LCNC and get a more accurate homing. This is not as good as hardware counter reset, but it's working flawleslly (tested with a dial indicator). The best way to be sure the repetability is good is to use a really slow latching speed.
I lost my ability to home to index on one of my machines when I installed Mach BRC's. Reason being, I couldnt get velocity mode to play nice so I run position mode and let the PID on the drives run velocity control. I wasnt sure why I lost index homing until I read what Peter said earlier in this thread.
I love this place!
Please Log in or Create an account to join the conversation.
07 Sep 2021 16:54 #219863
by hoffb77
Replied by hoffb77 on topic Problem homing with index
Will this require stepgen to be in velocity mode? I am currently running a machine in position mode and would like to get index homing back. Unless there's a way to get the Machdrive BRC's to work with stepgen in velocity mode. The drive PID fights with the velocity signal coming from the controller. I'm happy with the performance in position mode using the drive PID but no index homing.........There is new firmware and support in LinuxCNC 2.9
for homing to index on pure step/dir systems if you want to try
it. This does require a direct input for the stepgen index though
it can be shared with an encoder index say on a 7I85/7I85S
Please Log in or Create an account to join the conversation.
08 Sep 2021 12:59 #219937
by Stigoe
No, I haven't solved the problem yet. Are you using index pulses from the motor or from linear scales? I'm using linear scales and the distance between index pulses, at least on my X-axis, is 100mm. Do you have some examples from the .ini and .hal-files on how you did it?
I have tried to add the PID component, but when I try to home X-axis, I get "joint 0 following error -0.018577 is greater than limit 0.0.17250". It moves the correct direction. When I move X-axis away from operator (without PID enabled), encoder count is negative.
From .ini (X-axis)
From .hal
Feeling a bit lost right now...
Stig
Replied by Stigoe on topic Problem homing with index
Sorry for the late reply and lack of updates on progress. Life in general and work has interfered with my chance to work on this problem.I don't know if you're still stuck with homing only with the switches or if you solved it closing the loop with the encoders but here's a solution I did on one of our machines (a Mazak lathe) to overcome the problem of homing with index using open loop configuration.
But, I could find a simple way of solving this with pretty good results. Basically I bypassed the home switch on the final homing stage (when the homing uses the latch velocity) by means of detecting the joint.N.home-state of the joints on the machine. So my homing sequence is working only with home switchs, but when the time comes to do the final home switch tripping, I just use the index pulse to fool LCNC and get a more accurate homing. This is not as good as hardware counter reset, but it's working flawleslly (tested with a dial indicator). The best way to be sure the repetability is good is to use a really slow latching speed.
No, I haven't solved the problem yet. Are you using index pulses from the motor or from linear scales? I'm using linear scales and the distance between index pulses, at least on my X-axis, is 100mm. Do you have some examples from the .ini and .hal-files on how you did it?
I have tried to add the PID component, but when I try to home X-axis, I get "joint 0 following error -0.018577 is greater than limit 0.0.17250". It moves the correct direction. When I move X-axis away from operator (without PID enabled), encoder count is negative.
From .ini (X-axis)
FERROR = 0.050
MIN_FERROR = 0.010
# MIN_LIMIT = -6.000
# MAX_LIMIT = 0.000001
MIN_LIMIT = -0.000001
MAX_LIMIT = 6.000
HOME_OFFSET = 0.500
#HOME_OFFSET = 0.025
HOME_SEARCH_VEL = -0.750
HOME_LATCH_VEL = 0.100
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
HOME_USE_INDEX = YES
HOME_FINAL_VEL = 0.200
#ENCODER FEEDBACK
ENCODER_SCALE = 5080
P = 90
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0.0005
BIAS = 0
DEADBAND = 0.0001
MAX_OUTPUT = 0
From .hal
net xindex-enable axis.0.index-enable <=> hm2_5i25.0.encoder.02.index-enable
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.control-type 1
setp pid.x.Pgain [AXIS_0]P
setp pid.x.Igain [AXIS_0]I
setp pid.x.Dgain [AXIS_0]D
setp pid.x.bias [AXIS_0]BIAS
setp pid.x.FF0 [AXIS_0]FF0
setp pid.x.FF1 [AXIS_0]FF1
setp pid.x.FF2 [AXIS_0]FF2
setp pid.x.deadband [AXIS_0]DEADBAND
setp pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp pid.x.error-previous-target true
setp pid.x.maxerror [AXIS_0]MAXERROR
# ---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_0]ENCODER_SCALE
# ---closedloop stepper signals---
net x-pos-cmd <= axis.0.motor-pos-cmd
net x-vel-cmd <= axis.0.joint-vel-cmd
net x-output => hm2_5i25.0.stepgen.00.velocity-cmd
#net x-pos-fb <= hm2_5i25.0.encoder.02.position
#net x-pos-fb => axis.0.motor-pos-fb
net x-enable <= axis.0.amp-enable-out
net x-enable => hm2_5i25.0.stepgen.00.enable
#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
#net xpos-cmd axis.0.motor-pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-cmd
net x-pos-cmd axis.0.motor-pos-cmd => pid.x.command
#net x-output => hm2_5i25.0.stepgen.00.position-cmd
net x-pos-fb hm2_5i25.0.encoder.02.position => axis.0.motor-pos-fb
#net xpos-fb hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-fb => axis.0.motor-pos-fb
Feeling a bit lost right now...
Stig
Please Log in or Create an account to join the conversation.
08 Sep 2021 13:20 #219940
by PCW
Yes, the stepgen must be set for velocity mode, but this has nothing to do
with the drives mode (99.99% of step/dir operated drives use position mode)
(that is, the stepgen output is always a position signal)
Replied by PCW on topic Problem homing with index
There is new firmware and support in LinuxCNC 2.9
for homing to index on pure step/dir systems if you want to try
it. This does require a direct input for the stepgen index though
it can be shared with an encoder index say on a 7I85/7I85S
Will this require stepgen to be in velocity mode? I am currently running a machine in position mode and would like to get index homing back. Unless there's a way to get the Machdrive BRC's to work with stepgen in velocity mode. The drive PID fights with the velocity signal coming from the controller. I'm happy with the performance in position mode using the drive PID but no index homing.........
Yes, the stepgen must be set for velocity mode, but this has nothing to do
with the drives mode (99.99% of step/dir operated drives use position mode)
(that is, the stepgen output is always a position signal)
Please Log in or Create an account to join the conversation.
- HalaszAttila
- Offline
- Premium Member
Less
More
- Posts: 143
- Thank you received: 5
17 Mar 2022 07:08 #237521
by HalaszAttila
Replied by HalaszAttila on topic Problem homing with index
Hello,
I also ran into the mentioned problem. I use LinuxCNC 2.8.2 (Mesa 7i92+7i76+7i85+7i84) with Chinese servo drives in velocity mode (speed reference: STEP/DIR).
But during tuning the PID, i realised that these cheap drives has a bug in velocity mode which why i cant use them in this mode.
Therefore i changed it to position mode (Pos ref: Step/Dir), and the encoder feedback want to use for index homing and following error check (following error alarm is working).
My question is, becouse the machine HAL config is fully compleated, can i implement the hostmot2 stepgen part from 2.9.0 to my 2.8.2 config (overwrite the component and recompile the source)?
And the new firmware mentioned by PCW, is for fpga card? Where can i find it?
Or maybe would be easier to use 2.9.0? It is a very accurate Mazak QT-8 lathe with tool setter arm, and must to use index-homing on it.
Thanks, Attila.
I also ran into the mentioned problem. I use LinuxCNC 2.8.2 (Mesa 7i92+7i76+7i85+7i84) with Chinese servo drives in velocity mode (speed reference: STEP/DIR).
But during tuning the PID, i realised that these cheap drives has a bug in velocity mode which why i cant use them in this mode.
Therefore i changed it to position mode (Pos ref: Step/Dir), and the encoder feedback want to use for index homing and following error check (following error alarm is working).
My question is, becouse the machine HAL config is fully compleated, can i implement the hostmot2 stepgen part from 2.9.0 to my 2.8.2 config (overwrite the component and recompile the source)?
And the new firmware mentioned by PCW, is for fpga card? Where can i find it?
Or maybe would be easier to use 2.9.0? It is a very accurate Mazak QT-8 lathe with tool setter arm, and must to use index-homing on it.
Thanks, Attila.
Please Log in or Create an account to join the conversation.
17 Mar 2022 09:55 #237524
by andypugh
Replied by andypugh on topic Problem homing with index
It should be possible to recompile just the stepgen module, or the hostmot2 driver, but I wouldn't know where to start.
It might even be possible to copy the
It's probably easiest to switch to 2.9, the existing config should still work fine.
It might even be possible to copy the
It's probably easiest to switch to 2.9, the existing config should still work fine.
The following user(s) said Thank You: HalaszAttila
Please Log in or Create an account to join the conversation.
Time to create page: 0.131 seconds