# Kinematics... again:/

19 May 2017 14:22 #93385 by andypugh
andypugh replied the topic: Kinematics... again:/

Boogie wrote: Guys am I reading robokins description in the right way?

To be honest, I wouldn't take the descriptions in robokins too literally. It was modified by Visteurs from Scarakins, and it is possible that he only modified the equations for his own one-off machine, and didn't change the description.

You will need to look at the mathematics to see if that matches your machine, and then alter it if it doesn't.
The following user(s) said Thank You: Boogie
19 May 2017 15:01 #93386 by Boogie
Boogie replied the topic: Kinematics... again:/
Andy this is sooo game changing information:/ ok, so back to study of robokins.c...
22 May 2017 13:03 #93474 by k-1
k-1 replied the topic: Kinematics... again:/
Parallelogram: not so hard to do .... but on scara robot i think is under patent (for sure in certain country...non in all world).

About robokins: i read only the attachment on andy 1th or 2th post, so I understand the kins was write by Andy. And Not understand that you would reply somethins of similar and not reply the same.

Any how In your case tool tip have a Dy on Y axis from J3 centerline and a Dx on X axis, but working on Z axis. So some calculation on kins you need for. If you use J4 or not, because tooltip have Dy and Dx. It seems to put D3 = 0 (so not Dx) and so all J1 and J2 and j3 work on same 2d plane. At these point you need a Dy only or in real world tool tips leght & Dy. As I see (reading now 2th time robokins) inverse and foward kins have no calc for these.... because it's simply scarakins modified for J0/x linear axis as I see.

So your study is concerned only z/y axis because D3=0. A triangle + rotation because J3 can rotate.

I'm not good at all, but I suggest you this:
Do we make a race to the one who solves it before?

regards
giorgio
23 May 2017 16:27 #93552 by Boogie
Boogie replied the topic: Kinematics... again:/
Giorgio The Kinematics Chellenge is great idea! Possibly is will lead us to the working kinematics module, and working examples of HAL and INI files.

However i'm not sure i understand your explainations on post #93474.
Let's assume the following kinematic model:

I believe many people will find it useful.
Assumptions:

Joint 0 - linear axis along X Cartesian axis
Joint 1 - angular axis. Rotation around axis parallel to X Cartesian axis
Joint 2 - angular axis. Rotation around axis parallel to X Cartesian axis and parallel to previous Joint 1.
Joint 3 - angular axis. Rotation around axis parallel to X Cartesian axis and parallel to previous Joint 2.
Joint 4 - angular axis. Rotation around axis perpendicular to previous axis.
Rotation axes of Joint 3 and Joint 4 intersect with each other and are perpendicular to each other.

D1 - arm lenght. The distance between Joint 1 and Joint 2 rotational axes.
D2 - elbow lenght. The distance between Joint 2 and Joint 3 rotational axes.
Offset 1 - the distance between Joint 3 rotational axis and spindle (tool) axis. Measured along Joint 4 rotational axis.
Offset 2 - the distance between Joint 4 rotational axis and spindle tool tip. Offset 2 vector is perpendicular to Offset 1 vector. Offset 2 have to take into account Tool Lenght Compensation from Tool Lenght Table (?).

Joints 0 thru 3 are used to move tool in Castesian X, Y, Z world. Joints 3 and 4 can be used to change tool angle U (around X axis) and V (around Y axis).

Are above assumptions correct?

Andy is it what your kinematics do?

I do not understand why there is no Offset 1 distance taken into account in robokins?
##### Attachments:
23 May 2017 17:44 #93555 by andypugh
andypugh replied the topic: Kinematics... again:/

linuxcnc.org/docs/2.7/html/motion/kinematics.html

You can ignore joint 1.

x2 = d1.sin(a1)
z2 = d1.cos(a1)
x3 = x2 + d2.sin(a1 + a2)
z3 = x2 + d2.cos(a1 + a2)
...
And so on.
The following user(s) said Thank You: Boogie
23 May 2017 19:57 #93565 by Boogie
Boogie replied the topic: Kinematics... again:/
I've seen it.
i can't find the answer why there is a difference between writing translation for x axis and a axis:

pos->tran.x = joints[0];
pos->a = joints[3];

