Resetting Rotary Axis to Zero

More
15 Jun 2018 02:21 #112388 by Sparky961
After completing a program that involves multiple turns of the rotary axis, I'd like to return to my start position for the next cycle. I want this to happen without having to "unwind" the rotary axis, rather just have it return to the nearest zero equivalent position.

I know that WRAPPED_ROTARY=1 is one way to accomplish this, but using this would mean that I'd need to write all of my combined motion in incremental mode, which I do not want to do for more than a few reasons.

I also know that I can put values into the axis position registers using G10 L20 Pn B0. I see that G10 L2 is supposed to write a value to the coordinate system regisiter but when I do this the position changes accordingly. I'm not able to reset both of these. If I don't, I will have an accumulating offset every time a cycle is run.

I want the equivalent of homing - where I tell it "this is zero", period. Is there a good way to accomplish this from G code?

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

More
15 Jun 2018 11:15 #112397 by BigJohnT
G92 works for me in a simulator. Move to the nearest position ie. if your at 739 move to 720 and say G92 A0.

JT

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

More
15 Jun 2018 12:18 #112400 by Sparky961
After reading the details for G92 I wonder if this wouldn't have the same effect as G10 L20. It uses an offset to zero the current position, so if my position was always some positive number when the program completes then the absolute offset would be increasing by that amount every cycle. Some might argue this isn't a problem because the number is so big, but because it's so big it's also hard to test what happens when the number overflows.

This is all speculation though, as I haven't tried it yet. I will do so. Thanks for suggesting another option.

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

More
15 Jun 2018 21:28 #112440 by MaHa
Replied by MaHa on topic Resetting Rotary Axis to Zero
I use this to prevent unwind A-axis:

G10 L20 P#5220 A[#5423 MOD 360]
The following user(s) said Thank You: nkp, alan_3301, cadcam

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

More
16 Jun 2018 01:22 #112454 by Sparky961

I use this to prevent unwind A-axis:

G10 L20 P#5220 A[#5423 MOD 360]


This is much more clever than just using G10 L20 P1 A0 like I was. Yours accounts for different coordinate systems in effect and "rewinds" to the same angle but in the 0 -> 359.999 range.

However, it still has the issue of an increasing offset every time you do it. For most people this won't become an issue, but this machine will be running the same program over and over day after day, week after week. I don't want to leave this to chance.

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

More
22 Jun 2018 12:57 #112756 by andypugh

However, it still has the issue of an increasing offset every time you do it. For most people this won't become an issue, but this machine will be running the same program over and over day after day, week after week. I don't want to leave this to chance.


You probably don't need to worry about this. The position is calculated using double-precision float.
This has 17 significant digits. Assuming that you have 4 decimal places displayed you will start to see a loss of precision in the last digit in 10000000000000 degrees. That's 52 years of turning at 1000 rpm for 24 hours a day.

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

More
22 Jun 2018 16:31 #112776 by Sparky961
Yes, this does seem to be the standard answer. Although it strikes me as being too similar to the Y2K fiasco, and not at all an elegant solution. It is, however, a workable solution and the one I've settled on so as not to be sidetracked by something that isn't an immediate problem.

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

More
22 Jun 2018 19:43 - 24 Jun 2018 19:00 #112784 by Badger
I haven't tried this yet but I assume it will work and be of great benefit to my particular situation. My question is why/how does it work? I've looked the DOCs and googled it but its still as clear as mud to me.

So I tried it in a sub-routine at the end of a sub-path and it works! It seems to mathematically take away all full 360 degree rotations and leaves the remainder, a big help. I like to get back to zero so I can visually make sure nothing wonky happened since I don't fully trust my mechanics, so I just add "G0 A0" to the sub-routine and it essentially homes. Fantastic! and Thanks!
Last edit: 24 Jun 2018 19:00 by Badger.

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

More
24 Jun 2018 22:18 #112824 by andypugh

I haven't tried this yet but I assume it will work and be of great benefit to my particular situation. My question is why/how does it work? I've looked the DOCs and googled it but its still as clear as mud to me.


The key sections are:
linuxcnc.org/docs/2.7/html/gcode/g-code.html#gcode:g10-l20
linuxcnc.org/docs/2.7/html/gcode/overvie...:numbered-parameters
linuxcnc.org/docs/2.7/html/gcode/overvie...ode:binary-operators (though that does rather assume that you already know what the modulus operator does)
The following user(s) said Thank You: joekline9, Badger

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

More
26 May 2020 13:20 #168977 by cadcam

I use this to prevent unwind A-axis:

G10 L20 P#5220 A[#5423 MOD 360]


This is excellent. Thank you. For fusion users, just add -
/* Set to A0 and prevent unnecessary unwind */
writeBlock(
gMotionModal.format(0),
conditional(abcFormat.format(abc.x) == 0, "G10 L20 P#5220 A[#5423 MOD 360]")
);

Cheers
The following user(s) said Thank You: joekline9, Shu

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

Time to create page: 0.190 seconds
Powered by Kunena Forum