Using an index pulse with stepgen
- tnl.lambert
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 1
21 Apr 2015 01:00 #57946
by tnl.lambert
Using an index pulse with stepgen was created by tnl.lambert
So, I'm running a CNC with 3 linear axes and a spindle. The spindle is hooked up to the encoder input on the board, so I run it in velocity mode with a PID. Problem is, I would like to home to the index pulses on the encoders for the other axes. I've got 24V index signals all set up and connected to an 'encoder' hal component, and then to the axis.N.index-enable pins. My home sequence should go like this:
1. Go the the home switch.
2. Back off the home switch to the next index pulse.
3. Stop and set the machine coordinate to 0.
but I'm getting:
1. Go the the home switch.
2. Back off the home switch to the next index pulse.
3. Move to machine 0.
Essentially, the machine coordinates are not being reset, so when the index-enable signal is released, the coordinate is updated with the old value. I think I'm having a problem that is similar to this thread: homing and encoders
So, my question is: how do I use an index pulse to home the axes without actually closing the loop with the encoder? All I have is the index pulse, and what I need to do is reset the stepgen/machine coordinate system.
1. Go the the home switch.
2. Back off the home switch to the next index pulse.
3. Stop and set the machine coordinate to 0.
but I'm getting:
1. Go the the home switch.
2. Back off the home switch to the next index pulse.
3. Move to machine 0.
Essentially, the machine coordinates are not being reset, so when the index-enable signal is released, the coordinate is updated with the old value. I think I'm having a problem that is similar to this thread: homing and encoders
So, my question is: how do I use an index pulse to home the axes without actually closing the loop with the encoder? All I have is the index pulse, and what I need to do is reset the stepgen/machine coordinate system.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
21 Apr 2015 02:51 - 21 Apr 2015 02:52 #57948
by Todd Zuercher
Replied by Todd Zuercher on topic Using an index pulse with stepgen
I think your error is in your ini settings for the axis in question.
If you want the 1st index pulse point to be set as the machine zero, and stop there, the ini home and home offset settings should be
(This is assuming all of your other ini settings are correct.)
If you need more assistance, or have more questions, it will help if you share your ini file.
If you want the 1st index pulse point to be set as the machine zero, and stop there, the ini home and home offset settings should be
HOME_OFFSET = 0
HOME =0
(This is assuming all of your other ini settings are correct.)
If you need more assistance, or have more questions, it will help if you share your ini file.
Last edit: 21 Apr 2015 02:52 by Todd Zuercher.
Please Log in or Create an account to join the conversation.
- tnl.lambert
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 1
21 Apr 2015 03:01 - 21 Apr 2015 03:21 #57949
by tnl.lambert
Replied by tnl.lambert on topic Using an index pulse with stepgen
Todd, thank for the feedback!
The INI file is correct, but here it is for your viewing pleasure, along with a video of the procedure, including some watched HAL pins.
Hope that helps.
The INI file is correct, but here it is for your viewing pleasure, along with a video of the procedure, including some watched HAL pins.
Hope that helps.
Last edit: 21 Apr 2015 03:21 by tnl.lambert.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
21 Apr 2015 04:17 #57951
by Todd Zuercher
Replied by Todd Zuercher on topic Using an index pulse with stepgen
What happens if you restart Linuxcnc?
My one machine that I home to index on, isn't running right now for me to compare behavior. (Took it down to move and relocate it in the shop, and haven't finished that project yet.)
Why isn't the encoder.counts changing? Something is goofy.
Could you share the hal file as well?
What hardware are you using to read the encoder?
My one machine that I home to index on, isn't running right now for me to compare behavior. (Took it down to move and relocate it in the shop, and haven't finished that project yet.)
Why isn't the encoder.counts changing? Something is goofy.
Could you share the hal file as well?
What hardware are you using to read the encoder?
Please Log in or Create an account to join the conversation.
21 Apr 2015 05:02 #57954
by andypugh
This might not be the best way to do it. You _might_ want to just and2 together the switch and the encoder pulse. Whether that will work rather depends in whether the machine can stop the search move in the length of the pulse.
Watching the homing sequence, the index-enable goes true during the slow latch move. (homing state 21, I think).
So, ideally the home switch pin to LinuxCNC would be
False if the actual switch is not active
True if the actual switch is active and the homing state is < 21
True if the index enable is active and the homing state >= 21
False if the index enable is false and the homing state is >=21
One way to do this would be with a comp HAL component to set a pin depending on homing state:http://www.linuxcnc.org/docs/html/man/man9/comp.9.html
Then you could use LUT5 to set up the three-input truth-table above (or something like it) www.linuxcnc.org/docs/html/man/man9/lut5.9.html
LUT5 will either make sense to you regardless of the docs, or it won't. There is a spreadsheet to help configure it here:
docs.google.com/spreadsheets/d/1_VlL39jU...E3JitvLzs/edit#gid=0
I think I would be tempted to not use an encoder component for this, but to write a simple custom component that did much the same logic as the encoder index-enable but without the overhead of trying to count encoder pulses that aren't used.
Replied by andypugh on topic Using an index pulse with stepgen
I've got 24V index signals all set up and connected to an 'encoder' hal component, and then to the axis.N.index-enable pins.
This might not be the best way to do it. You _might_ want to just and2 together the switch and the encoder pulse. Whether that will work rather depends in whether the machine can stop the search move in the length of the pulse.
Watching the homing sequence, the index-enable goes true during the slow latch move. (homing state 21, I think).
So, ideally the home switch pin to LinuxCNC would be
False if the actual switch is not active
True if the actual switch is active and the homing state is < 21
True if the index enable is active and the homing state >= 21
False if the index enable is false and the homing state is >=21
One way to do this would be with a comp HAL component to set a pin depending on homing state:http://www.linuxcnc.org/docs/html/man/man9/comp.9.html
Then you could use LUT5 to set up the three-input truth-table above (or something like it) www.linuxcnc.org/docs/html/man/man9/lut5.9.html
LUT5 will either make sense to you regardless of the docs, or it won't. There is a spreadsheet to help configure it here:
docs.google.com/spreadsheets/d/1_VlL39jU...E3JitvLzs/edit#gid=0
I think I would be tempted to not use an encoder component for this, but to write a simple custom component that did much the same logic as the encoder index-enable but without the overhead of trying to count encoder pulses that aren't used.
The following user(s) said Thank You: tnl.lambert
Please Log in or Create an account to join the conversation.
- tnl.lambert
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 1
22 Apr 2015 03:34 #57983
by tnl.lambert
Replied by tnl.lambert on topic Using an index pulse with stepgen
Thanks, everyone, for your input.
I've concluded a few things:
1. When the use-index setting is YES, the encoder.N-index-enable pin is primed when the home sensor is tripped.
2. When the use-index setting is NO, a tristate_bit hal component is needed to duplicate this function.
3. The home sequence numbers are different for both settings of the use-index (INI file) parameter. With the use-index, the final home state is 21, without, the final home state looks like 14.
4. When the use-index setting is YES, the encoder.counts is not reset on the home sensor. Hence, unless the axis is set up with an *actual* encoder, the index-enable pin will not do anything. The encoder hal component does not connect to the stepgen automagically.
With that said, the tie-in of the index pulse and the home sensor works very nicely. I've got a comp.N hal component (to determine the home state), the index-enable signal, and the actual home switch set as inputs for the lut5 component, for which the correct value was 0xFFFFFFF8. The behaviour of the homing process is now:
1. Go to the switch, prime index-enable.
2. Back off until the switch has released, and go to the first index pulse in the same direction.
3. Reset encoder counts and drop index enable at the first index pulse.
There are three duplicates of this system set up, so each axis has its own.
I've concluded a few things:
1. When the use-index setting is YES, the encoder.N-index-enable pin is primed when the home sensor is tripped.
2. When the use-index setting is NO, a tristate_bit hal component is needed to duplicate this function.
3. The home sequence numbers are different for both settings of the use-index (INI file) parameter. With the use-index, the final home state is 21, without, the final home state looks like 14.
4. When the use-index setting is YES, the encoder.counts is not reset on the home sensor. Hence, unless the axis is set up with an *actual* encoder, the index-enable pin will not do anything. The encoder hal component does not connect to the stepgen automagically.
With that said, the tie-in of the index pulse and the home sensor works very nicely. I've got a comp.N hal component (to determine the home state), the index-enable signal, and the actual home switch set as inputs for the lut5 component, for which the correct value was 0xFFFFFFF8. The behaviour of the homing process is now:
1. Go to the switch, prime index-enable.
2. Back off until the switch has released, and go to the first index pulse in the same direction.
3. Reset encoder counts and drop index enable at the first index pulse.
There are three duplicates of this system set up, so each axis has its own.
Please Log in or Create an account to join the conversation.
Time to create page: 0.071 seconds