Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random |  
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 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

q = Bq
      I
(1)

denote the current or actual attitude, mapping reference frame I coordinates into actual body frame B coordinates.

Let

     D
qd =   qI
(2)

denote the desired attitude, mapping the same reference frame coordinates into desired frame D coordinates.

Two multiplicative error definitions are useful:

         ∗
δqL = qdq
(3)

and

        ∗
δqR =  q qd.
(4)

They are called the left and right errors because they reconstruct the desired attitude as

qd = δqLq
(5)

or

qd = qδqR.
(6)

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,

ij = k,    jk =  i,     ki = j,

with reversed products changing sign.

Quaternion components are displayed scalar first:

                                 ⌊ q ⌋
                                 |  w|
q = qw + qxi + qyj + qzk  ← →    | qx| .
                                 ⌈ qy⌉
                                   qz
(7)

The canonical passive coordinate map is

Bv  = Bq  Iv(Bq )∗.
        I      I
(8)

For a positive frame rotation through angle 𝜃 about unit axis u,

        𝜃-       𝜃-
q = cos 2 − ^u sin 2.
(9)

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

q − q
 d

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,

qd = δqLq.

Right multiply by q:

qq ∗ = δq qq∗ = δq .
 d       L        L

Therefore

δq  = q q∗.
  L    d
(10)

For a right error,

q =  qδq .
 d      R

Left multiply by q:

q∗q  = q∗qδq  =  δq .
   d        R      R

Therefore

        ∗
δqR =  q qd.
(11)

3 Geometric interpretation of the left error

Because

q = Bq
      I

and

     D
qd =   qI,

the conjugate of the current attitude is

 ∗   I
q  =  qB.

Therefore the left error has the explicit frame chain

δqL = DqI IqB
      D
    =   qB.

Hence

δqL =  DqB.
(12)

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:

qd = δqLq.

4 Geometric interpretation of the right error

The right error is

δq  =  q∗q.
  R       d

It reconstructs the desired attitude by right multiplication:

qd = qδqR.

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

        ∗
δqR =  q qd,

multiply on the left by q and on the right by q:

     ∗     ∗   ∗      ∗
qδqRq  = qq qdq  = qdq .

Thus

            ∗
δqL = qδqRq  .
(13)

Equivalently,

       ∗
δqR = q δqLq.
(14)

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.

PIC

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 = qq 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

C =  C(q)

and

C  =  C(q )
  d      d

be the passive DCMs.

Because

C(pq) = C (p)C (q)

and

C (q∗) = C(q)T,

the left error matrix is

EL =  C(δqL) = CdCT  .
(15)

The right error matrix is

ER =  C(δqR ) = CT Cd.
(16)

The exact conjugation relation becomes

EL  = CERCT   .
(17)

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

δq = δqw + δqv.

Under the PhysicsLibrary passive convention,

δq = cos δ𝜃-− ^u  sin δ𝜃.
         2      e    2
(18)

For a principal representative with

δqw ≥ 0,

the principal error angle is

δ𝜃 = 2 atan2(∥ δqv∥,δqw) .
(19)

If the vector part is nonzero, the corresponding positive frame error axis is

        δqv
^ue = − ------.
       ∥δqv ∥
(20)

The minus sign is the passive counterpart of the usual active axis extraction formula.

8 Principal sign choice

The unit quaternions

δq

and

− δq

represent the same physical relative attitude.

For local estimation and control, it is usually convenient to choose the representative with nonnegative scalar component:

δqw ≥ 0.
(21)

This selects a principal error angle in the interval

0 ≤ δ𝜃 ≤ π.
(22)

If an initially computed error has

δqw < 0,

replace it by

− δq

before forming a local small error vector.

At exactly 180,

δqw = 0,

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

δ𝜃 =  ^ueδ𝜃,

use

   δ𝜃-
cos 2 ≈  1

and

   δ𝜃-   δ𝜃-
sin 2  ≈  2 .

Then the passive error quaternion becomes

         1
δq ≈ 1 − -δ 𝜃.
         2
