TCP 5-axis kinematics

10 Nov 2016 12:41 #82650 by jsskangas

I have an old Mori Seiki MV jr retro fitted with linuxcnc, nikken 5-axis table and indramat servos.
5 axis and its kinematics has been on and off in my mind.

I would like to run linuxcnc in TCP (tool center point) mode, in linuxcnc this is I think called kinematic.
But I would like to run machine in two different modes while its running a program.

First mode would be independent axis X is X and so on, in this mode rotating rotary axis wont affect XYZ movement or position.
Second mode is TCP, in this mode tool center point and coordinate system rotates along with rotary axis.
Switching between these modes would be done with M128 and M129 commands.

This far I have got:
I can make and compile my own kinematic code.
M128 and M129 custom command controls hal pin from my kinematic module (True/false).

My idea was just to switch between two different setups in linuxcnc kinematics

pseudo code:

inverse kinematics {

hal pin TCP;

joint 0 = cos(B)*cos(C)*X-cos(B)*sin(C)*Y+sin(B)*Z+cos(B)*Vx+sin(B)*Vz
joint 1 = sin(C) * X + cos(C) * Y + Vy;
joint 2 = -sin(B) * cos(C) * X + sin(B) * sin(C) * Y + cos(B) * Z - sin(B) * Vx + cos(B) * Vz;
joint 4 = B;
joint 5 = C;
else {
joint 0 = X;
joint 1 = Y;
joint 2 = Z;
joint 4 = B;
joint 5 = C;


Same goes for forward kinematic.

I been testing this switching between different kinematics with sim--> axis --> maxkins simulation setup.
results are promising , but I would need help from those that has deeper understanding of how exactly Linuxcnc kinematics works
and how this switching should be done correctly.

So comments and help please.
10 Nov 2016 13:58 #82655 by jsskangas
Replied by jsskangas on topic TCP 5-axis kinematics
This 3+2 axis indexing work I usually run.

But need is for true 5-axis machining.
Normally I do this by roughing in 3+2 mode like in video then turn on TCP and run 5-axis finishing paths.
10 Nov 2016 14:17 #82658 by Todd Zuercher
Replied by Todd Zuercher on topic TCP 5-axis kinematics
Sorry I don't have any answers for you, but I am watching this with interest and one question.
You say "your results are promising, but..." What is the but? What specifically are the problems are you having?
10 Nov 2016 14:59 #82662 by jsskangas
Replied by jsskangas on topic TCP 5-axis kinematics
Yes, problem is transferring between these two modes, it gives axis following error .
Joints them self dont move, but axis coordinates jumps in different place.

This jump is normal in commercial control systems.
at least these system I have been running: Mazak, fanuc, Siemens 840D and iTNC530.

One solution could be that new coordinates would be some how introduced to upstream.
When new position is calculated from joint position, there is no risk of loosing actual position.
10 Nov 2016 15:56 #82664 by Todd Zuercher
Replied by Todd Zuercher on topic TCP 5-axis kinematics
For that I might have a really simple solution.
I am guessing that you are using the current stable branch of Linuxcnc 2.7 (or an earlier one).
If you switch to the development version Master (2.8pre), where Joints_Axis has been added, I think your following error problem might just disapear.
In that version the folloing errors are tied to the Joint number rather than the Axis letter.
10 Nov 2016 16:19 #82667 by jsskangas
Replied by jsskangas on topic TCP 5-axis kinematics
That's something worth of look at.

Other thing is how trajectory planner and other thing that are upstream from kinematic module likes to be displaced somewhere else instantly.

Now im running 2.7.7 on deb.
At the moment it works well when you make transition between different models f kinematics in 0 angles of rotary axes.
at this point there is no shift in XYZ coordinates, but this forces you to make this at 0 angles.
This has to be taken in account when making a operations and making a post processor.

It is something I can live with, but far from ideal situation.
10 Nov 2016 16:56 #82669 by Todd Zuercher
Replied by Todd Zuercher on topic TCP 5-axis kinematics
I really don't know. And I'm not sure anyone would know all the possible ramifications. Easier just to try it and see what happens.
20 Sep 2017 08:14 #99153 by jsskangas
Replied by jsskangas on topic TCP 5-axis kinematics
Finally I had time to test 2.8 and this really solves my problem.
I compiled my own kinematic module that can change between to different kinematic model.
other one is just straight forwad: Joint_0 <-- X-axis.... and so on.
Other mode has rotary compensation.

I made M128 and M129 commands to turn on/off this HAL pin.

It works great at the moment, as rotary axis are at zero position at transition moment.

Next I will write code to change position when mode is changed.
So that current position is always read from current joint positions.
This will not make movement in machine, tool will stay at it current location,
but coordinates will jump.
This is do the fact that we are changing coordinate system.

I will send some youtube video as this progress, now im testing this wit vismac simulation.
20 Sep 2017 20:01 #99174 by jsskangas
Replied by jsskangas on topic TCP 5-axis kinematics

One more thing , pos->tran.x: does these update current position in upsteam to linuxcnc?

My idea is to run machine in two different modes, normal mode where joint is directly coupled with axis.
joint_0 is X axis so on.

Other mode is TCP or RTCP this is Tool center point control or rotary tool center point control. both are same.
Linux cnc this is called kinematics, more precisely inverse kinematics.
I need to run two different kinematics model inside inverse kinematics of linuxcnc.
This works now.

But I want to use my machine certain way, roughing and 3+2 indexin work I dont want rotary axis compensations to work.
In 5 axis work, I want to preposition tool near workpiece before turning on TCP .

At this point I would like to read my current position from joints, and calculate my current tool position in rotated coordinate system.
This far I have managed to make this.
But then I would like to update this position to my current position.

Would it be just update these values to pos->tran.x pos->tran.y and pos->tran.z ?

What i hope it would do then is that tool wont jump.

Also this would be done other way round when TCP is turned off.

Someone who know about more could help???
23 Sep 2017 02:43 #99300 by Shu
Replied by Shu on topic TCP 5-axis kinematics
Sounds interesting. Can I take a look at your full machine config (hal, vismach, kins)?
I use different .ini files for different kinematics but haven't found a way to switch during runtime.
Time to create page: 0.102 seconds
Powered by Kunena Forum