Rotating between $3$D frames

Given two frames, is it possible to compute any rotation of the form

$$R = R_xR_yR_z$$

that would tranform the frame $A$ into the frame $B$? the rotation will be described by Euler angles as I need to quantify the rotation on each axis.

-
Yes, this might be relevant for you: math.stackexchange.com/questions/66649/… – Hauke Strasdat Dec 2 '11 at 10:31

Suppose we have the coordinates of a point in space with respect to a NED ("North, East, Down") coordinate system, and we want to find the coordinates of that point with respect to a "vehicle" coordinate system, and we know the vehicle's roll, pitch, and yaw.

This vehicle coordinate system has its positive x axis coming out the front of the vehicle, positive y axis coming out the right side of the vehicle, and positive z axis coming out the bottom of the vehicle. The vehicle's orientation is specified by its roll $R$, its pitch $P$, and its yaw $Y$. For simplicity we'll assume the origin of the vehicle coordinate system is located at the origin of the NED coordinate system. If the roll, pitch, and yaw were all $0$, then the vehicle coordinate frame would be perfectly aligned with the NED coordinate frame.

Conceptually, we will imagine that the vehicle frame at first is perfectly aligned with the NED frame, and that the vehicle first yaws by $Y$, then pitches by $P$, then rolls by $R$. We will compute the vehicle coordinates of our point after each of these three rotations.

To start with, the vehicle coordinates of our point are the same as the NED coordinates, let us say $[x,y,z]^T$.

To update the vehicle coordinates after the first rotation (the yaw) you should multiply by this matrix: $\begin{bmatrix} \cos(Y) & \sin(Y) & 0 \\ -\sin(Y) & \cos(Y) & 0 \\ 0 & 0 & 1 \end{bmatrix}$.

To update the vehicle coordinates after the next rotation (the pitch), you multiply by this matrix: $\begin{bmatrix} \cos(P) & 0 & -\sin(P) \\ 0 & 1 & 0 \\ \sin(P) & 0 & \cos(P) \end{bmatrix}$.

To update the vehicle coordinates after the third rotation (the roll), you multiply by this matrix: $\begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos(R) & \sin(R) \\ 0 & -\sin(R) & \cos(R) \end{bmatrix}$.

If you apply all three updates one after another, it's the same as multiplying by this matrix: $$\begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos(R) & \sin(R) \\ 0 & -\sin(R) & \cos(R) \end{bmatrix} \begin{bmatrix} \cos(P) & 0 & -\sin(P) \\ 0 & 1 & 0 \\ \sin(P) & 0 & \cos(P) \end{bmatrix} \begin{bmatrix} \cos(Y) & \sin(Y) & 0 \\ -\sin(Y) & \cos(Y) & 0 \\ 0 & 0 & 1 \end{bmatrix}$$ which is equal to $$\begin{bmatrix} \cos(P) \cos(Y) & \cos(P) \sin(Y) & -\sin(P) \\ \cos(Y) \sin(P) \sin(R) - \cos(R) \sin(Y) & \cos(R) \cos(Y) + \sin(P) \sin(R) \sin(Y) & \cos(P) \sin(R) \\ \cos(R) \cos(Y) \sin(P) + \sin(R) \sin(Y) & \cos(R) \sin(P) \sin(Y) - \cos(Y) \sin(R) & \cos(P) \cos(R) \end{bmatrix} .$$

This matrix multiplication is performed on Wolfram Alpha here. The answer agrees with equation (2.31) in Farrell and Barth.

-

yes, this is possible, although it might not be unique. Because the map of SO(3) formed by the Euler angles have singularities, e.g. at $\theta = \pi$. This is known as gimbal lock.

-
I don't care about it being unique, any solution will be good in my case. Do you have any hints on how to get started? Thanks. – ennetws Dec 2 '11 at 17:31
The ambiguity doesn't only occur at singularities. Every rotation can be represented by at least two different Euler angle-triples, because $(x,y,z)$ and $(x\pm\pi,\pi-y,z\pm\pi)$ result in the same rotation. – Christian Rau Jan 31 '12 at 17:39
No, $x \pm \pi$ etc.. is not in the domain of the respective angle. e.g. $\theta \in [0,\pi)$ ... the singularity is only at one boundary, depending on the definition. – Bort Feb 1 '12 at 12:17