CSS/G96 for other than X-axis?

More
28 Mar 2026 18:41 - 28 Mar 2026 18:45 #344888 by spumco
CSS/G96 for other than X-axis? was created by spumco
I have a part-off slide mounted to my lathe spindle 90 degrees to X-axis.  It's defined as "V" axis as that seemd to match the basic cartesian configuration best; it's not a Y axis as all the tools mounted on X can't move in Y.

I'm working on a custom M-code to run the part-off process.  I'd like to accomplish the following:
  • Program part-off in diameter, just like programming an X-mounted tool in diameter mode
    • In progress, I think I just have to cut the joint movement scale in half, and fiddle with the homing so "V0" is tool tip at center of rotation
  • Program feed per rev (G95)
    • Seems pretty straight-forward
  • Use CSS (G96)
    • How?
Question... can CSS be used on any axis other than X?  i.e. is G96 hard-coded to X?

If I re-define the parting slide a "U" axis instead of "V", will that work since "U" is considered as co-linear with X?

If CSS is hard-coded to X, any ideas how I can accomplish CSS on a non-X axis?

I don't need/want to move the X-axis while the parting slide is moving since the subspindle is mounted to X-axis slide and will (hopefully) be clamped on to the part.  But swapping the X and V (or U) joint/axis before a part-off and then switching back seems... complicated.  And likely to cause lots of following error issues.

I'm all ears if anyone's got suggestions.

 
Attachments:
Last edit: 28 Mar 2026 18:45 by spumco. Reason: forum editor misery

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

More
29 Mar 2026 09:02 #344900 by Aciera
Replied by Aciera on topic CSS/G96 for other than X-axis?
Not sure but looking at this makes me think that CSS is indeed hard coded to the X-Axis:
github.com/LinuxCNC/linuxcnc/blob/4025bf...ontrol.c#L1918-L1922

So the only thing I can think of is to use a switchable custom kinematic that swaps the joints used for the V axis and the X axis.
The following user(s) said Thank You: spumco

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

More
29 Mar 2026 13:56 #344907 by spumco
Replied by spumco on topic CSS/G96 for other than X-axis?
I guess Y-axis turning/parting wasn't really a thing in the early days of LCNC.

Pausing and axis (disconnect feedback) works fine, especially since the X-axis won't move during the swap.  Your C-axis encoder disconnect component is a perfect example of this.

But I don't see how to 'write' a new/different position for an axis after it's homed.  Unless there's some sort of math going on backstage that takes the current V-axis position and adds/subtracts/whatever from the X-axis.  Switching the stepgen is, as you've shown, pretty straight-forward.

My particular config may be slightly easier to dea with, at least for testing since the X-axis machine zero corresponds with the subspindle in-line with the main spindle.  G53 X0 is where the X-axis will need to stay during the axis swap.

Any idea what a switchable kinematics axis swap thing looks like?

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

More
29 Mar 2026 14:53 #344911 by Aciera
Replied by Aciera on topic CSS/G96 for other than X-axis?
for a simple example of how to use switchable kinematics see:
configs/sim/axis/vismach/millturn

which uses this custom kinematics component:
github.com/LinuxCNC/linuxcnc/blob/master...onents/millturn.comp

for your use case it would look even simpler.

Forward mapping:
    // define forward kinematic models using case structure for
    // for switchable kinematics
    switch (switchkins_type) {
        case 0:
            pos->tran.x = j[0];
            pos->tran.z = j[1];
            pos->v        = j[2];
            break;
        case 1:
            pos->tran.x = j[2];
            pos->tran.z = j[1];
            pos->v        = j[0];
            break;
    }
    // unused coordinates:
    pos->a = 0;
    pos->b = 0;
    pos->c = 0;
    pos->u = 0;
    pos->w = 0;

and the inverse:
    switch (switchkins_type) {
        case 0:
            j[0] = pos->tran.x;
            j[1] = pos->tran.z;
            j[2] = pos->v;
            break;
        case 1:
            j[2] = pos->tran.x;
            j[1] = pos->tran.z;
            j[0] = pos->v;
            break;
    }

Limit and acc/vel values can be switched as well (this is also shown in the millturn sim)
The following user(s) said Thank You: spumco

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

More
29 Mar 2026 15:10 #344914 by Aciera
Replied by Aciera on topic CSS/G96 for other than X-axis?
one advantage of using switchable kinematics is that all joints can be homed normally on startup.

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

