Jump to content

Conversion between quaternions and Euler angles

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 130.188.8.13 (talk) at 16:02, 22 October 2008 (Conversion). 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".

Definition

A unit quaternion can be described as:

We can associate a quaternion to a rotation around an axis by the following expression

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

Rotation matrices

Euler angles - The xyz (fixed) system is shown in blue, the XYZ (rotated) system is shown in red. The line of nodes, labelled N, is shown in green.

The orthogonal matrix corresponding to a rotation by the unit quaternion q is given by[clarification needed]

The orthogonal matrix corresponding to a rotation with Euler angles , with x-y-z convention, is given by[clarification needed]

Conversion

By combing the quaternion representations of the Euler rotations we get

For Euler angles we get:

Relationship with Tait-Bryan angles

Similarly for Euler angles, we use the Tait-Bryan angles (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). Nevertheless, it is not easy to find a matrix expression with Tait-Bryan angles because its final expression depends on how the rotations are applied.

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. The common name for this situation is gimbal lock.

Code to handle the singularities is derived on this site: www.euclideanspace.com

See also