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
[parent] example of relative attitude and error quaternions (Example)

Relative attitude and error quaternions: examples, exercises, and solutions

This companion article belongs to the PhysicsLibrary entry relative attitude and error quaternions. All exercises are stated first. Complete solutions appear only after the exercise section.

Convention declaration

We use the actual attitude $q$, desired attitude $q_d$, left error

$\displaystyle \delta q_I=q_dq^*,$ (1)
and right error
$\displaystyle \delta q_B=q^*q_d.$ (2)
The quaternions are unit, Hamilton multiplication is used, and components are displayed scalar first.

Exercises

Exercise 1

Starting from $q_d=\delta q_Iq$, derive $\delta q_I=q_dq^*$.

Exercise 2

Starting from $q_d=q\delta q_B$, derive $\delta q_B=q^*q_d$.

Exercise 3

Show that the two error definitions satisfy
$\displaystyle \delta q_I=q\delta q_Bq^*.$ (3)

Exercise 4

The actual attitude is a $10^\circ$ yaw and the desired attitude is a $25^\circ$ yaw. Find the exact error quaternion and its axis angle form.

Exercise 5

The actual attitude is
$\displaystyle q=\frac{1+\mathbf i}{\sqrt2},$ (4)
and the desired attitude is
$\displaystyle q_d=\frac{1+\mathbf j}{\sqrt2}.$ (5)
Compute the left error $\delta q_I=q_dq^*$.

Exercise 6

For the same attitudes as Exercise 5, compute the right error $\delta q_B=q^*q_d$ and verify that it differs from the left error.

Exercise 7

Given
$\displaystyle \delta q=0.9659258+0.2588190\mathbf k,$ (6)
recover the exact error angle and axis.

Exercise 8

Given the small error quaternion
$\displaystyle \delta q=(0.999825,\,0.005,\,-0.010,\,0.015),$ (7)
estimate the small rotation vector using the first order approximation.

Exercise 9

A relative quaternion is computed as
$\displaystyle \delta q=(-0.9998,\,0.010,\,-0.005,\,0.015).$ (8)
Choose the equivalent representative appropriate for a principal small error interpretation and estimate the small rotation vector.

Exercise 10

Show that if
$\displaystyle \delta q\approx \begin{bmatrix} 1\\ [1mm] \frac12\delta\boldsymbol\theta \end{bmatrix},$ (9)
then the norm error is second order in $\lVert\delta\boldsymbol\theta\rVert$.

Exercise 11

Suppose the actual attitude is exactly equal to the desired physical attitude, but the stored quaternions are $q$ and $q_d=-q$. Compute $q_dq^*$ and explain why this is not a large physical attitude error.

Exercise 12

If a small right error is
$\displaystyle \delta\boldsymbol\theta^B= \begin{bmatrix} 0.01\\ -0.02\\ 0.03 \end{bmatrix}\ \mathrm{rad}$ (10)
and the current attitude matrix is $R(q)$, write the expression for the corresponding inertial resolved small error.

Exercise 13

An error state estimator uses a right error but injects its correction according to $q^+=\delta q\widehat q$. What is inconsistent about this update?

Exercise 14

Why is the raw difference between desired and actual yaw-pitch-roll triples not, in general, an exact attitude error vector?

Exercise 15

A controller receives an error quaternion with scalar part near zero. What physical attitude error magnitude does this indicate, and why should sign selection be handled carefully there?

Exercise 16

Let the principal error quaternion be
$\displaystyle \delta q=0.9238795+ \frac{0.3826834}{\sqrt3}(\mathbf i+\mathbf j+\mathbf k).$ (11)
Find the error axis, exact angle, and first order small angle approximation. Comment on whether the first order approximation is appropriate.

Solutions

Solution 1

From
$\displaystyle q_d=\delta q_Iq,$ (12)
right multiply by $q^*$. Since $qq^*=1$,
$\displaystyle \boxed{\delta q_I=q_dq^*.}$ (13)

Solution 2

From
$\displaystyle q_d=q\delta q_B,$ (14)
left multiply by $q^*$. Since $q^*q=1$,
$\displaystyle \boxed{\delta q_B=q^*q_d.}$ (15)

Solution 3

Substitute the right error into the expression $q\delta q_Bq^*$:
$\displaystyle q\delta q_Bq^* =q(q^*q_d)q^* =(qq^*)q_dq^* =q_dq^*.$ (16)
Therefore
$\displaystyle \boxed{\delta q_I=q\delta q_Bq^*.}$ (17)

Solution 4

The desired yaw exceeds the actual yaw by $15^\circ$, so
$\displaystyle \boxed{ \delta q= \cos7.5^\circ+\mathbf k\sin7.5^\circ. }$ (18)
The error axis is $+\hat{\mathbf z}$ and the error angle is $15^\circ$.

Solution 5

