Relative Attitude and Error Quaternions
An attitude quaternion describes the orientation of one frame relative to another. In estimation
and control, however, the quantity of immediate interest is often not the attitude itself but the
difference between two attitudes.
Examples include:
- the difference between a commanded spacecraft attitude and the measured attitude;
- the difference between the true attitude and a filter estimate;
- the relative orientation between two vehicles;
- the correction that must be injected into a nominal quaternion state;
- the small attitude error used in a Kalman filter or feedback controller.
Attitude error is not obtained by subtracting quaternion components. Because three dimensional
orientation is a noncommutative rotation group, the exact relative attitude is formed by quaternion
multiplication with an inverse.
PhysicsLibrary uses passive frame quaternions. Let
denote the current or actual attitude, mapping reference frame I coordinates into actual body
frame B coordinates.
Let
denote the desired attitude, mapping the same reference frame coordinates into desired frame D
coordinates.
Two multiplicative error definitions are useful:
and
They are called the left and right errors because they reconstruct the desired attitude
as
or
Both represent the same physical relative orientation, but their vector parts are resolved on
different sides of the attitude transformation.
1 Convention declaration
PhysicsLibrary uses Hamilton multiplication,
with reversed products changing sign.
Quaternion components are displayed scalar first:
The canonical passive coordinate map is
For a positive frame rotation through angle 𝜃 about unit axis u,
This negative vector sign is essential when converting an error quaternion to a physical small frame
rotation vector.
2 Why subtraction is not an attitude error
A quaternion is not an ordinary vector in orientation space.
The component difference
is a four dimensional Euclidean difference between two parameter vectors. It is not itself a unit
quaternion and does not directly represent the finite rotation that carries one attitude into the
other.
The exact relative transformation must instead satisfy a composition equation.
For a left error,
Right multiply by q∗:
Therefore
For a right error,
Left multiply by q∗:
Therefore
3 Geometric interpretation of the left error
Because
and
the conjugate of the current attitude is
Therefore the left error has the explicit frame chain
Hence
The left error is the direct passive coordinate transformation from the current actual frame into
the desired frame.
It is therefore especially natural when the correction is applied on the body or output
side:
4 Geometric interpretation of the right error
The right error is
It reconstructs the desired attitude by right multiplication:
The right error is the same relative rotation transported to the reference or input side of the
current attitude transformation.
The two errors are related exactly by conjugation.
Starting from
multiply on the left by q and on the right by q∗:
Thus
Equivalently,
This relation explains why left and right errors have the same scalar part and the same rotation
magnitude but generally different vector components.
5 Relative attitude diagram
The following diagram summarizes the passive frame maps and the two multiplicative
errors.
Figure. The actual passive attitude is q = Bq
I and the desired passive attitude is qd = Dq
I. The
left error is the direct actual to desired frame map δqL = qdq∗ and is applied on the left. The right
error δqR = q∗q
d is the conjugate transported version applied on the right. For a small positive
frame error, the quaternion vector part has the opposite sign from the physical rotation
vector.
6 Direction cosine matrix form
Let
and
be the passive DCMs.
Because
and
the left error matrix is
The right error matrix is
The exact conjugation relation becomes
Thus the quaternion and DCM error definitions are completely consistent.
7 Exact axis angle form of a passive error quaternion
Choose a unit error quaternion
Under the PhysicsLibrary passive convention,
For a principal representative with
the principal error angle is
If the vector part is nonzero, the corresponding positive frame error axis is
The minus sign is the passive counterpart of the usual active axis extraction formula.
8 Principal sign choice
The unit quaternions
and
represent the same physical relative attitude.
For local estimation and control, it is usually convenient to choose the representative with
nonnegative scalar component:
This selects a principal error angle in the interval
If an initially computed error has
replace it by
before forming a local small error vector.
At exactly 180∘,
and the sign choice is intrinsically ambiguous. The two quaternion signs are equally valid at that
point.
9 Small attitude error approximation
For a small positive frame error vector
use
and
Then the passive error quaternion becomes
In scalar first array notation,
Therefore the physical small frame error vector is recovered from the quaternion vector part
by
This is one of the most important sign changes from an active quaternion error model.
10 Left and right small error vectors
Let
denote the small frame error vector associated with δqL, and let
denote the small frame error vector associated with δqR.
The exact quaternion relation is
To first order,
Therefore
The quaternion sandwich transforms pure vector coordinates according to the current passive
attitude:
Hence
Equivalently,
Thus the left and right small errors represent the same geometric misalignment in different
coordinate resolutions.
11 Check: desired yaw differs by 
Suppose the current passive attitude is a positive 10∘ frame yaw about +z:
Suppose the desired attitude is a positive 25∘ frame yaw:
Because both rotations use the same axis, they commute. The left error is
Therefore
This is the passive quaternion for a positive 15∘ frame error about +z.
The exact physical error is therefore
12 Check: left and right errors need not be equal
Take the current attitude as a positive 90∘ frame rotation about +x:
Take the desired attitude as a positive 90∘ frame rotation about +y:
The current conjugate is
The left error is
Thus
The right error is
Thus
The two errors have the same scalar part and the same vector magnitude but different vector
directions.
Finite attitude error is therefore convention sensitive even when the error angle itself is
unchanged.
13 Same physical attitude with opposite quaternion signs
Suppose the stored current and desired quaternions satisfy
They represent exactly the same physical attitude.
The left error is
Thus
The quaternion −1 represents the identity orientation just as +1 does.
For a local error representation, change the sign to the principal representative
The physical attitude error is zero, not 360∘.
14 Desired versus actual attitude in control
For control, let
be the measured or estimated actual passive attitude and let
be the commanded passive attitude.
A body side correction can be formed with
For a small error,
Therefore a controller that requires a physical positive frame correction vector should
use
away from the 180∘ sign ambiguity.
The sign factor selects the locally shortest quaternion representative.
A control law should not use the raw quaternion vector part without first accounting for the active
or passive convention.
15 True versus estimated attitude in estimation
Let the true passive attitude be
and a nominal estimate be
A left multiplicative error is defined by
Therefore
A right multiplicative error is defined by
so
For a passive small error state,
The filter covariance, Jacobians, reset equation, and correction injection must all use the same left
or right definition.
16 Error injection
Suppose an estimator has computed a correction quaternion δq.
For a left error model, update the nominal attitude by
For a right error model,
Mixing a right error covariance model with a left injection, or vice versa, changes the coordinate
interpretation of the correction and is generally inconsistent.
17 Relative attitude between two physical bodies
The same algebra applies when neither attitude is merely a desired command.
Let two physical frames B1 and B2 have passive attitudes
and
The direct coordinate map from B1 into B2 is
This is exactly the same form as the left error quaternion.
Therefore relative attitude and attitude error are mathematically the same operation. The
difference is the engineering interpretation assigned to the two endpoint frames.
18 Why Euler angle subtraction is generally not exact
Suppose the actual and desired attitudes are displayed as yaw, pitch, and roll triples.
The component difference
is generally not the exact finite attitude error vector.
Euler Angles are nonlinear coordinates associated with an ordered sequence of rotations. Finite
rotations do not commute, so subtracting the three coordinates does not reproduce the group
product
or
For sufficiently small errors and away from an Euler singularity, angle differences may provide a
local approximation. The exact error should nevertheless be formed first with quaternions or
DCMs.
19 Error near 
For a principal passive error quaternion,
Therefore
corresponds to
Near this angle, the two equivalent representatives δq and −δq have nearly equal scalar magnitude
and opposite vector parts.
Consequently a rule that always forces a positive scalar component can switch sign under very
small perturbations near 180∘.
The physical orientation remains continuous. The discontinuity belongs to the chosen quaternion
representative.
This issue is especially important in controllers, optimizers, and time histories that assume
quaternion component continuity.
20 Exact error angle without choosing an axis sign
If only the magnitude of the principal attitude error is needed, choose the quaternion sign so
that
Then
An equivalent numerically robust form is
The second form behaves well for both small and large angles.
21 Small error norm
The first order passive error quaternion is
Its squared Euclidean norm is
Thus
The unit norm error introduced by the first order small error approximation is second order in the
attitude error magnitude.
22 Implementation checks
A relative attitude implementation should pass the following checks.
- Identity.
If
then both errors must equal +1 up to quaternion sign.
- Opposite stored sign.
If
the physical error must still be zero.
- Same axis rotations.
For current yaw 10∘ and desired yaw 25∘, the passive error must represent a positive
15∘ frame yaw and therefore have a negative k vector component.
- Left and right reconstruction.
Verify
and
- Conjugation relation.
Verify
- DCM consistency.
Verify
and
- Small error sign.
For a small positive frame rotation vector δ𝜃, verify
23 Common pitfalls
- Subtracting quaternion components.
The exact relative attitude is multiplicative, not additive.
- Using the old active small error sign.
For the PhysicsLibrary passive frame quaternion,
- Calling an error simply “the quaternion difference.”
The order must be stated. qdq∗ and q∗q
d are generally different.
- Mixing left error propagation with right error injection.
The filter or controller must keep the chosen side consistent.
- Ignoring the
versus
equivalence.
An error quaternion near −1 can represent almost zero physical error.
- Forcing sign continuity and principal angle simultaneously without a policy.
Near 180∘, the principal sign choice can switch discontinuously.
- Interpreting the raw passive vector part as a positive physical correction
vector.
The small physical frame error is approximately −2δqv.
- Subtracting Euler Angle triples for a large finite error.
Euler coordinates are sequence dependent nonlinear coordinates, not a global rotation
vector.
- Assuming left and right error vectors have the same coordinates.
They represent the same geometric error but are transported through the current
attitude.
24 Relationship to adjacent PhysicsLibrary entries
The preceding article, quaternion kinematics and angular velocity, derives the passive quaternion
differential equations used to propagate the nominal attitude.
The present article defines exact relative attitude and multiplicative error quaternions and
establishes the passive small error sign used in estimation and control.
A separate companion entry, Relative Attitude and Error Quaternions: Examples, Exercises, and
Solutions, provides the Q12E self study problem bank.
The next main article, numerical quaternion propagation and IMU attitude state integration,
combines quaternion kinematics, sampled gyro increments, bias correction, and small error
concepts in a discrete navigation implementation.
25 Sources and convention notes
Relative attitude and multiplicative quaternion errors are standard tools in spacecraft attitude
estimation, inertial navigation, robotics, and nonlinear state estimation. Their exact signs and
multiplication sides depend on the chosen quaternion frame map.
Sommer and coauthors provide a modern discussion of quaternion convention management and
passive frame transformations. Markley and Crassidis provide a broad spacecraft attitude
treatment including quaternion errors and estimation. Shuster discusses historical spacecraft
quaternion conventions. Solà provides a detailed engineering discussion of quaternion
perturbations and error state Kalman filtering; its formulas should be translated carefully when the
quaternion map differs from the PhysicsLibrary passive 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] 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
[4] J. Solà, “Quaternion Kinematics for the Error State Kalman Filter,” technical
report, 2017. arXiv preprint
License
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative
Commons Attribution ShareAlike 4.0 International license.