package
Estimation.StrapdownINS.ESKF
15-state aided strapdown inertial-navigation error-state Kalman filter
Use Estimator
for sampled sensor fusion, or the prediction and correction functions for
an explicit replay. The optional stationary-IMU mode requires a trustworthy
vehicleAtRest signal; it does not detect rest. Optional
square-root covariance changes numerical representation and has additional
runtime and storage costs. Validate each mode for the intended vehicle.
The sampled step boundary delegates initialization and
state advancement to bounded functions. Keep those boundaries intact:
expanding prediction, recovery and all aiding branches into one dispatcher
can exceed a native compiler's function-size limit and silently select a
much slower interpreter. Re-seeding remains opt-in and retains the same
state, covariance and recovery-reporting contract.
The nominal extended pose is propagated by
LieGroups.SE23.Quat.exp_mixed. Covariance lives in a
body-local right-perturbation error ordered as position, velocity,
attitude, gyroscope bias, and accelerometer bias.
Over one IMU interval the corrected IMU input is held constant. The locally linearized error transition is discretized with a third-order matrix exponential polynomial; the process-noise integral is evaluated by Simpson quadrature. Both operations retain full cross-axis covariance and use matrix expressions rather than three scalar filters.
This is an aided strapdown INS ESKF, not a strict invariant Kalman filter. The additive bias states are not part of a group-affine, exactly log-linear augmented system. The local pose error and manifold retraction are geometric implementation choices inside an otherwise ordinary error-state EKF.
The convention and inertial error dynamics follow T. D. Barfoot,
State Estimation for Robotics, 2nd-edition draft, Section 9.4:
the nominal state is right-perturbed, so the local error is
T_hat^-1 T. In the tangent ordering used here, Barfoot's
position, velocity, attitude, gyro-bias, and accelerometer-bias blocks map
directly to continuousTransition and
noiseInputMatrix. Prediction implements
P+ = Phi P Phi' + integral(Phi G Q G' Phi'). Correction uses
an arbitrary-gain Joseph update followed by the right-Jacobian reset that
transports covariance to the newly injected nominal-state tangent.
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| constant | TangentLength | Integer | = 15 | |
| constant | ProcessNoiseLength | Integer | = 12 | |
| constant | RecoveryEnvelope_m | Real | = 100.0 | |
| constant | FiniteMagnitudeLimit | Real | = 1.0e30 | |
| constant | MinimumSeedQuaternionNorm | Real | = 1.0e-3 | |
| constant | MaxAttitudeCorrection_rad | Real | = 0.15 |
Members
| Name | Kind | Description |
|---|---|---|
| TangentVector | type | |
| Covariance | type | |
| NominalState | record | Nominal navigation state |
| State | record | Nominal state and full local-error tangent covariance |
| VarianceLimits | record | Mission-envelope upper bounds on the tangent variances |
| Tuning | record | Fixed filter tuning held constant across every estimator tick |
| initialize | function | Initialize the geometric error-state filter |
| conditionAlignment | function | Condition the initial tangent covariance on the gravity vector used for alignment |
| seedPositionVariances | function | Bound an aiding position seed's uncertainty in the local tangent frame |
| continuousTransition | function | Continuous local right-perturbation error dynamics for held IMU input |
| noiseInputMatrix | function | Map continuous IMU and bias noise into the tangent |
| processNoiseMatrix | function | Assemble the full continuous process covariance |
| discreteTransition | function | Third-order discretization of a held continuous tangent transition |
| heldInputJacobian | function | Transport one held gyroscope/accelerometer sample into the local error |
| discreteProcessCovariance | function | Simpson approximation of the exact held-input covariance integral |
| predictNominal | function | Propagate the nominal state with the existing mixed SE_2(3) exponential |
| predictPreintegrated | function | Apply one closed-form IMU preintegral and its exact local transition |
| predictStationary | function | Propagate a declared stationary vehicle with random-walk biases |
| retrodict | function | Retrodict the nominal state with one held IMU sample |
| predict | function | Mixed SE_2(3) nominal and local error covariance prediction |
| limitCovariance | function | Bound diagonal covariance growth to mission-envelope variance limits |
| inflateCovariance | function | Ramp position and velocity covariance toward the mission envelope |
| holdCovariance | function | Grow covariance by one interval of process noise with the state held |
| inject | function | Right-inject a local tangent correction |
| SemiDirectBias | package | Experimental 15-state semi-direct bias correction geometry |
| Visual | package | Visual aiding in the navigation error coordinates |
| reseed | function | Re-seed position and velocity from a fresh anchor sample after a sustained rejection, restoring their covariance blocks to the initial variances |
| conjugateReset | function | Conjugate a covariance by the block-diagonal reset Jacobian diag(J, I) |
| considerGainProjector | function | Consider-projector for the rotation rows of a Kalman gain |
| constrainGain | function | Project considered states and limit the finite attitude correction |
| correctLinear | function | Vectorized Joseph-form correction in the local right-error tangent space |
| correctMocap | function | Correct position and attitude from motion capture |
| correctGps | function | Jointly correct GPS position and velocity |
| correctGpsPosition | function | Correct world position from GPS |
| correctGpsVelocity | function | Correct world velocity from GPS Doppler velocity |
| correctMagnetometer | function | Correct heading or a calibrated magnetic vector in the local tangent |
| correctPseudoPosition | function | Fuse a synthetic measurement that the vehicle is still at its held position |
| correctZeroVelocity | function | Fuse a synthetic measurement that the vehicle is not moving |
| correctStationaryImu | function | Observe gyro bias and coupled gravity/accelerometer bias during declared rest |
| correctBarometer | function | Correct vertical position from pressure altitude after bias compensation |
| opticalFlowRangeJacobian | function | Nadir ray-to-plane range and Jacobian in the ESKF right-error tangent |
| correctOpticalFlow | function | Fuse image angular rates with co-timed range uncertainty |
| navigationEstimate | function | Publish a canonical estimate with consistent attitude representations |
| nominalStateFinite | function | True when every published nominal state component is finite |
| initializeTick | function | Initialize and condition a navigation state without expanding the step dispatcher |
| predictTick | function | Predict or hold one IMU interval and bound its covariance |
| correctAbsoluteAidingTick | function | Select and fuse one absolute aiding sample without expanding the dispatcher |
| TickUpdates | package | Bounded gated state updates for the sampled dispatcher |
| advanceStateTick | function | Advance the state through prediction, recovery and aiding as one bounded stage |
| step | function | Predict, select absolute aiding, and fuse independent flow, height and heading |
| Estimator | block | Sampled aided strapdown inertial-navigation ESKF |
| withCovarianceRoot | function | Set the authoritative root and its dense diagnostic |
| predictCovariance | function | Propagate covariance in its selected representation |
| limitStateCovariance | function | Bound covariance without changing its representation |
| inflateStateCovariance | function | Inflate covariance in its selected representation |
| copyState | function | Copy a filter state and its covariance representation |
| withDenseCovariance | function | Replace a dense covariance and preserve the state |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
package ESKF
"15-state aided strapdown inertial-navigation error-state Kalman filter"
constant Integer TangentLength = 15;
constant Integer ProcessNoiseLength = 12;
constant Real RecoveryEnvelope_m = 100.0;
// Magnitude above which a Real is treated as not finite. Exactly
// representable in binary32 (max ~3.4e38) and binary64, so the same
// source means the same thing in simulation and in generated flight
// code, and 1e30 is ~20 orders of magnitude beyond any residual,
// position, or velocity this filter can legitimately see. The test
// `abs(x) < FiniteMagnitudeLimit` is false for NaN and for +/-Inf
// alike, so one comparison per element covers both.
constant Real FiniteMagnitudeLimit = 1.0e30;
constant Real MinimumSeedQuaternionNorm = 1.0e-3;
constant Real MaxAttitudeCorrection_rad = 0.15;
type TangentVector = Real[15]
"{position,velocity,attitude,gyro bias,accelerometer bias} error";
type Covariance = Real[15, 15];
annotation(Documentation(info = "<html>
<p>Use <a href=\"modelica://Estimation.StrapdownINS.ESKF.Estimator\">Estimator</a>
for sampled sensor fusion, or the prediction and correction functions for
an explicit replay. The optional stationary-IMU mode requires a trustworthy
<code>vehicleAtRest</code> signal; it does not detect rest. Optional
square-root covariance changes numerical representation and has additional
runtime and storage costs. Validate each mode for the intended vehicle.</p>
<p>The sampled <code>step</code> boundary delegates initialization and
state advancement to bounded functions. Keep those boundaries intact:
expanding prediction, recovery and all aiding branches into one dispatcher
can exceed a native compiler's function-size limit and silently select a
much slower interpreter. Re-seeding remains opt-in and retains the same
state, covariance and recovery-reporting contract.</p>
<p>The nominal extended pose is propagated by
<code>LieGroups.SE23.Quat.exp_mixed</code>. Covariance lives in a
body-local right-perturbation error ordered as position, velocity,
attitude, gyroscope bias, and accelerometer bias.</p>
<p>Over one IMU interval the corrected IMU input is held constant. The
locally linearized error transition is discretized with a third-order matrix
exponential polynomial; the process-noise integral is evaluated by
Simpson quadrature. Both operations retain full cross-axis covariance and
use matrix expressions rather than three scalar filters.</p>
<p>This is an aided strapdown INS ESKF, not a strict invariant Kalman
filter. The additive bias states are not part of a group-affine, exactly
log-linear augmented system. The local pose error and manifold retraction
are geometric implementation choices inside an otherwise ordinary
error-state EKF.</p>
<p>The convention and inertial error dynamics follow T. D. Barfoot,
<a href=\"https://asrl.utias.utoronto.ca/~tdb/bib/barfoot_ser24.pdf\">
<i>State Estimation for Robotics</i>, 2nd-edition draft</a>, Section 9.4:
the nominal state is right-perturbed, so the local error is
<code>T_hat^-1 T</code>. In the tangent ordering used here, Barfoot's
position, velocity, attitude, gyro-bias, and accelerometer-bias blocks map
directly to <code>continuousTransition</code> and
<code>noiseInputMatrix</code>. Prediction implements
<code>P+ = Phi P Phi' + integral(Phi G Q G' Phi')</code>. Correction uses
an arbitrary-gain Joseph update followed by the right-Jacobian reset that
transports covariance to the newly injected nominal-state tangent.</p>
</html>"));
end ESKF;