|
A gyroscope does not directly measure attitude. It measures angular motion. An inertial navigation or attitude system must integrate that angular motion over time to update an orientation state.
Quaternions are particularly well suited to this task because a unit quaternion can be updated by a finite incremental rotation without introducing an Euler Angle singularity.
This article develops numerical propagation for the PhysicsLibrary passive attitude quaternion
 |
(1) |
which maps coordinates from an inertial or reference frame into a body frame .
For body resolved angular velocity,
 |
(2) |
Over one sample interval, the exact constant rate update is
 |
(3) |
where
 |
(4) |
Thus the numerical implementation must preserve three convention facts:
- the body frame increment has a negative quaternion vector part;
- the body resolved increment multiplies on the left;
- the propagated quaternion maps reference coordinates into body coordinates.
PhysicsLibrary uses Hamilton multiplication,
with reversed products changing sign.
Quaternion components are displayed scalar first:
 |
(5) |
The passive vector transformation is
 |
(6) |
For a positive frame rotation through angle about unit axis
,
 |
(7) |
The corresponding DCM satisfies
 |
(8) |
A practical body mounted gyroscope measurement can be modeled as
 |
(9) |
where
is gyroscope bias and
represents measurement noise.
Given a current bias estimate
, form
 |
(10) |
For a simple zero order hold over sample interval , the corresponding body resolved delta angle is
 |
(11) |
If the IMU itself supplies a delta angle measurement, that integrated quantity should normally be used directly after the appropriate bias correction and manufacturer specified compensation rather than unnecessarily converting it to a rate and integrating it again.
Let
 |
(12) |
If
define the unit increment axis
 |
(13) |
The exact passive body increment is
 |
(14) |
Equivalently,
 |
(15) |
In scalar first array notation,
 |
(16) |
The limiting value at
is the identity quaternion.
During sample , the old attitude maps
The measured body increment maps
The complete passive frame chain is therefore
PhysicsLibrary quaternion frame composition gives
 |
(17) |
Thus
 |
(18) |
The side of multiplication is a consequence of the declared frame map, not a change to Hamilton multiplication.
The following diagram summarizes the passive IMU attitude state propagation chain.
Figure. A body mounted IMU supplies angular motion and specific force. Gyroscope bias is removed, a passive incremental quaternion is formed, and the increment left multiplies the inertial to body attitude quaternion. The updated or appropriately time centered attitude is then used to transform body specific force into the navigation or inertial frame. A multiplicative estimator may carry a three component local error state while the nominal orientation remains a full unit quaternion.
For sufficiently small
,
and
Therefore
 |
(19) |
The corresponding first order update is
 |
(20) |
This is useful for analysis and for sufficiently small sample increments, but the exact trigonometric increment is inexpensive and generally preferable when the delta angle is already available.
Starting from
a forward Euler step is
 |
(21) |
If
then
 |
(22) |
Thus forward Euler is equivalent to using the first order incremental quaternion without normalization.
The exact quaternion derivative is tangent to the unit quaternion three sphere.
A forward Euler method advances along the tangent line:
For unit ,
Therefore
Hence
 |
(23) |
for a nonzero rate and nonzero step.
The norm defect is second order for one step but accumulates during repeated propagation.
A common numerical correction is
 |
(24) |
Normalization restores the unit quaternion constraint and is generally appropriate after an approximate propagation method or after finite precision arithmetic.
However, normalization does not make an approximate integration method identical to the exact exponential update. It restores the manifold constraint but does not reconstruct higher order phase terms omitted by the integrator.
For an exact unit incremental quaternion multiplying an exactly unit state, the product is analytically unit:
 |
(25) |
Practical software may still normalize occasionally or every sample to control floating point drift.
Directly evaluating
can lose numerical quality when
is extremely small.
Its Taylor expansion is
 |
(26) |
Similarly,
 |
(27) |
A robust implementation may switch to such series below a small threshold.
A higher order integrator can be applied directly to
 |
(28) |
For classical fourth order Runge Kutta,
 |
(29) |
 |
(30) |
 |
(31) |
 |
(32) |
and
 |
(33) |
The resulting quaternion should be normalized.
Runge Kutta methods are useful when an angular rate model can be evaluated inside the interval. If an IMU supplies only one integrated delta angle per sample, the exact finite incremental quaternion is often a more natural attitude update.
Suppose
and the body rotates at constant positive rate
Over one interval,
The increment is
 |
(34) |
After equal intervals,
 |