(23)

In scalar first array notation,

      [      ]
δq ≈     11    .
       − 2δ𝜃
(24)

Therefore the physical small frame error vector is recovered from the quaternion vector part by

δ 𝜃 ≈ − 2δqv.
(25)

This is one of the most important sign changes from an active quaternion error model.

10 Left and right small error vectors

Let

δ𝜃L

denote the small frame error vector associated with δqL, and let

δ𝜃R

denote the small frame error vector associated with δqR.

The exact quaternion relation is

δq  = qδq  q∗.
  L      R

To first order,

           1
δqR ≈  1 − -δ𝜃R.
           2

Therefore

        (     1    )
δqL ≈  q  1 − -δ𝜃R   q∗
              2
           1-     ∗
    =  1 − 2qδ𝜃Rq  .

The quaternion sandwich transforms pure vector coordinates according to the current passive attitude:

qδ𝜃  q∗ = C (q)δ𝜃 .
    R            R

Hence

δ𝜃L = C (q)δ𝜃R.
(26)

Equivalently,

δ𝜃R  = C (q)Tδ𝜃L.
(27)

Thus the left and right small errors represent the same geometric misalignment in different coordinate resolutions.

11 Check: desired yaw differs by 15∘

Suppose the current passive attitude is a positive 10 frame yaw about +z:

q = cos5∘ − k sin 5∘.

Suppose the desired attitude is a positive 25 frame yaw:

qd = cos 12.5∘ − k sin12.5∘.

Because both rotations use the same axis, they commute. The left error is

δqL = qdq∗
               ∘           ∘       ∘        ∘
    = (cos 12.5  − k sin12.5 )(cos 5 + k sin5 ).

Therefore

δqL = cos 7.5∘ − k sin 7.5∘.
(28)

This is the passive quaternion for a positive 15 frame error about +z.

The exact physical error is therefore

δ𝜃 =  15∘,    ^u  = + ^z.
                e
(29)

12 Check: left and right errors need not be equal

Take the current attitude as a positive 90 frame rotation about +x:

q = 1√−-i.
       2
(30)

Take the desired attitude as a positive 90 frame rotation about +y:

     1 − j
qd = -√---.
        2
(31)

The current conjugate is

 ∗   1 + i
q  = -√---.
        2

The left error is

          ∗
δqL =  qdq
       1-
    =  2(1 − j)(1 + i)
       1
    =  -(1 + i − j + k).
       2

Thus

       1-
δqL =  2(1 + i − j + k).
(32)

The right error is

δqR =  q∗qd
       1
    =  -(1 + i)(1 − j)
       2
    =  1(1 + i − j − k).
       2

Thus

δqR =  1(1 + i − j − k).
       2
(33)

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

qd = − q.

They represent exactly the same physical attitude.

The left error is

δqL =  qdq∗ = − qq∗ = − 1.

Thus

δqL = − 1.
(34)

The quaternion 1 represents the identity orientation just as +1 does.

For a local error representation, change the sign to the principal representative

δq  = +1.
  L
(35)

The physical attitude error is zero, not 360.

14 Desired versus actual attitude in control

For control, let

q

be the measured or estimated actual passive attitude and let

q
 d

be the commanded passive attitude.

A body side correction can be formed with

δqL = qdq∗.

For a small error,

          1-
δqL ≈ 1 − 2δ𝜃L.

Therefore a controller that requires a physical positive frame correction vector should use

δ𝜃  ≈ − 2 sgn(δq   )δq   ,
  L             L,w    L,v
(36)

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

qt

and a nominal estimate be

^q.

A left multiplicative error is defined by

qt = δqL ^q.
(37)

Therefore

δqL =  qt^q∗.
(38)

A right multiplicative error is defined by

q = ^qδq  ,
 t      R
(39)

so

        ∗
δqR =  ^q qt.
(40)

For a passive small error state,

     [  1  ]
δq ≈    1    .
      − 2δ𝜃
(41)

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

 +       −
