Actually no. Lets say a current file (that requires some fixed position XY machining) first used continuous rotary machining and that stopped at 36,010 degrees. (+100R10.0*) At this point I would "mod" (return the modulus of the {current_position}/360) that position to get 10.000* prior to the next rotary positioning move: G0 B90 Saves 100 wraps
One controller I use does this with an "L28.1" command, another I had to write a short macro similar to:
B_current =0
B_new =0
B_new= (MOD{B_current}/360)
VA,,,,,,,,,,,,,10 (sets B Axis MCS to 10)
In any case, I am looking to reset current machine position to its relative relational position minus the revs it took to get there
Rotary Axis Questions
Moderator: cnckeith
-
- Posts: 2164
- Joined: Sat Nov 18, 2017 2:32 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: Acorn 238
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Marquette, MI
- Contact:
-
- Posts: 652
- Joined: Fri Nov 30, 2018 1:04 pm
- Acorn CNC Controller: Yes
- Plasma CNC Controller: No
- AcornSix CNC Controller: No
- Allin1DC CNC Controller: No
- Hickory CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Thorp WI
Re: Rotary Axis Questions
I'm looking into the same sort of scenario, and came across this in the programming manual?
13.) How do I Round Decimal Values to Whole Numbers
It is often necessary to round fractional values to whole numbers (integers). For example, if you need to bring a rotary ta-
ble, which may be at any angle, to the nearest whole turn (whole multiple of 360°), then you would want to round its posi-
tion (converted to turns) to the nearest integer, then convert back to degrees and send the axis to that position.
Beginning with CNC12 version 4.14, you can use the functions “FIX” and “FUP” to round down or up to the next integer
value. Note that for negative values, FIX still rounds down (thus away from zero) and FUP still rounds up (towards zero).
With CNC12 v4.14 or newer, then, you can round to the nearest integer by first adding 0.5, then rounding down:
#100 = FIX[#5044/360.0 + 0.5] * 360.0
G90 G0 B#100
It seems to work, but I wonder if there would be a compounding rounding error if done a number of times. It's not much, 0.003º or so for one shot.
Using MOD seems to work as well, but has the same tiny error.
#100 = [#5044 MOD 360] ; Not sure if this is right, but it was the only way it would pass without a syntax error.
G90 G0 B#100
For those that are well versed in this kind of math (unlike myself), what are your thoughts?
13.) How do I Round Decimal Values to Whole Numbers
It is often necessary to round fractional values to whole numbers (integers). For example, if you need to bring a rotary ta-
ble, which may be at any angle, to the nearest whole turn (whole multiple of 360°), then you would want to round its posi-
tion (converted to turns) to the nearest integer, then convert back to degrees and send the axis to that position.
Beginning with CNC12 version 4.14, you can use the functions “FIX” and “FUP” to round down or up to the next integer
value. Note that for negative values, FIX still rounds down (thus away from zero) and FUP still rounds up (towards zero).
With CNC12 v4.14 or newer, then, you can round to the nearest integer by first adding 0.5, then rounding down:
#100 = FIX[#5044/360.0 + 0.5] * 360.0
G90 G0 B#100
It seems to work, but I wonder if there would be a compounding rounding error if done a number of times. It's not much, 0.003º or so for one shot.
Using MOD seems to work as well, but has the same tiny error.
#100 = [#5044 MOD 360] ; Not sure if this is right, but it was the only way it would pass without a syntax error.
G90 G0 B#100
For those that are well versed in this kind of math (unlike myself), what are your thoughts?
Scott
-
- Posts: 1967
- Joined: Thu Sep 23, 2021 3:49 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: 6433DB0446C1-08115074
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Germany
Re: Rotary Axis Questions
How many encoder counts or steps per degree are in your setup?
Uwe
Uwe
-
- Posts: 652
- Joined: Fri Nov 30, 2018 1:04 pm
- Acorn CNC Controller: Yes
- Plasma CNC Controller: No
- AcornSix CNC Controller: No
- Allin1DC CNC Controller: No
- Hickory CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Thorp WI
-
- Posts: 1967
- Joined: Thu Sep 23, 2021 3:49 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: 6433DB0446C1-08115074
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Germany
Re: Rotary Axis Questions
That would be 25919.792 turns for 360°
I avoid odd numbers for an rotary axis.
For eg 90:1 reduction 4000 Steps = 3600000 steps for 360° or 1000 Steps for 1°
This will avoid rounding errors.
Uwe
I avoid odd numbers for an rotary axis.
For eg 90:1 reduction 4000 Steps = 3600000 steps for 360° or 1000 Steps for 1°
This will avoid rounding errors.
Uwe
-
- Posts: 652
- Joined: Fri Nov 30, 2018 1:04 pm
- Acorn CNC Controller: Yes
- Plasma CNC Controller: No
- AcornSix CNC Controller: No
- Allin1DC CNC Controller: No
- Hickory CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Thorp WI
-
- Posts: 1967
- Joined: Thu Sep 23, 2021 3:49 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: 6433DB0446C1-08115074
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Germany
Re: Rotary Axis Questions
Reduction rates avoiding odd numbers are 4.5 / 9 / 45 / 90
I would change to one of these, and rounding error is gone.
Uwe
I would change to one of these, and rounding error is gone.
Uwe