0
$\begingroup$

So I have the positions of all the joints (x,y,z) of a robot arm. I need to calculate the angles of the joints to feed them to another similar robot arm. I cannot get the angles from the robot I need to calculate them from the positions.

Let's say:

J1: (x1,y1,z1)-------------J2: (x2,y2,z2)----------------End: (x3,y3,z3)

x is the depth towards the screen, z is vertical axis and y is horizontal axis

let's say J1 rotates around y1 and x1, and J2 rotates around x2 and z2

My first instinct is, this is easy! I just need to calculate the angles between (x1,y1,z1) and (x2,y2,z2) to get the angles of J1, and between (x2,y2,z2) and (x3,y3,z3) to get the angles of J2.

For J1: I use atan (x1/z1) to get the angle around y1 and atan (z1/y1) for the angle around x1.

For J2: angle around x2 = atan (z2/y2). angle around z2 = atan (y2/x2).

Now I know I'm wrong, because this didn't work. Also because if this works, why would people use complex inverse kinematics solutions. The problem is, I have no idea why this is wrong. Can someone explain to me the mistakes in my method/understanding?

Thank you.

The refrence arm: enter image description here

The controlled arm:

enter image description here

I forgot to add joints labels from top to bottom (J1, J2, End) I'm controlling the arm by rotating around the y-axis and around the x-axis of J1 for J1-J2 and around the z-axis and around the x-axis of J2 for J2-End.

$\endgroup$
  • $\begingroup$ Drawing does not match the text. "Let's say J1 rotates around y1 and x1, and J2 rotates around x2 and z2" seems like J2 is rotating around y2 and x2 from the drawing and the later description "J2 and around the z-axis and around the x-axis of J2 for J2-End." $\endgroup$ – 50k4 Aug 20 at 9:42
  • $\begingroup$ also, the difference between the reference arm and controled arm is unclear $\endgroup$ – 50k4 Aug 20 at 9:43
  • $\begingroup$ @50k4 Ok, I think I'm not explaining this correctly, I'll rephrase the question to be more simple. Forgetting everything I said before. I have a 3D vector v1, from the origin to point (x1,y1,z1). Say I want to rotate another vector v2 from the same origin (the magnitude doesn't matter), to match the direction of v1. The initial direction of v2 is along the z axis and I want to rotate it around x and y to match v1. Is it correct do it using: rot_x = atan2(z,y) and rot_y = atan2(z,x) ? $\endgroup$ – da silva Aug 21 at 10:40
  • $\begingroup$ So..this is another question... Then please post is accordingly... $\endgroup$ – 50k4 Aug 22 at 8:43
0
$\begingroup$

People use complex inverse kinematics because they do not have the joint positions. In the case of an industrial robto, you know the you want the end effector at a certain position, and you calculate (or the robot's software) calculates what joint angles correspond for that position. (actually one of the ways of doing this is to calculate the xyz position of some joints and calculate angles from those coordinates)

Since you already have the joint positions...your task is somewhat easier.

If you have the joint positions, you are right, you can use these coordinates the identify the angles. However, you need to take care what coordinates you are using.

Your robot is at a root coordinate system (cs), usually different then the world cs. Angles are always expressed relatively between two local cs, and not in world cs. For example, two consecutive joints, which share a parallel axis of rotation are set top 90 degrees and -90 degrees. In worldCS the element after the second joint would have 0 degrees rotation, in the local CS it has -90 degrees. So you need to make sure that the coordinates you are using in your trigonometric equations are relative coordinates. Currently it seems that you are using world (absolute coordinates). I am not sure if the atan function is the right choice, if there is no drawing, I do not comment on trig. relations. So assuming that atan is the correct function to use, in relative coordinates, it would become:

rot_x2 = atan ((z2-z1)/(y2-y1))

also, I would advise to use atan2() instead of atan(). It handles all the finge cases atan does not. and please note that rot_x2 in this case will become the angle between J1 and J2.

$\endgroup$
  • $\begingroup$ Thanks a lot! at least now I know I'm somewhat in the right direction. My mistake must then be either in my trigonometry or my coordinate systems. Yes, I do use relative coordinates (i.e J1 is at 0,0,0, J2's position is relative to J1, and End is relative to J2, is that correct?). Also, I do use atan2() I already learned my lesson using atan(). "Angles are always expressed relatively between two local cs, and not in world cs. " I don't understand what exactly do you mean? Also, why do you think atan might not be the right choice? in which case wouldn't it be right? $\endgroup$ – da silva Aug 16 at 12:45
  • $\begingroup$ added a short example for the angles $\endgroup$ – 50k4 Aug 19 at 11:45
  • $\begingroup$ if you upload a drawing I can commment on the trigonometry. I cannot comment until then, you might have left handed CS or a right handed one, Z could be pointing upwards or y might be pointing upwards. You might have used DH, or modified DH or any other convention for your joints... there are just too many options... $\endgroup$ – 50k4 Aug 19 at 11:47
  • $\begingroup$ I added the drawings. $\endgroup$ – da silva Aug 20 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.