Relative Attitude and Error Quaternions: Examples, Exercises, and Solutions
This entry is the self study companion to the PhysicsLibrary article relative attitude
and error quaternions. All exercises are stated first. Complete worked solutions follow
afterward.
Let the current or actual passive attitude be
and the desired passive attitude be
The two multiplicative error definitions used throughout are
They reconstruct the desired attitude as
or
For a passive positive small frame error vector δ𝜃,
so
1 Exercises
- identity error.
Suppose
Compute both δqL and δqR.
What physical attitude error do they represent?
- Opposite stored quaternion sign.
Suppose
Compute the raw left and right error quaternions.
Explain why the physical attitude error is still zero and state the principal error
quaternion that should normally be used locally.
- Same axis desired versus actual yaw.
The current attitude is a positive passive frame yaw of 10∘:
The desired attitude is a positive passive frame yaw of 25∘:
Compute δqL and δqR and recover the physical frame error axis and angle.
- Noncommuting left and right errors.
Let
and
These are positive passive 90∘ frame rotations about +x and +y, respectively.
Compute δqL and δqR.
Recover the principal physical frame error angle and axis for each.
- direction cosine matrix error check.
For the attitudes in Exercise 4, use
and
Compute
and
Verify that they equal C(δqL) and C(δqR).
- Principal quaternion sign.
An error computation returns
Choose the principal representative with nonnegative scalar part.
Then determine the physical passive frame error angle and axis.
- Exact passive axis angle extraction.
Consider
Verify that it is unit norm and recover the positive physical frame error axis and
angle.
- Small error vector from a quaternion.
A local passive error quaternion is approximated by
Recover the corresponding first order physical frame error vector in radians and
degrees.
- Transport a right small error to the left.
The current attitude is
so
A right small error vector is
Compute δ𝜃L and the first order left and right error quaternions.
- Left error estimation injection.
A nominal estimate is a positive passive yaw of 20∘:
A filter using a left multiplicative error estimates a positive 2∘ frame yaw correction.
Construct δqL and compute
Interpret the corrected attitude.
- Right error injection with noncommuting axes.
The nominal attitude is
a positive passive 90∘ yaw.
A right error model estimates a positive 10∘ frame rotation about its positive x
axis:
Compute
Give scalar first numerical components.
- Physical control correction from a passive error quaternion.
A controller forms the principal left error
Find the first order physical frame correction vector δ𝜃L.
Explain why using +2δqL,v would have the wrong sign under the PhysicsLibrary
convention.
- relative attitude between two bodies.
Two body frames have passive inertial attitudes
and
Compute
State the positive relative frame rotation.
- Why Euler Angle subtraction is not the exact error.
Use the Exercise 4 attitudes to explain why subtracting two sets of Euler coordinates is not
generally the same as computing the multiplicative quaternion error.
Compare the exact principal error angle from Exercise 4 with the magnitude one
might naively infer by treating two 90∘ axis rotations as ordinary orthogonal vector
components.
- Near
principal sign behavior.
Let
and consider a positive passive frame error of 179∘.
Write a principal error quaternion.
What happens to the chosen quaternion sign if the error passes through 180∘ while a rule
enforces δqw ≥ 0?
Does the physical attitude become discontinuous?
- Error state consistency in a filter.
A filter covariance is defined using a right multiplicative small error δ𝜃R, but a software
update routine is written as
Explain why this is inconsistent.
Give two correct alternatives: one that retains the right error definition, and one that
transports the correction to a left error before injection.
2 Solutions
Solution 1: identity error
If
then
and
Therefore
The physical attitude error is zero.
Solution 2: opposite stored quaternion sign
If
then
and
Thus the raw errors are
The quaternions +1 and −1 represent the same identity orientation. Therefore the physical
attitude error is zero.
For a local principal representation, flip the sign:
Solution 3: same axis desired versus actual yaw
The conjugate of the current attitude is
Therefore
Because both quaternions use the same axis, they commute, so
The quaternion half angle is 7.5∘, so the physical frame error is
The negative k vector part is exactly the passive sign expected for a positive frame rotation about
+z.
Solution 4: noncommuting left and right errors
The current conjugate is
The left error is
Hence
The right error is
Hence
For both errors,
Therefore
and
For the left error,
Passive axis extraction gives
For the right error,
so
The angle is the same, but the coordinates of the error axis differ.
Solution 5: direction cosine matrix error check
The current DCM is
and the desired DCM is
The left error matrix is
Thus
Converting
with the Q09 quaternion to DCM formula gives exactly this matrix.
Similarly,
Therefore
which agrees with
Solution 6: principal quaternion sign
The raw error has
Multiply all four components by −1:
The scalar is approximately
and the vector magnitude is approximately
Therefore
The vector part points in the −k quaternion direction. Under the passive convention the physical
positive frame axis is the opposite vector direction:
Thus the error is a positive 5∘ frame rotation about +z.
Solution 7: exact passive axis angle extraction
The squared norm is
Thus the quaternion is unit.
Its scalar component is
Therefore
The vector part is
Its direction is opposite the physical passive frame axis, so
Solution 8: small error vector from a quaternion
For a passive small error,
Thus
Therefore
Using
the components are approximately
Solution 9: transport a right small error to the left
The relation is
Therefore
Thus
The first order right error quaternion is
The first order left error quaternion is
The two vector parts differ because the same geometric error is resolved on different sides of the
current attitude map.
Solution 10: left error estimation injection
A positive 2∘ passive frame yaw correction has quaternion
The left injection is
Both rotations are about +z, so they commute and their frame angles add:
Thus
The corrected attitude is a positive passive frame yaw of
Solution 11: right error injection with noncommuting axes
Let
Then
Expanding with Hamilton multiplication,
Therefore
Numerically,
Hence
Because the correction axis is not the same as the nominal yaw axis, the product cannot be
reduced by simply adding scalar angles.
Solution 12: physical control correction from a passive error quaternion
The vector part is
For the PhysicsLibrary passive convention,
Therefore
Using
would produce the opposite physical frame correction because the passive quaternion vector part
has the negative half angle sign.
Solution 13: relative attitude between two bodies
The direct relative attitude is
The conjugate of the first attitude is
Therefore
Hence
Because quaternion arguments use half angles, this represents a positive relative frame rotation
of
about +z.
Solution 14: why Euler angle subtraction is not the exact error
Exercise 4 compares a positive 90∘ x frame rotation with a positive 90∘ y frame rotation.
The exact multiplicative quaternion error has scalar part
Therefore the exact principal error angle is
If one incorrectly treated the two 90∘ angle changes as orthogonal components of an ordinary
Euclidean vector, one might form
That number is not the actual finite relative rotation.
The discrepancy occurs because finite rotations compose on a noncommutative group. Euler angle
coordinates are sequence dependent nonlinear coordinates, not Cartesian components of a global
attitude vector.
Solution 15: near
principal sign behavior
For a positive passive frame error of 179∘ about u,
Thus a principal quaternion is
Its scalar component is small but positive.
If the physical error passes beyond 180∘, the raw continuation of the same quaternion branch gives
a negative scalar component. A policy that requires
will then multiply the quaternion by −1.
Consequently the stored quaternion components can switch sign even though the physical attitude
changes continuously.
The physical orientation does not become discontinuous. The discontinuity belongs to the chosen
principal quaternion representative.
Solution 16: error state consistency in a filter
A right multiplicative error is defined by
Therefore a correction estimated in the right error coordinates must be injected on the
right:
Using
would reinterpret the same quaternion components as a left side correction, which is generally a
different physical coordinate resolution.
One correct alternative is therefore to retain the right error definition and right inject
it.
A second correct alternative is to transport the correction to the left side:
and then inject
For a small error vector, the equivalent coordinate transport is
The covariance definition, Jacobians, correction coordinates, and injection side must all use one
consistent convention.
3 Compact passive error checks
|
|
| Quantity | PhysicsLibrary passive result |
|
|
| Left error | δqL = qdq∗ |
|
|
| Right error | δqR = q∗q
d |
|
|
| Left reconstruction | qd = δqLq |
|
|
| Right reconstruction | qd = qδqR |
|
|
| Small frame error | δq ≈ [1,−δ𝜃∕2]T |
|
|
| Recover small frame error | δ𝜃 ≈−2δqv |
|
|
| Left/right relation | δqL = qδqRq∗ |
|
|
| Small vector transport | δ𝜃L = C(q)δ𝜃R |
|
|
4 Sources and exercise provenance
The exercises and solutions in this companion are newly written or rewritten for PhysicsLibrary
under the passive frame convention.
Sommer and coauthors provide a modern convention analysis that helps separate Hamilton
quaternion algebra from active and passive frame semantics. Markley and Crassidis provide a
broad spacecraft attitude treatment including multiplicative attitude errors. Solà provides a
detailed engineering discussion of quaternion perturbations and error state filtering; formulas
must be translated carefully when its quaternion map differs from the PhysicsLibrary
convention.
References
[1] 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
[2] F. L. Markley and J. L. Crassidis, Fundamentals of Spacecraft Attitude Determination
and Control, Springer, 2014. Engineering reference. Publisher book page
[3] J. Solà, “Quaternion Kinematics for the Error State Kalman Filter,” technical
report, 2017. arXiv preprint
[4] M. D. Shuster, “The Nature of the Quaternion,” The Journal of the Astronautical
Sciences, vol. 56, no. 3, pp. 359–373, 2008. Reference source. DOI record
License
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative
Commons Attribution ShareAlike 4.0 International license.