|
|
|||||||
This matrix maps coordinates from the initial frame A into the final frame B.
8 Quaternion formula for the passive
|
![]() | (16) |
![]() | (17) |
![]() | (18) |
For compactness in the multiplication below, write

and similarly for 𝜃 and ψ.
Then


and

Multiplying

gives
![]() | (19) |
with
![]() | (20) |
![]() | (21) |
![]() | (22) |
![]() | (23) |
The scalar component is the same as in the corresponding active quaternion. The three vector components have the opposite sign because the passive frame quaternion is the conjugate of the active rotor representing the same final orientation.
-
-
rotorLet

be the Hamilton quaternion that actively rotates a physical vector through the same geometric orientation while the coordinate frame remains fixed.
Then
![]() | (24) |
Thus if

then
![]() | (25) |
Similarly,
![]() | (26) |
This is why many published Euler to quaternion formulas have the same scalar term but the opposite three vector signs from the PhysicsLibrary formulas.
The preceding PhysicsLibrary article defines

Substituting equations (21) through (24) into the quaternion generated DCM must reproduce equation (16).
This provides an important implementation check because the Euler product, quaternion product, and matrix product are three independently useful ways of describing the same passive frame transformation:
![]() | (27) |
For the principal nonsingular branch, choose
![]() | (28) |
From equation (16),

Therefore
![]() | (29) |
When cos 𝜃≠0,

and

Thus
![]() | (30) |
Likewise,

and

so
![]() | (31) |
These formulas are often the clearest route from a quaternion to Euler angles: first generate the passive DCM using Q09, then extract the angles from the declared DCM sequence.
Using the passive quaternion generated DCM,




and

Therefore the principal 3-2-1 angles can be recovered from the PhysicsLibrary passive quaternion by
![]() | (32) |
![]() | (33) |
![]() | (34) |
These are the passive PhysicsLibrary versions of the familiar active yaw, pitch, roll extraction formulas.
Let

The passive quaternion formula reduces to


and

Therefore
![]() | (35) |
The matching DCM is
![]() | (36) |
This agrees with the positive 90∘ passive z frame rotation used as a convention diagnostic in Q07 through Q09.
Let

Then
![]() | (37) |
The DCM becomes
![]() | (38) |
For 𝜃 = 90∘,

Let

Then
![]() | (39) |
The DCM becomes
![]() | (40) |
For ϕ = 90∘,

Take

The passive quaternion is obtained from equations (21) through (24). Numerically,



Substitution gives approximately
![]() | (41) |
Converting this quaternion to a DCM and then applying equations (30) through (32) recovers the original roll, pitch, and yaw values to numerical roundoff.
This round trip is an important software verification case because all three angles are nonzero.
Euler angles are local coordinates on the orientation manifold rather than a global one to one orientation representation.
For the intrinsic 3-2-1 sequence, the singularity occurs when
![]() | (42) |
At these pitch angles,

The formulas

and

lose independent information because both numerator and denominator pairs collapse.
For

the matrix depends on the combination

For

it depends on the combination

Thus yaw and roll cannot be determined independently at the singular configuration.
The physical orientation remains perfectly well defined. Only the chosen Euler coordinate chart becomes singular.
Unit quaternions do not have this gimbal lock singularity.
Near

small attitude perturbations can produce large numerical changes in the individual yaw and roll angles.
For estimation, simulation, and control, it is therefore usually preferable to propagate and update attitude with quaternions or DCMs and convert to Euler angles primarily for display, operator interfaces, or applications in which the sequence is physically meaningful.
A robust software conversion should also clamp the argument of arcsin into the interval [−1, 1] when small floating point errors place it just outside that range.
Because

and

represent the same orientation, they must produce the same Euler angles on the same extraction branch.
Every expression in equations (33) through (35) is quadratic in quaternion components. Replacing all four components by their negatives leaves those expressions unchanged.
Therefore
![]() | (43) |
up to the ordinary nonuniqueness and branch choices of Euler Angle coordinates.
Even away from gimbal lock, Euler angle triples are not globally unique.
Angles are periodic. Adding 2π to an elementary rotation angle does not change the physical orientation.
There are also alternative triples associated with different branches of the inverse trigonometric functions.
For the principal 3-2-1 representation, PhysicsLibrary normally chooses
![]() | (44) |
![]() | (45) |
![]() | (46) |
with an explicit singularity policy at 𝜃 = ±π∕2.
When converting between quaternions and Euler angles in software:
The current house convention uses passive frame quaternions. A positive elementary frame rotation has a negative quaternion vector part.
PhysicsLibrary uses

The matching matrix is

An intrinsic 3-2-1 sequence is equivalent to an extrinsic 1-2-3 description with reversed angle order, not to the same verbal sequence about fixed axes.
The PhysicsLibrary passive formulas have different signs in the terms that are linear in qw.
Scalar first versus scalar last storage does not determine Euler sequence, frame direction, or active versus passive interpretation.
At

yaw and roll are not independently recoverable.
Different triples can represent the same physical orientation.
and
as different attitudes.
They produce the same DCM and the same Euler orientation.
The preceding article, quaternions and direction cosine matrices, establishes

and gives the passive quaternion generated matrix.
The present article combines that DCM relation with an intrinsic moving axis 3-2-1 sequence to derive yaw, pitch, roll conversion in both directions.
The separate examples entry, Quaternions and Euler Angles: Examples, Exercises, and Solutions, should use the same passive formulas developed here.
The next main article, quaternion kinematics and angular velocity, derives the differential equations that propagate the passive frame quaternion from body or reference resolved angular velocity.
Euler angle conversion formulas are particularly sensitive to frame direction, sequence order, intrinsic versus extrinsic language, and active versus passive interpretation. A formula should therefore be accompanied by its defining matrix or quaternion product.
Henderson provides an important aerospace reference for Euler angle, quaternion, and transformation matrix relationships. Moore provides an openly licensed modern treatment of reference frame orientation. Sommer and coauthors provide a useful convention analysis for Hamilton versus flipped quaternion multiplication and passive frame transformations.
[1] D. M. Henderson, Euler Angles, Quaternions, and Transformation Matrices: Working Relationships, JSC-12960, NASA Johnson Space Center, Mission Planning and Analysis Division, 1977. Engineering reference. NASA Technical Reports Server search
[2] J. K. Moore, Learn Multibody Dynamics, chapter “Orientation of Reference Frames.” Distributed under CC BY 4.0. Learn Multibody Dynamics
[3] H. Sommer, I. Gilitschenski, M. Bloesch, S. Weiss, R. Siegwart, and J. Nieto, “Why and How to Avoid the Flipped Quaternion Multiplication,” Aerospace, vol. 5, no. 3, article 72, 2018. Published under CC BY 4.0. Publisher article
[4] W. R. Hamilton, Elements of Quaternions, 2nd ed., edited by C. J. Joly, Longmans, Green, and Co., 1899. Public domain historical source. Internet Archive scan
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative Commons Attribution ShareAlike 4.0 International license.
| Keywords: | quaternion, Euler angles, yaw pitch roll, 321 sequence, Tait-Bryan angles, gimbal lock, attitude parameterization |
|
| Physics Classification: | 02.40.Yy (Geometric mechanics ) |
| 02.10.Hh (Rings and algebras) | |
| 45.40.-f (Dynamics and kinematics of rigid bodies) |
None.
No messages.