CSS/G96 for other than X-axis?

More
7 months 2 days ago #344888 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.

 

Please Log in to join the conversation.

More
7 months 2 days ago #344900 by Aciera
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.

Please Log in to join the conversation.

More
7 months 1 day ago #344907 by spumco
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 to join the conversation.

More
7 months 1 day ago #344911 by Aciera
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:
Code:
// 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:
Code:
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)

Please Log in to join the conversation.

More
7 months 1 day ago #344914 by Aciera
one advantage of using switchable kinematics is that all joints can be homed normally on startup.

Please Log in to join the conversation.

More
7 months 1 day ago #344924 by spumco
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 to join the conversation.

More
7 months 23 hours ago #344948 by spumco

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 to join the conversation.

More
7 months 21 hours ago #344953 by Aciera

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:
Code:
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):
Code:
HALCMD = net :kinstype-select <= motion.analog-out-03 => motion.switchkins-type

Please Log in to join the conversation.

More
7 months 21 hours ago #344954 by Aciera
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

Please Log in to join the conversation.

More
7 months 20 hours ago #344956 by spumco
@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 to join the conversation.

Time to create page: 0.281 seconds
Powered by Kunena Forum