Here
$\displaystyle q^*=\frac{1-\mathbf i}{\sqrt2}.$ (19)
Therefore
\begin{equation*}\begin{aligned} \delta q_I &=\frac12(1+\mathbf j)(1-\mathbf i)\ &=\frac12(1-\mathbf i+\mathbf j+\mathbf k), \end{aligned}\end{equation*}
because $\mathbf j\mathbf i=-\mathbf k$.

Solution 6

The right error is
\begin{equation*}\begin{aligned} \delta q_B &=\frac12(1-\mathbf i)(1+\mathbf j)\ &=\frac12(1-\mathbf i+\mathbf j-\mathbf k), \end{aligned}\end{equation*}
because $\mathbf i\mathbf j=\mathbf k$. The $\mathbf k$ component has the opposite sign from the left error. The two describe the same relative rotation resolved in different coordinates.

Solution 7

The scalar and vector magnitudes are
$\displaystyle \delta q_w=0.9659258, \qquad \lVert\delta\mathbf q_v\rVert=0.2588190.$ (22)
Thus
$\displaystyle \delta\theta=2\operatorname{atan2}(0.2588190,0.9659258)=30^\circ.$ (23)
The axis is $+\hat{\mathbf z}$.

Solution 8

For small error,
$\displaystyle \delta\boldsymbol\theta\approx2\delta\mathbf q_v.$ (24)
Therefore
$\displaystyle \boxed{ \delta\boldsymbol\theta \approx \begin{bmatrix} 0.010\\ -0.020\\ 0.030 \end{bmatrix}\ \mathrm{rad}. }$ (25)

Solution 9

Choose the equivalent sign with positive scalar part:
$\displaystyle \delta q'=(0.9998,\,-0.010,\,0.005,\,-0.015).$ (26)
Then
$\displaystyle \boxed{ \delta\boldsymbol\theta \approx \begin{bmatrix} -0.020\\ 0.010\\ -0.030 \end{bmatrix}\ \mathrm{rad}. }$ (27)

Solution 10

The squared norm of the first order approximation is
$\displaystyle \left\lVert \begin{bmatrix} 1\\ [1mm]\frac12\delta\boldsymbol\theta \end{bmatrix}\right\rVert^2 =1+\frac14\lVert\delta\boldsymbol\theta\rVert^2.$ (28)
Hence the departure from unit norm is second order in the small rotation magnitude.

Solution 11

If $q_d=-q$, then
$\displaystyle q_dq^*=-(qq^*)=-1.$ (29)
The quaternions $+1$ and $-1$ both represent the identity physical rotation. Thus the relative quaternion is an alternate representative of zero attitude error, not a $360^\circ$ control correction. For a local error model one would flip the sign to $+1$.

Solution 12

To first order,
$\displaystyle \boxed{ \delta\boldsymbol\theta^I =R(q)\delta\boldsymbol\theta^B. }$ (30)
The numerical value cannot be found without the current attitude matrix.

Solution 13

A right error convention requires correction on the right:
$\displaystyle q^+=\widehat q\delta q.$ (31)
The proposed update multiplies on the left and therefore applies a left error correction while the estimator covariance and Jacobians describe a right error.

Solution 14

Euler angle coordinates depend on the chosen rotation sequence and are nonlinear coordinates on orientation space. Subtracting two angle triples does not, in general, produce the axis and angle of the finite relative rotation. The exact relative rotation should first be formed with quaternions or matrices.

Solution 15

For a unit error quaternion,
$\displaystyle \delta q_w=\cos\frac{\delta\theta}{2}.$ (32)
A scalar part near zero therefore corresponds to an attitude error near $180^\circ$. At that point the choices $\delta q$ and $-\delta q$ are equally valid principal representatives, so the sign can change under arbitrarily small perturbations.

Solution 16

The vector part is parallel to
$\displaystyle \widehat{\mathbf u}_e=\frac{1}{\sqrt3}(1,1,1).$ (33)
Since
$\displaystyle 0.9238795=\cos22.5^\circ, \qquad 0.3826834=\sin22.5^\circ,$ (34)
the exact error angle is
$\displaystyle \boxed{\delta\theta=45^\circ.}$ (35)
The first order estimate would be
$\displaystyle \delta\boldsymbol\theta \approx \frac{0.7653668}{\sqrt3} \begin{bmatrix}1\\ 1\\ 1\end{bmatrix}\ \mathrm{rad}.$ (36)
Its magnitude is about $0.765$ rad, whereas the exact angle is $\pi/4\approx0.785$ rad. The approximation is already noticeably imperfect; for a $45^\circ$ error the exact quaternion should be retained.

License

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



"example of relative attitude and error quaternions" is owned by bloftin.
(view preamble)
View style:
Keywords:  quaternion, relative attitude, error quaternion, attitude error, multiplicative error, small angle approximation, exercises, worked solutions

This object's parent.

Cross-references: covariance, identity, magnitude, matrix, norm, vector, error quaternion, scalar, quaternions, section, relative attitude and error quaternions

This is version 1 of example of relative attitude and error quaternions, born on 2026-08-24.
Object id is 1108, canonical name is ExampleOfRelativeAttitudeAndErrorQuaternions.
Accessed 5 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 example | add (any)