[Math] Convert from unit vector to rotation angles

roboticsrotations

In CAD model, the orientation can be represented by a unit vector $(i,j,k)$ where $i^2+j^2+k^2=1$.

In robot arm, the orientation can be represented by rotation angles $(rx,ry,rz)$ where each variable ranges from $-180^\circ \to 180^\circ$.

The axis directions have been aligned with respect to the world frame: $i$ is parallel to $x$, $j$ to $y$, $k$ to $z$. When $(i,j,k) = (0,0,1)$ then $(rx,ry,rz) = (0,0,0)$ which is pointing upwards (along $z$).

Suppose we rotate around y-axis for 90 degrees, i.e. $(rx,ry,rz) = (0,90,0)$, then $(i,j,k)$ becomes $(1,0,0)$ which is pointing along $x$.

The question is, in general, how to convert $(i,j,k)$ to $(rx,ry,rz)$, and vice versa?

Best Answer

you need to know 'rotation matrix' and 'roll, pitch, yaw'.

then you can understand below things.

source : http://www.songho.ca/opengl/gl_anglestoaxes.html

So

i = -sin(ry)

j = cos(ry)sin(rx)

k = cos(ry)cos(rx)

its all.

simple :)

and vice versa,

ry = - acsin(i)

rx = acsin(j/cos(ry))

rz = X