wedesoft / arduino-sainsmart

Arduino software to control SainsSmart 6-axis palletizing robot arm
BSD 2-Clause "Simplified" License
72 stars 19 forks source link

Kinematics DH parameters #2

Closed VidyaPuri closed 4 years ago

VidyaPuri commented 6 years ago

Greetings, first of all awesome work with the robot!

So i was going through your code for kinematics and DH parameters and i can not figure out how did you position the coordinate systems for base. The d1(BASE=110mm) parameter is understandable, but for the r1(FOOT=40mm) it does not seem right. For my robot the distance between these two is somewhere between 2.5mm-3mm. It might be that there is size difference between the robots (SainSmart 6dof).

Also i am wondering how did you solve the issue regarding the shoulder and elbow servos and the pulley that connects the servo and the elbow joint. They are limiting each other and if one rotates the other has to move as well. I can't figure it out how to solve this. If you could just direct me in the right direction.

thank you very much, V

wedesoft commented 6 years ago

Hi, Sorry for the lack of documentation. I attached a sketch which hopefully answers your firdt question. Regarding the shoulder and elbow angle: I had to use some trigonometry to figure those out.

Regards Jan

Am 8. Juli 2018 16:38:30 GMT+01:00 schrieb VidyaPuri notifications@github.com:

Greetings, first of all awesome work with the robot!

So i was going through your code for kinematics and DH parameters and i can not figure out how did you position the coordinate systems for base. The d1(BASE=110mm) parameter is understandable, but for the r1(FOOT=40mm) it does not seem right. For my robot the distance between these two is somewhere between 2.5mm-3mm. It might be that there is size difference between the robots (SainSmart 6dof).

Also i am wondering how did you solve the issue regarding the shoulder and elbow servos and the pulley that connects the servo and the elbow joint. They are limiting each other and if one rotates the other has to move as well. I can't figure it out how to solve this. If you could just direct me in the right direction.

thank you very much, V

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/wedesoft/arduino-sainsmart/issues/2

-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

wedesoft commented 6 years ago

Hi, Here is the diagram.

Regards Jan

Am 8. Juli 2018 16:38:30 GMT+01:00 schrieb VidyaPuri notifications@github.com:

Greetings, first of all awesome work with the robot!

So i was going through your code for kinematics and DH parameters and i can not figure out how did you position the coordinate systems for base. The d1(BASE=110mm) parameter is understandable, but for the r1(FOOT=40mm) it does not seem right. For my robot the distance between these two is somewhere between 2.5mm-3mm. It might be that there is size difference between the robots (SainSmart 6dof).

Also i am wondering how did you solve the issue regarding the shoulder and elbow servos and the pulley that connects the servo and the elbow joint. They are limiting each other and if one rotates the other has to move as well. I can't figure it out how to solve this. If you could just direct me in the right direction.

thank you very much, V

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/wedesoft/arduino-sainsmart/issues/2

-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

VidyaPuri commented 6 years ago

Hi, where is it?

"Regarding the shoulder and elbow angle: I had to use some trigonometry to figure those out." in which part of the code did you solve it?

thank you, Vid

wedesoft commented 6 years ago

Sorry, the email attachment didn't work. Here is the diagram:

img_20180708_171726

wedesoft commented 6 years ago

Here is a link to the inverse kinematic source code (it is in kinematics.rb).

wedesoft commented 6 years ago

There are also tests for the inverse kinematics.

VidyaPuri commented 6 years ago

Thank you very much for the diagram! It clears some of my issues.

Now since i have no prior knowledge of Ruby, i am trying to descipher the inverse method of Kinematics class. What is the input of that inverse method (matrix) and what is it made of?

Thank you very much!

wedesoft commented 6 years ago

The input of the inverse kinematics method is a 4x4 homogeneous transformation matrix:

r11 r12 r13 t1
r21 r22 r23 t2
r31 r32 r33 t3
0    0    0    1

with the nine rji being a rotation matrix and the 3 tj values a translation vector.

wedesoft commented 6 years ago

Note that the standard Ruby Matrix and Vector class are extended in the matrix_ext.rb file.

wedesoft commented 6 years ago

The angle for the elbow servo is the elbow angle minus the shoulder angle (see kinematics.rb line 85).

VidyaPuri commented 6 years ago

Thank you for your answers! is there any specific book or paper that you used for calculating inverse kinematics? i was deriving it through your code and for the first three angles i get it right (and is the same way as it is in the book i am using) but for the RPY of the end effector i get lost.

thank you for your help! Best regards, V

wedesoft commented 6 years ago

Hi, I don't have a book for this. Basically I compute head_matrix to contain only the rotations of the gripper relative to the arm.

VidyaPuri commented 6 years ago

So i was trying to find out how you got to this part:

head_matrix = Matrix.rotate_y(shoulder_angle - elbow_angle) Matrix.rotate_z(-base_angle) matrix

and the closer i got to it was that Matrix.rotate_y (shoulder_angle-elbow_angle)=Matrix_rotate_y(shouler_angle)*Matrix_rotate_y(-elbow_angle) since in the literature it goes like this: image Which is constructed from three rotation matrices.

image image

and what is this adapter matrix, what does it mean?

adapter_matrix = Matrix[[0, -1, 0, 0], [0, 0, -1, 0], [1, 0, 0, 0], [0, 0, 0, 0]]

wedesoft commented 6 years ago

The adapter matrix is just a matrix to swap coordinate axes.

VidyaPuri commented 6 years ago

I see, so you rotated the coordinate axes for Rot(y,90) and Rot(z,-90) from J3 to J4.

wrist_matrix = Matrix.rotate_x(-pitch_angle) Matrix.rotate_z(-roll_angle) adapter_matrix * head_matrix

and what are these rotate_x and rotate_z rotations? Why these particular ones?

wedesoft commented 6 years ago

I have to admit that this part was a bit of trial and error. I used unit tests to ensure that the result is correct though. Matrix.rotate_x and Matrix.rotate_z are rotation matrices around the x and z axis. The idea is to determine a wrist_matrix which only contains the rotation of the wrist (i.e. separated from pitch and roll angle).