Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random | Template Test |  
Login
create new user
Username:
Password:
forget your password?
Main Menu
Sections

Meta

Talkback

Downloads

Information
relative attitude and error quaternions (Definition)

Relative attitude and error quaternions

An attitude quaternion describes an orientation relative to a reference frame. In estimation and control, the more useful quantity is often the orientation difference between an actual attitude and a desired or estimated attitude. Because rotations form a noncommutative group, this difference is not obtained by subtracting quaternion components. It is obtained by forming a relative rotation through quaternion multiplication and inversion.

The resulting unit quaternion is called a relative attitude quaternion or an error quaternion. It is exact for arbitrarily large attitude differences. When the error is small, its vector part reduces naturally to the three component small rotation vector used in many Kalman filters and attitude controllers.

Convention declaration

This article continues the PhysicsLibrary convention used in Q00 through Q11:

  1. right-handed orthonormal frames;
  2. Hamilton multiplication, so $\mathbf i\mathbf j=\mathbf k$;
  3. scalar-first display notation,
    $\displaystyle q=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k;$ (1)
  4. the actual attitude quaternion is
    $\displaystyle q\equiv {}^{I}q_B,$ (2)
    which maps body coordinates into the inertial or reference frame;
  5. the desired attitude is denoted by $q_d$.

Both $q$ and are assumed to be unit quaternions unless stated otherwise.

Why quaternion subtraction is not attitude error

The component difference

$\displaystyle q_d-q$ (3)
is not itself an orientation. It need not have unit norm, it depends on the choice between the equivalent representatives and $-q$, and it does not compose with attitude in the correct geometric way.

The correct error must instead satisfy a composition equation. There are two standard choices, depending on whether the correction multiplies the actual attitude on the left or on the right.

Left error and right error

Define the left error quaternion by requiring

$\displaystyle \boxed{q_d=\delta q_I\,q.}$ (4)
Multiplying on the right by $q^*$ gives
$\displaystyle \boxed{\delta q_I=q_dq^*.}$ (5)
This form expresses the relative correction on the inertial or reference side of the attitude map.

Alternatively, define the right error quaternion by

$\displaystyle \boxed{q_d=q\,\delta q_B.}$ (6)
Multiplying on the left by gives
$\displaystyle \boxed{\delta q_B=q^*q_d.}$ (7)
This form expresses the correction on the body side.

Both quaternions describe the same physical relative rotation. They differ only in the coordinates used for its rotation axis. The two forms are related by

$\displaystyle \boxed{\delta q_I=q\,\delta q_B\,q^*.}$ (8)
Thus the vector part of the error transforms exactly as an ordinary spatial vector under conjugation by the attitude quaternion.

Geometry of the relative attitude

Figure [*] shows the actual and desired orientations and the relative correction between them. The actual frame is rotated into the desired frame by an error rotation with axis $\widehat{\mathbf u}_e$ and angle $\delta\theta$.

Figure: Relative attitude and the multiplicative error quaternion. The actual attitude and desired attitude are connected by either a left error $q_d=\delta q_I q$ or a right error $q_d=q\delta q_B$. The two error quaternions represent the same physical rotation, resolved in different coordinates.
Image Q12_relative_attitude_error_quaternion

Axis angle interpretation of the error

Any unit error quaternion may be written as

$\displaystyle \boxed{ \delta q = \cos\frac{\delta\theta}{2} + \widehat{\mathbf u}_e\sin\frac{\delta\theta}{2}. }$ (9)
Write
$\displaystyle \delta q=\delta q_w+\delta\mathbf q_v.$ (10)
For a nonzero vector part, the error axis is
$\displaystyle \boxed{ \widehat{\mathbf u}_e= \frac{\delta\mathbf q_v}{\lVert\delta\mathbf q_v\rVert}. }$ (11)
The exact error angle is most robustly obtained from
$\displaystyle \boxed{ \delta\theta =2\operatorname{atan2} \left(\lVert\delta\mathbf q_v\rVert,\delta q_w\right). }$ (12)