(35) |
At a total positive frame rotation of ,
 |
(36) |
This is the same passive convention diagnostic used throughout the preceding PhysicsLibrary quaternion series.
Many inertial sensors report integrated angular increments directly:
 |
(37) |
Such an output may already incorporate internal high rate sampling and manufacturer specific coning processing.
If the bias estimate is expressed as an angular rate and is approximately constant over the sample, a simple correction is
 |
(38) |
The corrected delta angle is then converted directly to the passive incremental quaternion.
The device documentation must be checked to determine whether its reported increment is raw, internally compensated, expressed in a beginning sample frame, expressed in an ending sample frame, or uses another convention.
If an uncompensated constant gyro bias has magnitude , then for a simple single axis case the attitude error grows approximately as
 |
(39) |
For example, a bias of
accumulates approximately
of angle error in ten minutes.
This simple calculation explains why accurate bias initialization, online bias estimation, temperature modeling, and external aiding are important in inertial systems.
Consider two small chronological body frame increments
followed by
The passive incremental quaternions are
and
Because body increments left multiply, the chronological combined update is
 |
(40) |
Expand the increment product through second order:
The vector part of the last product is
Matching the passive first order form
gives the leading equivalent physical rotation vector
 |
(41) |
The cross product term is the leading coning contribution.
If the body rotates alternately about different axes during a sample interval, the vector sum of the measured increments is not generally the exact net rotation.
The missing information appears first through cross products of successive angular increments.
High accuracy strapdown inertial algorithms therefore use multiple subsamples or compensated delta angles to account for noncommutativity.
A simple one sample exponential update is exact for a constant rotation vector over the interval. It is not automatically exact for arbitrary high frequency motion occurring within that interval.
If an IMU already reports a coning compensated delta angle, applying an additional naive coning correction may double count the effect.
The unit quaternions
and
represent the same physical orientation.
A numerical quaternion time history may therefore contain equivalent samples with alternating overall signs.
For plotting, interpolation, finite differencing, or optimization, choose the representative nearest the previous sample.
If
 |
(42) |
replace
 |
(43) |
This does not change the physical attitude.
Sign continuity is a representation choice. It is distinct from quaternion normalization and from selecting the principal error quaternion in a local attitude error calculation.
An accelerometer rigidly attached to the body reports specific force resolved in body coordinates:
 |
(44) |
The passive attitude quaternion maps inertial coordinates into body coordinates, so the inverse DCM maps body coordinates back into inertial coordinates:
 |
(45) |
Since
we have
 |
(46) |
The equivalent quaternion sandwich is
 |
(47) |
This inversion is important: the quaternion used for attitude propagation maps
, while navigation mechanization often needs to rotate a measured body vector
.
In a simple inertial frame model,
 |
(48) |
and
 |
(49) |
In a rotating navigation frame, Earth rotation, transport rate, Coriolis terms, and the chosen gravity model must also be included.
A typical strapdown propagation cycle is therefore:
- read gyroscope and accelerometer information;
- correct the gyroscope data for estimated bias;
- form or accept a corrected body delta angle;
- update the passive attitude quaternion;
- obtain an attitude appropriate to the accelerometer integration time;
- transform specific force from body coordinates into the navigation or inertial frame;
- add gravity and required rotating frame terms;
- integrate velocity and position;
- propagate bias and other estimator states.
Using only the beginning or ending attitude to transform accelerometer data introduces an error when the body rotates appreciably during the sample.
For constant body rate, a midpoint quaternion can be formed as
 |
(50) |
where
 |
(51) |
The corresponding midpoint DCM can then be used for a simple time centered specific force transformation.
High accuracy inertial algorithms develop this idea further through sculling compensation and multiple sample integration.
A navigation filter can propagate the nominal attitude as a full unit quaternion while carrying only three attitude error states.
For example, using the passive small error convention from the preceding article,
 |
(52) |
The nominal quaternion supplies a globally nonsingular orientation representation, while
is a local three component perturbation suitable for linear covariance propagation.
The chosen left or right error definition must remain consistent with the filter Jacobians and the side used for correction injection.
The same small angle expansion appears in two distinct roles.
In direct IMU propagation,
approximates the actual physical incremental rotation during one sample. Its accuracy depends on the size and variation of the sample motion.
In an error state filter,
represents a deliberately local estimation error around a nominal full attitude quaternion.
The nominal vehicle attitude itself may be very large even when the local error state is small.
These two uses should not be conflated.
Two common operations have different purposes.
Normalization,
restores the unit norm constraint.
Sign continuity,
when needed, chooses one of two equivalent quaternion representatives.
Neither operation substitutes for an accurate attitude integration method.
Suppose
and
The corrected rate is
 |
