Conversion between quaternions and Euler angles
||It has been suggested that this article be merged into Charts on SO(3). (Discuss) Proposed since August 2011.|
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:
We can associate a quaternion with a rotation around an axis by the following expression
or equivalently, by the homogeneous expression:
If is not a unit quaternion then the homogeneous form is still a scalar multiple of a rotation matrix, while the inhomogeneous form is in general no longer an orthogonal matrix. This is why in numerical work the homogeneous form is to be preferred if distortion is to be avoided.
By combining the quaternion representations of the Euler rotations we get for the Body 3-2-1 sequence, where the airplane first does yaw (body-z) turn during taxiing on the runway, then pitches (body-y) during take-off, and finally rolls (body-x) in the air. The resulting orientation of Body 3-2-1 sequence is equivalent to that of Lab 1-2-3 sequence, where the airplane is rolled first (lab-X axis), and then nosed up around the horizontal lab-Y axis, and finally rotated around the vertical Lab-Z axis:
Other rotation sequences use different conventions.
Relationship with Tait–Bryan angles
- 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).
One must be aware of singularities in the Euler angle parametrization when the pitch approaches ±90° (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
- Rotation operator (vector space)
- Quaternions and spatial rotation
- Euler Angles
- Rotation matrix
- Rotation formalisms in three dimensions
- Q60. How do I convert Euler rotation angles to a quaternion? and related questions at The Matrix and Quaternions FAQ
- NASA Mission Planning and Analysis Division. "Euler Angles, Quaternions, and Transformation Matrices". NASA. Retrieved 12 January 2013.