# Kinematics for XYZAB mill

30 Nov 2022 21:51 #258161 by rodw
Replied by rodw on topic Kinematics for XYZAB mill
So still working through the XYZAC example, when we get to equation 11, thrry say divide the first row by the second is that as simple as:
KZ/KY = (SC . SA)/(CC . SA) ?
If so that becomes
KX/KY = SC/CC
KX/KY = Cotan(C) = 1/Tan(C)
Tan(C) = KY/KX

I get a bit lost from there
but:
C = Arctan(KY/KX) but to keep computers happy, I think that becomes
C = atan2(KY,KX) which is the wrong order to the solution and missing the -1 indice

I just need to understand this to move forward

Also, I'm pretty sure both the A and B axis need the negatives in their respective matrices. Is that right?

01 Dec 2022 05:48 #258191 by rodw
Replied by rodw on topic Kinematics for XYZAB mill
Ok moving right along, I realised  equations 10 & 11 are not required as we are building a machine, not a CAM system.
I'm ok with equations 12, 13 and 14.
So onto the Inverse transformation:
which brings me to  Equations 15 & 16
I don't understand wher the Matrix R is coming from
I can kinda see that some of it is coming from the inversion of 13, but I don't understand the right column

So any pointers would be appreciated.

01 Dec 2022 07:23 - 01 Dec 2022 07:25 #258192 by Aciera
Replied by Aciera on topic Kinematics for XYZAB mill
Matrix 'R' is the rotation part of our transformation matrix 'A'. For a rotation in 3 dimensions a 3x3 matrix 'R' is required our transformation matrices are 4x4 because they also contain a column for the translation vector 'q'.

Have a look at the linked site in edit2 of my post:
Last edit: 01 Dec 2022 07:25 by Aciera.
The following user(s) said Thank You: rodw

01 Dec 2022 13:43 #258209 by ChapEng
Replied by ChapEng on topic Kinematics for XYZAB mill
Hello everyone, Rod has helped me out in the past with some things so I thought I would take a crack at this.

I think I have done the matrix work (it has been a while and I had to blow the cobwebs out, but I got there) but I am not confident with my breakdown of the tool position vector into the matrix and vector. I have done it, but I would really appreciate if someone else could cross check it for me.

Attached is a PDF with my workflow, following the same workflow as described here  linuxcnc.org/docs/html/motion/5-axis-kinematics.html

If there is something wrong, please let me know, this is something I'm looking at doing myself in the near future.
##### Attachments:

01 Dec 2022 18:04 #258239 by Aciera
Replied by Aciera on topic Kinematics for XYZAB mill
Cool, thanks.
Here is my attempt, looks like we disagree regarding a few signs but I've run out of time.

##### Attachments:

01 Dec 2022 19:14 #258249 by rodw
Replied by rodw on topic Kinematics for XYZAB mill
Wow guys, Thanks so much! Its amazing to have two experts helping me out.
I'm not showing my results from last night just yet!
The matter of the signs is discussed in the PDF paper linked earlier at the top of page 5.
I thought that the B axis and the workpiece were on opposite faces of the work pieces so they were mirror images of each other which meant signs needed to be inverted in the matrix showing the rotation around B
It would be great to get agreement on that point as its cruicial to the model!
Aciera, it was great to see youe workings of the matrix multiplication as I spend a good hour or 2 learning how it should be done. The method I chose was slightly different and I went off the rails somewhere.

The only comment I would make is it would be great for completeness to add the forward kinematics formulas in the form used in (14)
These are not quoted in the example with offsets. This would provide a full worked example for anybody else who comes along.

Guys, this is amazing work from you both! I'm very grateful! Looks like its almost time to do some C code and build some STL's

02 Dec 2022 01:53 #258283 by ChapEng
Replied by ChapEng on topic Kinematics for XYZAB mill
Thanks for the feedback Aciera! First things first, you certainly win on the style points with the embedded pdf and actually using superscripts, numbering your equations etc

Secondly, I'm glad that we are largely in agreement with the structure of the solutions, just disagreeing on signs. It means that the old eng maths hasn't let me down too much.

Onto the disagreements in our solutions:
1) I 100% forgot to multiply my Rtq by (-1) during the inverse transformation. so that is missing from my solution.
2) We have the same solution until eqn(25) in your solution. Slightly different structure: you use Ca(Py-Dy) and I use -Ca(Dy-Py) but they are equivalent. From there we diverge onto the transformation to eqn(26). The only difference seems to be at row 2 col 3.

I'm trying to work through that at the moment, but I have to head out and be and adult for a while. I'll get back into it tonight.

02 Dec 2022 08:35 - 02 Dec 2022 08:42 #258303 by Aciera
Replied by Aciera on topic Kinematics for XYZAB mill
Thanks for the flowers on the style. I try to think like a designer: The solution might be wrong but at least it looks right.

Anyway I took a stab at reconciling our solutions and I may have found a little contradiction in your write up. Would be great if you could look that over and see what you think:

Rod, once we're sure that the math is correct and the kinematic works I can go over the document again. No problem.
##### Attachments:
Last edit: 02 Dec 2022 08:42 by Aciera.
The following user(s) said Thank You: rodw

02 Dec 2022 10:30 #258307 by rodw
Replied by rodw on topic Kinematics for XYZAB mill

Thanks for the flowers on the style. I try to think like a designer: The solution might be wrong but at least it looks right.

I must say I was impressed too! In fact, I watched a relevant video today

Rod, once we're sure that the math is correct and the kinematic works I can go over the document again. No problem.

Yeh, that will be great. Its awesome to have some cross checks! It confirms the power of open source!
Also great to see you guys are both on the same track.
I should have some STL's of a real machine in a few days. So I will turn my attention to the C code. There is existing switchable kinematics for XYZBC and XYZAC so I'd like to extend that for our XYZAB model in the core code.

The following user(s) said Thank You: tommylight

02 Dec 2022 12:40 - 02 Dec 2022 12:50 #258311 by dgarrett
Replied by dgarrett on topic Kinematics for XYZAB mill
> There is existing switchable kinematics for XYZBC and XYZAC

For custom kinematics, using a .comp file is a much simpler method:

2) build with halcompile
3) user-installable

For simple cases see src/hal/components/userkins.comp

For cases requiring switchable kinematics, see
src/hal/components/millturn.comp

Refs:
github.com/LinuxCNC/linuxcnc/blob/master...onents/userkins.comp
github.com/LinuxCNC/linuxcnc/blob/master...onents/millturn.comp

Man pages:
linuxcnc.org/docs/devel/html/man/man9/userkins.9.html
linuxcnc.org/docs/devel/html/man/man9/millturn.9.html

Example usage (switchable kinematics):
github.com/LinuxCNC/linuxcnc/tree/master...xis/vismach/millturn
Last edit: 02 Dec 2022 12:50 by dgarrett.
The following user(s) said Thank You: tommylight, bkt, rodw