|
Euler angles and quaternions are two of the most common ways to describe three-dimensional orientation. Euler angles are intuitive because they express an orientation as a sequence of familiar one-axis rotations such as yaw, pitch, and roll. Quaternions are more compact for computation and avoid the singularities that arise in Euler angle coordinates. This entry shows how the standard 3-2-1 yaw-pitch-roll sequence is related to a unit quaternion and how one converts in both directions.
This article uses the PhysicsLibrary house convention:
- right-handed orthonormal frames;
- Hamilton multiplication, so
;
- scalar-first display notation,
 |
(1) |
- active vector rotation,
 |
(2) |
The specific Euler angle convention treated here is the
3-2-1 yaw-pitch-roll sequence. In matrix form we define
 |
(3) |
where
The same orientation may be described either as successive active rotations or, in an equivalent geometric language, as a moving axis sequence. The safest practice is always to declare the explicit matrix or quaternion product.
There are two broad families of Euler angle sequences.
- Proper Euler angle sequences reuse one axis, for example 3-1-3.
- Tait-Bryan sequences use three distinct axes, for example 3-2-1.
The yaw-pitch-roll convention of engineering and aerospace work is a Tait-Bryan sequence.
A rotation of angle about the positive axis is represented by
 |
(5) |
Similarly,
 |
(6) |
Therefore the unit quaternion corresponding to the 3-2-1 sequence is
 |
(7) |
This product order matches the active composition rule of Q08: the roll acts first, then the pitch, and then the yaw in the written matrix product
.
Figure illustrates the stepwise 3-2-1 sequence. The yaw, pitch, and roll arcs are shown in different colors to distinguish the three elementary rotations.
Figure: The 3-2-1 yaw-pitch-roll sequence. Step 1 rotates about the reference axis by the yaw angle . Step 2 rotates about the intermediate axis by the pitch angle . Step 3 rotates about the intermediate axis by the roll angle . For the active convention used here, the net matrix and quaternion are
and
.
|
|
Introduce the half-angle abbreviations
 |
(8) |
 |
(9) |
 |
(10) |
Then
 |
(11) |
Multiplying the three factors gives
 |
(12) |
with components
 |
(13) |
 |
(14) |
 |
(15) |
 |
(16) |
These are among the most frequently used formulas in navigation, flight-dynamics, robotics, and graphics software.
The same sequence has matrix form
 |
(17) |
Equating this matrix with the quaternion-generated matrix of Q09 provides a useful cross-check of the component formulas in equations (13) through (16).
Starting from either equation (17) or the component formulas of Q09, one may recover the 3-2-1 angles by
 |
(18) |
 |
(19) |
 |
(20) |
These formulas assume the same 3-2-1 convention and the same active/Hamilton sign conventions used above.
Euler angles are local coordinates on the orientation manifold, not a global one-to-one description. In the 3-2-1 sequence the singularity occurs when
 |
(21) |
At this pitch angle the yaw and roll axes align, and the decomposition loses one degree of freedom. In engineering language this is called gimbal lock. Quaternions do not suffer from this coordinate singularity, which is one of the main reasons they are preferred for simulation, estimation, and control.
Consider pure yaw with
 |
(22) |
Then equations (13) through (16) reduce to
 |
(23) |
with . Therefore
 |
(24) |
which is exactly the quarter-turn about the axis discussed previously.
The most common mistakes are:
- mixing a scalar-first quaternion formula with scalar-last stored data;
- using formulas from a source that assumes a different sequence, such as 1-2-3 instead of 3-2-1;
- confusing active and passive interpretations;
- forgetting that intrinsic and extrinsic descriptions may refer to the same final orientation but use different verbal descriptions;
- treating Euler angle formulas as globally valid even at or near the singularity
.
The next entry develops quaternion kinematics and the differential equation that propagates attitude from angular velocity.
The formulas in this entry are standard in navigation and rigid-body dynamics. The main conceptual difficulty is usually not the algebra but the coexistence of multiple sign, order, and sequence conventions. That is why PhysicsLibrary states the convention explicitly before giving any conversion formulas.
This article is an original synthesis prepared for PhysicsLibrary and intended for release under CC BY-SA 4.0.
|