More
29 Mar 2026 19:12 #344924 by spumco
Replied by spumco on topic CSS/G96 for other than X-axis?
That's fantastic.

I've no idea what that pos->trans stuff means or does, but if you think it's the right plan I'm hopeful.

I've obviously got some reading to do.

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

More
30 Mar 2026 12:45 #344948 by spumco
Replied by spumco on topic CSS/G96 for other than X-axis?

one advantage of using switchable kinematics is that all joints can be homed normally on startup.


Trying to digest all this and a couple questions occurred to me...

Is this the part of the component/programming that changes the position of the joints?:
  • CASE 1
    • pos->tran.x = j[0];
    • pos->v = j[2];
  • Case 2
    • pos->tran.x = j[2];
    • pos->v = j[0];
More specifically, when the kinematics switch is made is the above what causes the X and V axes DRO's to switch?

Why does X has a 'tran' and V doesn't?  I saw that stuff in userkins.comp, but I can't find an explanation of the programming language/syntax.

 

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

More
30 Mar 2026 14:52 - 30 Mar 2026 14:58 #344953 by Aciera
Replied by Aciera on topic CSS/G96 for other than X-axis?

Why does X has a 'tran' and V doesn't?


I cannot give you a totally clear answer but that is basically just the way the data structure is setup:

pos->tran.x, pos->tran.y and pos->tran.z are the 'translational' parts of the cartesian axis pose (ie X,Y,Z axes)

The other axes elements are just called pos->a, pos->b, pos->c, pos->u, pos->v and pos->w



Is this the part of the component/programming that changes the position of the joints?:


The lines with 'pos->* = j[*]' are part of the 'Forward' kinematic model (ie the section you have on your last post). This is used to calculate the AXIS position after the respective joint has been homed. In your particular case the axis is set the same as the joint.

The lines with ' j[* = pos->*]' are part of the 'Inverse' kinematic model . This is used to calculate that particular JOINT position according to the requested AXIS position. In your particular case the joint is set the same as the axis.

Note that in your CASE 1 the joints/axes mapping is actually trivial just like 'trivkins' and the only thing you do in CASE 2 it to swap the joints/axes

So each 'CASE n' in the forward model needs to have a matching reciprocal 'CASE n' in the inverse model. In other words, if you run a joint position value through the forward kinematic and you run the resulting axis position value through the inverse model you should get the exact joint position value you started out with. If the models do not match upyou will get unstable results (eg runaway values).



More specifically, when the kinematics switch is made is the above what causes the X and V axes DRO's to switch?

The switch is made using a case structure in the forward and the inverse kinematic:
switch (switchkins_type) {
        case 0:
....
        case 1:
....
    }

Each case represents a kinematic model. In millturn.comp we have two but you can have as many as you like.
The 'switchkins_type' value is changed using an analog motion pin which is connected to a dedicated hal pin (see [HAL] section of the millturn sim config):
HALCMD = net :kinstype-select <= motion.analog-out-03 => motion.switchkins-type
Last edit: 30 Mar 2026 14:58 by Aciera.
The following user(s) said Thank You: spumco

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

More
30 Mar 2026 15:09 - 30 Mar 2026 15:10 #344954 by Aciera
Replied by Aciera on topic CSS/G96 for other than X-axis?
For a more comprehensive switchable kinematics example see:

sim/axis/vismach/5axis/table-dual-rotary

which uses:
github.com/LinuxCNC/linuxcnc/blob/master.../xyzab_tdr_kins.comp

You can download a detailed html documentation on how the kinematic component above was derived:
forum.linuxcnc.org/10-advanced-configura...mill?start=80#263694




For an example using four kinematic models see:
github.com/Sigma1912/LinuxCNC_Demo_Confi...egrex_200y_kins.comp
Last edit: 30 Mar 2026 15:10 by Aciera.

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

More
30 Mar 2026 15:43 #344956 by spumco
Replied by spumco on topic CSS/G96 for other than X-axis?
@Aciera - thank you.

right after I posted the question I found an explanation from Andy & RodW that (sort-of) cleared up my confusion:

forum.linuxcnc.org/24-hal-components/327...again?start=40#93573

That was an 'Ahh-ha!' moment:  I don't know anything about C (or any other programming language) so that stuff all looks like gibberish to me.

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

Time to create page: 0.139 seconds
Powered by Kunena Forum