- Configuring LinuxCNC
- Advanced Configuration
- [solved] Rehoming Lathespidle / Rotary-Axis from inside GCode
[solved] Rehoming Lathespidle / Rotary-Axis from inside GCode
- Aciera
- Topic Author
- Offline
- Administrator
- Posts: 3959
- Thank you received: 1714
The problem is this:
Running the motor in speed mode for lathe operations disables the encoder feedback from the servo controller and the angular position information for the rotary axis in linuxCNC is out of sync. So switching the servo controller back to position mode leaves me with a randomly positioned rotary axis that needs to be rehomed before continuing with a GCode milling operation.
I have the index signal available for homing but how do I reset the absolute position of the rotary joint from inside Gcode?
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23310
- Thank you received: 4858
Please Log in or Create an account to join the conversation.
- chris@cnc
- Offline
- Platinum Member
- Posts: 529
- Thank you received: 139
My idea was to reset by M-code.
forum.linuxcnc.org/38-general-linuxcnc-q...cmd-or-g-code#208748
But rehoming is not supported yet.
forum.linuxcnc.org/24-hal-components/466...enable-signal#250055
Please Log in or Create an account to join the conversation.
- Aciera
- Topic Author
- Offline
- Administrator
- Posts: 3959
- Thank you received: 1714
I thought somebody came up with a custom component that reset the encoder count. But sure enough I can't find it...I try to this since 2 years but without success.
My idea was to reset by M-code.
forum.linuxcnc.org/38-general-linuxcnc-q...cmd-or-g-code#208748
But rehoming is not supported yet.
forum.linuxcnc.org/24-hal-components/466...enable-signal#250055
Manually enabling the index-enable and running into the index does seem to reset the encoder count but, alas, also raises a joint following error.
So are you saying that G33 resets (ie rehomes) the absolute position of an axis?Running a dummy G33 move should cause an index set/reset cycle and zero the encoder counts in LinuxCNC.
Just realized that with my setup I have no encoder feedback during speed mode (ie no thread cutting in lathe mode) XD. Looks like i'll need to rethink a thing or two.
Please Log in or Create an account to join the conversation.
- Aciera
- Topic Author
- Offline
- Administrator
- Posts: 3959
- Thank you received: 1714
The other thing this means though is that with encoder feedback closing the position loop in linuxcnc running in speed mode will trigger a joint following error because the stepgen is not involved in lathemode.
Please Log in or Create an account to join the conversation.
- chris@cnc
- Offline
- Platinum Member
- Posts: 529
- Thank you received: 139
Regarding your homing offset. I take a look in my ini and the x,y,z axis pid is 5 and a-axis pid is 50. But i can't remember why i increase this number. But it works i engraving round 2 mm letters with laser. It's just only 400W Delta drive. If it helps, i would slowly increase the pid and test what happens.
Last idea is a custom comp that count a axis encoder only 0-360°. But i never start.
Please Log in or Create an account to join the conversation.
- Aciera
- Topic Author
- Offline
- Administrator
- Posts: 3959
- Thank you received: 1714
1. we start in axis mode and home the rotary using index
2. to switch to spindle mode we orient the rotary to a known position, disconnect the encoder signals (in hal) and switch the controller to speed mode. Since (in my case at least) it would keep sending signals in speed mode and the stepgen remains at it's last position we would get a joint following error otherwise.
3. to switch back to rotary mode: orient the spindle to the known last (rotary) position (M19 spindle orient seems a likely candidate here, M33 is a bit of a question mark for me), connect the encoder and switch the controller to position mode.
[edit]
Indeed, the pid values in the ini had to be adjusted properly to minimize the following error. Takes a bit more effort to get the values needed. Thanks!
Thanks for all the input.
Please Log in or Create an account to join the conversation.
- Aciera
- Topic Author
- Offline
- Administrator
- Posts: 3959
- Thank you received: 1714
ok, i think get your point now. G33 lets me reset the encoder count on the index signal without causing a following error.
@chris
Not sure if you already know this:
Looks interesting.
[edit]
Doesn't actually switch between rotary and spindle mode though but still worth a look.
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
- Posts: 1814
- Thank you received: 733
I'm starting a C-axis lathe project too... good timing.
I recalled NoJo posting quite a bit about his trials and challenges implementing a spindle/C-axis switching function, as well as polar coordinate switching. Like him (and you), I plan to use a step-dir controlled servo for my spindle motor.
He hasn't posted in over a year (or reported complete success), but I did find some files that may help you (us) accomplish what you want. Note that I've just started reading the files and haven't really digested them yet.
caxis.comp appears to manage the c-axis to spindle switching
gn.userkins.comp appears to handle polar interpolation when C-axis is enabled
Hopefully you find these useful. I also found a zip of NoJo's complete config and remaps, but it appears to be an earlier version than the two attached here.
Please Log in or Create an account to join the conversation.
- Aciera
- Topic Author
- Offline
- Administrator
- Posts: 3959
- Thank you received: 1714
Thanks, actually that is probably what made me think that there was a component to switch between rotary and spindle. Seems it's not really as simple as recycling a component though.
I think NoJo ended up doing a fair bit of customizing in the source code that was not shared at the time.
Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
- Advanced Configuration
- [solved] Rehoming Lathespidle / Rotary-Axis from inside GCode