Choosing the principal error

The quaternions $\delta q$ and $-\delta q$ describe the same physical relative orientation. For feedback and local estimation it is usually convenient to choose the representative whose scalar part is nonnegative:

$\displaystyle \boxed{\delta q_w\ge 0.}$ (13)
This choice gives the principal rotation angle in the interval
$\displaystyle 0\le\delta\theta\le\pi.$ (14)

A convenient implementation rule is to replace

$\displaystyle \delta q\leftarrow -\delta q$ (15)
whenever $\delta q_w<0$, except when an application deliberately maintains a different sign continuity convention. Near $180^\circ$, the sign choice is intrinsically ambiguous because the scalar part is close to zero.

Small error approximation

For small attitude error,

$\displaystyle \delta\theta\ll 1,$ (16)
so
$\displaystyle \cos\frac{\delta\theta}{2}\approx 1, \qquad \sin\frac{\delta\theta}{2}\approx\frac{\delta\theta}{2}.$ (17)
Define the small rotation vector
$\displaystyle \delta\boldsymbol\theta =\delta\theta\widehat{\mathbf u}_e.$ (18)
Then
$\displaystyle \boxed{ \delta q \approx 1+\frac12\delta\boldsymbol\theta }$ (19)
when the rotation vector is identified with a pure quaternion. In scalar-first column form,
$\displaystyle \boxed{ \delta q \approx \begin{bmatrix} 1\\ [2mm] \frac12\delta\boldsymbol\theta \end{bmatrix}. }$ (20)
Therefore, provided the error representative has been chosen near $+1$,
$\displaystyle \boxed{ \delta\boldsymbol\theta \approx 2\,\delta\mathbf q_v. }$ (21)
This three component vector is the standard bridge between exact quaternion error and linearized attitude error models.

Left and right small error vectors

From equation (8), a small right error and a small left error satisfy

$\displaystyle \delta q_I=q\delta q_Bq^*.$ (22)
Using the small error form gives
$\displaystyle 1+\frac12\delta\boldsymbol\theta^I \approx q\left(1+\frac12\delta\boldsymbol\theta^B\right)q^*.$ (23)
The scalar part remains one and the vector part rotates according to Q07, so
$\displaystyle \boxed{ \delta\boldsymbol\theta^I =R(q)\,\delta\boldsymbol\theta^B }$ (24)
to first order. Thus the same small physical attitude error can be resolved in inertial coordinates or body coordinates.

Example: a spacecraft yaw correction

Suppose the actual attitude is a $10^\circ$ yaw and the desired attitude is a $20^\circ$ yaw. Then

$\displaystyle q=\cos5^\circ+\mathbf k\sin5^\circ,$ (25)
and
$\displaystyle q_d=\cos10^\circ+\mathbf k\sin10^\circ.$ (26)
Because both rotations are about the same axis,
\begin{equation*}\begin{aligned} \delta q_I &=q_dq^*\ &=\cos5^\circ+\mathbf k\sin5^\circ. \end{aligned}\end{equation*}
Therefore the required correction is exactly a rotation about the positive $z$ axis.

Use in attitude estimation

Many attitude estimators maintain a full unit quaternion as the nominal attitude but use only three small variables for the local attitude error. A small correction may be formed as

$\displaystyle \delta q(\delta\boldsymbol\theta) \approx \begin{bmatrix} 1\\ [1mm] \frac12\delta\boldsymbol\theta \end{bmatrix},$ (28)
then injected into the nominal quaternion. A left error estimator uses
$\displaystyle \boxed{q^+=\delta q\,\widehat q,}$ (29)
while a right error estimator uses
$\displaystyle \boxed{q^+=\widehat q\,\delta q.}$ (30)
The estimator equations and covariance must use the same error convention consistently. Mixing a left error covariance model with right error injection is a common implementation mistake.