(53) |
For
the delta angle is
 |
(54) |
Therefore
 |
(55) |
Numerically,
 |
(56) |
Since the initial attitude is the identity,
 |
(57) |
The forward Euler result is
so
 |
(58) |
Its norm is
 |
(59) |
After normalization,
 |
(60) |
This is close to, but not identical with, the exact exponential result.
A minimal constant rate passive update can be expressed conceptually as:
omega_B = gyro_B - bias_hat_B
dtheta_B = omega_B * dt
a = norm(dtheta_B)
if a is very small:
s = 0.5 - a*a/48
c = 1.0 - a*a/8
else:
s = sin(a/2) / a
c = cos(a/2)
dq = [c, -s*dtheta_B]
q_new = dq * q_old
q_new = q_new / norm(q_new)
if dot(q_new, q_old) < 0:
q_new = -q_new
The product in the line
is the Hamilton product with scalar first semantic components.
Software whose array order is scalar last may use different memory indices without changing the physical equations.
- Using the old inverse attitude convention.
The present PhysicsLibrary state is
not .
- Using a positive vector part for a positive body frame increment.
The passive increment is
- Right multiplying body resolved increments.
For the passive inertial to body state,
- Assuming normalization makes Euler integration exact.
Normalization repairs norm, not truncation error.
- Ignoring gyro bias.
Even a small constant rate bias integrates into a large attitude error over time.
- Applying a simple vector sum to substantial multi axis motion.
Successive rotations do not commute. Coning terms matter.
- Applying coning correction twice.
Determine whether the sensor supplied delta angle already contains internal compensation.
- Using the inertial to body quaternion in the wrong direction for accelerometer data.
Body specific force is transformed to inertial coordinates with on the left and on the right, or with .
- Interpreting quaternion sign flips as attitude jumps.
and represent the same orientation.
- Treating the three component filter attitude error as the nominal attitude itself.
The error vector is local; the nominal quaternion carries the global orientation.
A numerical implementation should be checked against:
- zero angular rate;
- constant positive rotations about
, , and ;
- exact exponential propagation from the identity;
- equality of
with the equivalent DCM increment;
- preservation of unit norm for exact increments;
- expected norm drift for unnormalized forward Euler;
- gyro bias accumulation;
- body increment multiplication on the left;
- sign continuity with
versus ;
- two noncommuting increments and the leading coning term;
- specific force transformation with the inverse attitude map;
- consistency with the passive error state sign from Q12.
The preceding article, Relative Attitude and Error Quaternions, establishes multiplicative left and right errors and the passive local relation
The present article combines that convention with the quaternion kinematics from quaternion kinematics and angular velocity to form sampled IMU attitude propagation.
A separate companion entry, Numerical Quaternion Propagation and IMU Attitude State Integration: Examples, Exercises, and Solutions, provides the Q13E self study problem bank.
Quaternion propagation equations cannot be imported safely without identifying the represented frame map, the resolution of angular velocity, and the quaternion multiplication convention.
Sommer and coauthors provide a modern discussion of convention management. Solà provides a detailed treatment of quaternion kinematics and IMU error state filtering. Titterton and Weston provide a broad engineering treatment of strapdown inertial navigation. Savage develops the classical strapdown attitude integration framework, including coning compensation.
The equations in this entry are translated into the PhysicsLibrary passive inertial to body convention.
- 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 https://www.mdpi.com/2226-4310/5/3/72
- 2
- J. Solà, “Quaternion Kinematics for the Error State Kalman Filter,” arXiv:1711.02508, 2017. arXiv preprint https://arxiv.org/abs/1711.02508
- 3
- D. H. Titterton and J. L. Weston, Strapdown Inertial Navigation Technology, 2nd ed., The Institution of Engineering and Technology, 2004/2005. Engineering reference. IET book page https://shop.theiet.org/strapdn-inertial-navig-t-2ed
- 4
- P. G. Savage, “Strapdown Inertial Navigation Integration Algorithm Design Part 1: Attitude Algorithms,” Journal of Guidance, Control, and Dynamics, vol. 21, no. 1, pp. 19–28, 1998. DOI record https://doi.org/10.2514/2.4228
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative Commons Attribution ShareAlike 4.0 International license.
|