^q  =  δ^q ^q .
(42)

For a right error model,

 +     −
^q  =  ^q δq^.
(43)

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

B
 1qI

and

B2
  qI.

The direct coordinate map from B1 into B2 is

B2qB1 = B2qI(B1qI)∗.
(44)

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

⌊       ⌋
 ϕd − ϕ
⌈ 𝜃 − 𝜃 ⌉
   d
 ψd − ψ

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

q q∗
 d

or

 ∗
q qd.

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 180 ∘

For a principal passive error quaternion,

          δ𝜃
δqw = cos --.
           2

Therefore

δqw ≈ 0

corresponds to

δ𝜃 ≈ 180∘.

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

δqw ≥ 0.

Then

δ𝜃 =  2arccos(δqw).
(45)

An equivalent numerically robust form is

δ𝜃 = 2 atan2(∥ δqv∥,δqw) .
(46)

The second form behaves well for both small and large angles.

21 Small error norm

The first order passive error quaternion is

     [     ]
δq ≈    1    .
      − 12δ𝜃

Its squared Euclidean norm is

    2       1-    2
∥δq∥  ≈ 1 + 4∥ δ𝜃∥ .

Thus

              (      )
∥δq∥2 − 1 = O   ∥δ𝜃∥2  .
(47)

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.

  1. Identity.

    If

    qd = q,

    then both errors must equal +1 up to quaternion sign.

  2. Opposite stored sign.

    If

    qd = − q,

    the physical error must still be zero.

  3. 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.

  4. Left and right reconstruction.

    Verify

    q  = δq q
 d     L

    and

    qd = qδqR.
  5. Conjugation relation.

    Verify

    δqL = qδqRq ∗.
  6. DCM consistency.

    Verify

                  T
C (δqL) = CdC

    and

    C(δq  ) = CT C .
    R         d
  7. Small error sign.

    For a small positive frame rotation vector δ𝜃, verify

             1-
δqv ≈  − 2δ𝜃.

23 Common pitfalls

  1. Subtracting quaternion components.

    The exact relative attitude is multiplicative, not additive.

  2. Using the old active small error sign.

    For the PhysicsLibrary passive frame quaternion,

             1-
δq ≈ 1 − 2δ 𝜃.
  3. Calling an error simply “the quaternion difference.”

    The order must be stated. qdq and qq d are generally different.

  4. Mixing left error propagation with right error injection.

    The filter or controller must keep the chosen side consistent.

  5. Ignoring the q  versus − q  equivalence.

    An error quaternion near 1 can represent almost zero physical error.

  6. Forcing sign continuity and principal angle simultaneously without a policy.

    Near 180, the principal sign choice can switch discontinuously.

  7. Interpreting the raw passive vector part as a positive physical correction vector.

    The small physical frame error is approximately 2δqv.

  8. Subtracting Euler Angle triples for a large finite error.

    Euler coordinates are sequence dependent nonlinear coordinates, not a global rotation vector.

  9. 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.


"relative attitude and error quaternions" is owned by bloftin.
(view preamble)
View style:
See Also: quaternion series overview and article guide, Notation Quaternions for Physics and Engineering: Orientation, quaternion definition and basic algebra, example of quaternion definition and basic algebra, quaternion product, example of quaternion product, quaternion conjugate, example of quaternion conjugate, quaternion norm, example of quaternion norm, quaternion inverse, example of quaternion inverse

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: concepts, kinematics, numerical quaternion propagation and IMU attitude state integration, differential equations, quaternion kinematics and angular velocity, Euler Angle, norm, forces, Euler Angles, operation, injection, covariance, representation, identity, commute, formula, matrix, diagram, magnitude, relation, conjugation, composition, parameter, scalar, vector, reference frame, quaternion multiplication, noncommutative, quaternion
There are 14 references to this object.

This is version 4 of relative attitude and error quaternions, born on 2026-08-24, modified 2026-08-27.
Object id is 1107, canonical name is RelativeAttitudeAndErrorQuaternions.
Accessed 251 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)