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.
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?
The controlled arm:
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.