Use in attitude control

For control, the vector part of the principal error quaternion provides a bounded directional measure of attitude error. For small error,

$\displaystyle 2\delta\mathbf q_v\approx\delta\boldsymbol\theta,$ (31)
so a controller based on the error quaternion vector part reduces locally to a controller based on the familiar small rotation vector.

For large errors, the exact quaternion should be retained rather than replacing it with the linear approximation. NASA spacecraft control work has long used quaternion attitude error measures for this reason, including exact nonlinear error formulations and comparisons with direction cosine formulations.

Error quaternion versus Euler angle difference

A raw Euler angle difference is not a geometric rotation vector for finite errors. If Euler angles are used for display or commands, convert the two orientations to quaternions or matrices first and form the exact relative rotation. Only after the relative error is known to be small should one use the three component approximation

$\displaystyle \delta\boldsymbol\theta\approx2\delta\mathbf q_v.$ (32)
This avoids sequence dependence and Euler angle singularities.

Common pitfalls

The most common mistakes are:

  1. subtracting quaternion components instead of forming a relative product;
  2. confusing the left error $q_dq^*$ with the right error $q^*q_d$;
  3. using the small angle approximation for a large attitude error;
  4. forgetting that and represent the same rotation;
  5. allowing a sign flip to create an artificial error near $-1$ when the physical attitude difference is near zero;
  6. mixing an inertial resolved error vector with a body resolved covariance or controller gain;
  7. forming an Euler angle difference and treating it as an exact rotation vector.

What comes next

Q13 develops numerical quaternion propagation. It compares direct numerical integration of quaternion kinematics with exponential updates from sampled gyro increments, discusses normalization drift, and treats quaternion sign continuity in discrete time.

Sources and historical notes

Quaternion attitude error measures are standard in spacecraft estimation and control. Bach and Paielli's NASA Technical Memorandum 102798 develops a quaternion attitude error formulation and shows how its first three components can be used in an exact linear error control construction. The equations in this article are written in the PhysicsLibrary convention rather than copied from that report because error multiplication order and coordinate meaning are convention dependent. The small rotation vector interpretation is also consistent with standard multiplicative attitude estimation practice.

Bibliography

1
R. Bach and R. Paielli, Direct Inversion of Rigid-Body Rotational Dynamics, NASA Technical Memorandum 102798, 1990.
2
M. D. Shuster, “A Survey of Attitude Representations,” The Journal of the Astronautical Sciences, vol. 41, no. 4, pp. 439–517, 1993.

License

This article is an original synthesis prepared for PhysicsLibrary and intended for release under CC BY-SA 4.0.



"relative attitude and error quaternions" is owned by bloftin.
(view preamble)
View style:
Other names:  relative attitude quaternion, error quaternion
Also defines:  error quaternions, relative attitude
Keywords:  quaternion, relative attitude, error quaternion, attitude error, multiplicative error, small angle error, spacecraft attitude, error state estimation, attitude control

Attachments:
example of relative attitude and error quaternions (Example) by bloftin

Cross-references: kinematics, matrices, direction cosine, work, injection, covariance, scalar, conjugation, composition, norm, vector, quaternion multiplication, noncommutative group, reference frame, quaternion
There are 2 references to this object.

This is version 2 of relative attitude and error quaternions, born on 2026-08-24, modified 2026-08-24.
Object id is 1107, canonical name is RelativeAttitudeAndErrorQuaternions.
Accessed 11 times total.

Classification:
Physics Classification02.40.Yy (Geometric mechanics )
 02.10.Hh (Rings and algebras)
 45.40.-f (Dynamics and kinematics of rigid bodies)
Pending Errata and Addenda
None.
Discussion
Style: Expand: Order:

No messages.

Interact
rate | post | correct | update request | add derivation | add example | add (any)