pos->x = joints[0];
pos->a = joints[3];

or

pos->tran.x = joints[0];
pos->tran.a = joints[3];

In all languages every sign, dash, slash has its own meaning...
how to read it? pos->tran.x? Does 'pos' mean position from g-code interpreter? Does '->' mean 'move' or what? Got my point? What kind of programming language is it? Without basic knowledge and understanding of language syntax it is so hard to write anything.
23 May 2017 21:36 #93571 by Boogie
Boogie replied the topic: Kinematics... again:/
What i did today:
- compiled robokins - no errors so should be ok. New file was created in modules: robokins.ko

- picked scara sample config from sim-axis-vismach-scara and modified main HAL, INI files as well as scara_postgui.hal (added one more joint) and scara.xml file (added one more 'clock' for joint[4] and changed dimensions and ranges.

- tried to run it... and LinuxCNC Error window appeared instead of AXIS UI:(
What is worse - i can't copy error log to gedit and put it here for you to try do debug it. How to do it? Is it something with super user privilages?

Modified files are attached.

#### File Attachment:

File Name: scara.ini
File Size:9 KB

#### File Attachment:

File Name: scara.xml
File Size:1 KB

#### File Attachment:

File Name: scara_postgui.hal
File Size:0 KB

#### File Attachment:

File Name: scara_sim_4.hal
File Size:2 KB

Did i define D1, D2 and D3 parameters correctly in scara_sim_4.hal file?

The first error under 'Debug file information' header in LinuxCNC Error raport is:

'Error: could not insert module /usr/realtime-3.4-9-rtai-686-pae/modules/rtai_hal.ko: File exists
4942'

'Error: Module scarakins is not currently loaded'

This is strange as is commented out loadrt scarakins in hal file and put loadrt robokins...
Any ideas?
##### Attachments:
23 May 2017 22:02 #93573 by andypugh
andypugh replied the topic: Kinematics... again:/

Boogie wrote: I've seen it.
i can't find the answer why there is a difference between writing translation for x axis and a axis:

pos->tran.x = joints[0];
pos->a = joints[3];

The XYZ and UVW linear axis triads are part of a structure that is useful for some manipulations (like hypotenuse length).

Just accept that this is how it is.

In all languages every sign, dash, slash has its own meaning...
how to read it? pos->tran.x? Does 'pos' mean position from g-code interpreter? Does '->' mean 'move' or what? Got my point? What kind of programming language is it?

The programming language is C.

pos is a data structure that holds the current machine position.

It is passed to the kinematic module as a pointer, so instead of pos.a or pos.tran.x it uses pos->a and pos->tran.x
Just different ways to get to the various bits of data held in the "pos" structure.

But you don't need to know any of this to write a kins module. But you do have to follow C syntax.
The following user(s) said Thank You: Boogie
24 May 2017 12:11 #93590 by rodw
rodw replied the topic: Kinematics... again:/
In C, a data structure ( that contains a group of variables) means you have to refer to a variable like
mystruct.a and mystruct.b to get to the sub variables

But the real power in C is using pointers . This means that instead of using the actual variable you pass the address of the variable. When this is done, the syntax becomes mystruct->a

A much simpler illustration of pointer on a standard data type (no struct) is something like:
char ch='c';
char *p; // pointer to a character
p = &c; // p now points to the address of c
char z = *p;

to help decipher this code think like this
* = starred
Starred = stored
So z now holds what is stored at address &p
( the most useful concept I've ever encountered in C programming.)

So in effect z=c

If you can get your head around pointers in C the world is your oyster. Its so important.

So between now and then, just accept it as Andy has said.
The following user(s) said Thank You: Boogie
28 May 2017 08:17 #93742 by Boogie
Boogie replied the topic: Kinematics... again:/
Thank you for clarify things. I remember pointers and indirect addressing in assembler language i played with a bit back in 90's.

Guys: how to copy LinuxCNC Errors raport that pop out when linuxcnc crashes? I can highlight all the information but i'm not able to copy&paste it.

The error i got is:
"Error: could not insert module /usr/realtime-3.4-9-rtai-686-pae/modules/rtai_hal.ko: File exists"
Time to create page: 0.095 seconds