Conversion between quaternions and Euler angles

This is an old revision of this page, as edited by EdJohnston (talk | contribs) at 02:46, 18 September 2006 (The direction cosines are the *cosines*, not the angles themselves). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Spatial rotations in three dimensions can be parametrized using both Euler angles and unit quaternions. This article explains how to convert between the two representations. Actually this simple use of "quaternions" was first presented by Euler some seventy years earlier than Hamilton to solve the problem of magic squares. For this reason the dynamics community commonly refers to quaternions in this application as "Euler parameters".

A unit quaternion can be described as:

where α is a simple rotation angle and and cos(βx), cos(βy) and cos(βz) are the "direction cosines" locating the axis of rotation (Euler's Theorem).

File:Flight dynamics.jpg

Similarly for Euler angles, we use (in terms of flight dynamics):

  • Roll - : rotation about the X-axis
  • Pitch - : rotation about the Y-axis
  • Yaw - : rotation about the Z-axis

where the X-axis points forward, Y-axis to the right and Z-axis downward and in the example to follow the rotation occurs in the order yaw, pitch, roll (about body-fixed axes).

Rotation matrices

The orthogonal matrix corresponding to a rotation by the unit quaternion q is given by

 

The orthogonal matrix corresponding to a rotation with Euler angles  , is given by

 

Conversion

By comparing the terms in the two matrices, we get

 

For Euler angles we get:

 

Singularities

One must be aware of singularities in the Euler angle parametrization when the pitch approaches   (north/south pole). These cases must be handled specially.