I have a rotating body $B$ and a rotating frame $F$ whose orientations are described by the quaternions $q_B$ and $q_F$ respectively. I also have the angular velocity vectors $\omega_B$ and $\omega_F$.

I'm then interested in the Euler angles (extrinsic x-y-z) of B relative to F. That is, I convert $q_F^* q_B$ to Euler angles $\phi, \theta, \psi$.

My question is how to calculate $\dot\phi, \dot\theta, \dot\psi$ from the angular velocities. I'm currently using

$$M(\phi,\theta) = \begin{pmatrix}1&\sin\phi\tan\theta&\cos\phi\tan\theta\\ 0&\cos\phi&-\sin\phi\\ 0&\sin\phi\sec\theta&\cos\phi\sec\theta\end{pmatrix}$$ $$\begin{pmatrix}\dot\phi\\\dot\theta\\\dot\psi\end{pmatrix}=M(\phi,\theta)\omega_B$$

But clearly this isn't correct when F is rotating.

  • $\begingroup$ if both B and F are in motion then the vectors of angular velocity are irt what? . I think you need to mention an 'above all' frame at rest irt qB,qF,wB,wF are defined. $\endgroup$ Jun 27, 2015 at 10:44
  • $\begingroup$ What is your coordinate basis? About which axis (in that basis) are each rotating? If this is rigid body rotation and the coordinate basis is orthonormal, do you need to go to quaternions? I know those prevent "gimbal lock," but in most cases you need not use them because you can get away with simple Euler rotations. By the way, if you transform into the F-frame, F', then $\omega_{F}'$ = 0 and you can define your rotations there. Then go back to the rotating frame, F. $\endgroup$ Jun 27, 2015 at 13:37
  • $\begingroup$ @HelderVelez, the orientations are described relative to a universal "earth" frame. The angular velocities $\omega_B, \omega_F$ are measured in frames $B$ and $F$ respectively, i.e assume they are measured by two gyros, one rotating with B and one with F. $\endgroup$
    – Itay Perl
    Jun 27, 2015 at 19:07
  • $\begingroup$ @honeste_vivere, quaternions are just easier to work with sometimes (e.g. multiplying quaternions to combine orientations). The axes of rotation of B and F are arbitrary and not constant. $\endgroup$
    – Itay Perl
    Jun 27, 2015 at 19:07
  • $\begingroup$ IMO the Earth is not a good referential irt this experiment. I remember the Foucault pendulum. Lets imagine a background at rest. $\endgroup$ Jun 28, 2015 at 0:15

1 Answer 1


First Thought (probably not the fastest)
Let us assume you have a vector space in $R^{3}$ with a quaternion defined as:

$$ \mathbf{q} = q_{F}^{*} \ q_{B} \\ = a + b \hat{\mathbf{x}} + c \hat{\mathbf{y}} + d \hat{\mathbf{z}} $$

where $(a, b, c, d)$ are the Euler parameters and $(\hat{\mathbf{x}}, \hat{\mathbf{y}}, \hat{\mathbf{z}})$ defines the reference unit basis set.

If we define the axis of rotation as $\mathbf{n}$ and the angle through which we rotate as $\zeta$, then the Euler parameters are defined as:

$$ a = \cos{\left( \frac{\zeta}{2} \right)} \\ b = n_{x} \ \sin{\left( \frac{\zeta}{2} \right)} \\ c = n_{y} \ \sin{\left( \frac{\zeta}{2} \right)} \\ d = n_{z} \ \sin{\left( \frac{\zeta}{2} \right)} \\ $$

Thus, if you know $\mathbf{q}$, or rather $(a, b, c, d)$, you can find $\mathbf{n}$ and $\zeta$. Once you know the axis of rotation and the angle of rotation, you can determine the Euler angles. First we define the cross product matrix as:

$$ \left[ \mathbf{n} \right]_{x} = \left[ \begin{array}{ c c c } 0 & - n_{z} & n_{y} \\ n_{z} & 0 & - n_{x} \\ - n_{y} & n_{x} & 0 \end{array} \right] $$

and the outer product of $\mathbf{n}$ with itself given by:

$$ \left[ \mathbf{n} \otimes \mathbf{n} \right] = \left[ \begin{array}{ c c c } n_{x} \ n_{x} & n_{x} \ n_{y} & n_{x} \ n_{z} \\ n_{y} \ n_{x} & n_{y} \ n_{y} & n_{y} \ n_{z} \\ n_{z} \ n_{x} & n_{z} \ n_{y} & n_{z} \ n_{z} \end{array} \right] $$

Then we can define the rotation matrix as:

$$ \overleftrightarrow{\mathbf{R}} = \cos{\zeta} \ \overleftrightarrow{\mathbf{I}} + \sin{\zeta} \ \left[ \mathbf{n} \right]_{x} + \left( 1 - \cos{\zeta} \right) \ \left[ \mathbf{n} \otimes \mathbf{n} \right] $$

where $\overleftrightarrow{\mathbf{I}}$ is the unit or identity matrix.

Second Thought (probably faster/easier)
An easier method is to follow the procedure given here. Following that procedure, we define:

$$ \alpha = \frac{ 2 \left( a \ b + c \ d \right) }{ 1 - 2 \left( b^{2} + c^{2} \right) } \\ \beta = 2 \left( a \ c - d \ b \right) \\ \gamma = \frac{ 2 \left( a \ d + b \ c \right) }{ 1 - 2 \left( c^{2} + d^{2} \right) } $$

which gives us the Euler angles:

$$ \phi = \tan^{-1}{ \alpha } \\ \theta = \sin^{-1}{ \beta } \\ \psi = \tan^{-1}{ \gamma } $$

Since you already have $\mathbf{q}$ and you can numerically/analytically determine $(\phi, \theta, \psi)$, then I would just take the time derivative of each of these angles to find $(\dot{\phi}, \dot{\theta}, \dot{\psi})$ rather than using the angular velocities.

  • $\begingroup$ Yeah, I'm already using something similar to the second method to extract Euler angles. I know that technically I can numerically calculate their time derivatives, but since my attitude estimation algorithm is somewhat filtered, I hoped that a calculation directly from the angular velocities will be more reliable with low delay. $\endgroup$
    – Itay Perl
    Jul 1, 2015 at 13:12
  • $\begingroup$ If you are dealing with spacecraft and you need not worry about any "dramatic" maneuvers (e.g., orbital insertion at a moon or something), then you can just use a cubic spline and increase the time resolution without worrying about artifacts too much. Just make sure not to extrapolate the end points, then recalculate your velocities. Otherwise you will need to take the derivative of inverse functions, which can cause problems numerically. $\endgroup$ Jul 1, 2015 at 13:34
  • $\begingroup$ Note that you should take the total time derivative of things like $\tan{\phi}$ to avoid this issue. $\endgroup$ Jul 1, 2015 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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