This documentation was generated with the assistance of AI. Please report any inaccuracies.
Classes: INSLooselyCoupledKalmanFilteredEstimator, INSGNSSLooselyCoupledKalmanFilteredEstimator,
INSGNSSTightlyCoupledKalmanFilteredEstimator (see the Class Reference table at the end of this page
for Javadoc and source links).
What these classes solve
A navigator on its own drifts, because IMU errors are integrated along with
the true motion. The Kalman filtered estimators in com.irurueta.navigation.inertial bound that drift
by combining the inertial navigation solution with external position/velocity information, following the
closed-loop error-state filters of Groves chapter 14 and its Loosely_coupled_INS_GNSS.m /
Tightly_coupled_INS_GNSS.m companion scripts (see [book-groves]).
Class
Aiding information
Fed through
INSLooselyCoupledKalmanFilteredEstimator
An ECEF position and velocity fix computed elsewhere.
update(…) for IMU samples, updatePositionAndVelocity(…) for fixes.
INSGNSSLooselyCoupledKalmanFilteredEstimator
GNSS measurements, solved internally by least squares into a position and velocity fix.
updateBodyKinematics(…) for IMU samples, updateMeasurements(…) for GNSS measurements.
INSGNSSTightlyCoupledKalmanFilteredEstimator
Raw GNSS pseudo-ranges and pseudo-range rates, used directly as the Kalman measurement.
updateBodyKinematics(…) for IMU samples, updateMeasurements(…) for GNSS measurements.
How the estimators work
All three estimators follow the same two-rate scheme:
Every IMU sample is integrated. Each sample is corrected with the currently estimated accelerometer
and gyroscope biases and integrated with ECEFInertialNavigator over the interval elapsed since the
previous sample, regardless of the epoch interval. The estimator therefore always holds the
INS-propagated solution. The first sample only sets the time reference, and a sample whose timestamp is
not greater than the previous one is ignored (the method returns false).
A Kalman filter epoch is only run when a fix or GNSS measurements arrive. The INS-propagated solution is
the predicted state, the fix (or the GNSS measurements) is the measurement at its own timestamp, and the
time elapsed since the previous epoch is the propagation interval. The resulting closed-loop correction
is applied to the INS solution and to the estimated biases.
flowchart TD
IMU["IMU sample at its timestamp"] --> C["Correct with estimated biases"]
C --> N["ECEFInertialNavigator:\nintegrate since previous sample"]
N --> S["INS-propagated solution\n(position, velocity, attitude)"]
FIX["Fix or GNSS measurements\nat their timestamp"] --> G{"At least one epoch interval\nsince previous Kalman epoch?"}
G -->|no| X["Ignored, returns false"]
G -->|yes| K["Kalman filter epoch"]
S -->|predicted state| K
K -->|closed-loop correction| S
K --> B["Updated bias estimates"]
B --> C
The epoch interval (setEpochInterval(…), or the matching constructor argument) is the minimum time
between two Kalman filter epochs. A fix or a set of measurements is ignored when it is older than, or
less than one epoch interval after, the previous epoch; one arriving exactly one epoch interval later is
accepted (up to the rounding error of the timestamps). The epoch interval does not limit the rate of the
IMU samples.
The first Kalman filter epoch propagates the covariance over the time elapsed since the first IMU sample.
IMU samples provided before the first fix or GNSS measurements are integrated too, so attitude changes
before position and velocity are initialised are kept.
The error-state Kalman filter
The filter does not estimate the navigation solution directly. It estimates the errors of the INS-propagated
solution and feeds them back to it (closed-loop correction). The equation numbers below are those of
[book-groves] quoted by the comments of INSLooselyCoupledKalmanEpochEstimator
and INSTightlyCoupledKalmanEpochEstimator; the symbols are restated here in their own notation.
where is the attitude error of the body-to-ECEF rotation (small rotation vector, rad),
and are the ECEF velocity (m/s) and position (m) errors, and
, are the accelerometer (m/s2) and gyroscope (rad/s) biases. The tightly coupled
filter (INSTightlyCoupledKalmanState, NUM_PARAMS = 17) appends two GNSS receiver clock states:
with the receiver clock offset expressed in metres and the clock drift
in metres per second.
Because every epoch is followed by a closed-loop correction, the error states are reset to zero after each
update, so the predicted error state is zero (Groves 3.14). The only exception is the tightly coupled clock pair,
which is carried across epochs and predicted as and
.
The initial covariance is diagonal and built by INSLooselyCoupledKalmanInitializer /
INSTightlyCoupledKalmanInitializer from the initial attitude, velocity, position, accelerometer-bias,
gyroscope-bias (and clock offset and drift) uncertainties, each squared.
Propagation: system matrix and process noise
For a propagation interval (seconds since the previous Kalman epoch), the first-order transition matrix
(Groves 14.50) is the identity plus the following non-zero blocks, with rows and columns ordered as in the state
vector:
Here is the skew-symmetric matrix of the Earth rotation
rate, the current body-to-ECEF attitude of the Kalman state, the
bias-corrected specific force of the last IMU sample, the gravity at the current
position (ECEFGravityEstimator) and the geocentric radius at the previous latitude (Groves 2.137,
using the WGS84 equatorial radius and eccentricity). The block in row 2 / column 3 feeds position error into velocity
error through the gravity gradient, and the block integrates velocity error into position
error. The tightly coupled matrix is extended with an identity block for the clock states and
one extra element, , that integrates drift into offset.
The process noise is approximated (Groves 14.82) by a diagonal matrix built from the power spectral densities of
INSLooselyCoupledKalmanConfig / INSTightlyCoupledKalmanConfig:
where is the gyroscope noise PSD (rad2/s), the accelerometer noise PSD (m2/s3),
the accelerometer bias random-walk PSD (m2/s5), the gyroscope bias random-walk PSD
(rad2/s3), and, for the tightly coupled filter only, the clock phase PSD (m2/s) and
the clock frequency PSD (m2/s3). The position-error rows have no process noise.
The code propagates the covariance with the trapezoidal form of Groves 3.46, which averages the noise between the
start and the end of the interval, instead of adding once:
Loosely coupled measurement model
The aiding data are an ECEF position and velocity (supplied directly by
INSLooselyCoupledKalmanFilteredEstimator, or solved from GNSS measurements by
INSGNSSLooselyCoupledKalmanFilteredEstimator). The innovation is the difference between the GNSS and the
INS-propagated solution; the code assumes a zero lever arm between the GNSS antenna and the IMU (Groves 14.102):
Since the filter states are errors of the INS solution (estimate minus truth), the measurement matrix of the
6 x 15 problem (Groves 14.115) only selects the velocity and position error states with a negative sign:
with the first block row acting on position and the second on velocity. All six components are assumed independent
with the standard deviations from the configuration:
Tightly coupled measurement model
With n satellites the measurement vector holds n pseudo-ranges followed by n pseudo-range rates, so
is . For satellite the filter predicts the measurements from the
INS-propagated position and velocity :
Approximate range , where is the satellite
position.
The Earth rotates while the signal travels, so the satellite position is rotated by the small frame rotation
(Groves 8.36, with the speed of light).
Predicted pseudo-range, with the propagated clock offset (Groves 9.165):
Line of sight and predicted pseudo-range rate
(Groves 9.165):
The innovation (Groves 14.119) is the measured minus the predicted value, for each satellite and each measurement
type:
and the measurement matrix (Groves 14.126) projects the position error onto each line of sight for the
pseudo-ranges, the velocity error for the pseudo-range rates, and picks the clock states:
Measurement noise is diagonal, with one variance for all pseudo-ranges and another for all pseudo-range rates:
.
Update and closed-loop correction
Both filters then apply the standard Kalman update, with the matrices of the chosen model:
The estimated errors are then removed from the INS solution (Groves 14.7 to 14.9). Attitude is corrected with
the small-angle rotation of the estimated attitude error, velocity and position are decreased by their estimated
errors, and the bias estimates are increased by the estimated bias states:
In the tightly coupled filter the receiver clock offset and drift are not corrected but replaced by the updated
clock states. The corrected attitude is orthonormal only to first order, so
INSGNSSTightlyCoupledKalmanFilteredEstimator re-orthonormalizes it after each epoch. The updated biases are used
to correct the next IMU samples before they are integrated, which closes the loop.
Block diagram
flowchart LR
IMU["IMU sample\n(f, ω)"] --> BC["Subtract estimated\nbiases"]
BC --> INS["Inertial navigator\n(attitude, velocity, position)"]
INS --> PRED["INS-propagated\nsolution"]
PRED --> INNOV
GNSS["Fix (loose) or\npseudo-ranges and rates (tight)"] --> INNOV["Innovation δz\n(measurement minus prediction)"]
PHI["Φ, Q' from f, attitude,\nposition and τ"] --> COV["Covariance propagation\nP⁻ = Φ(P + Q'/2)Φᵀ + Q'/2"]
COV --> KG["Kalman gain K\nfrom H, R"]
KG --> UPD["State update\nx = K δz\nP = (I - K H) P⁻"]
INNOV --> UPD
UPD -->|"attitude, velocity,\nposition errors"| PRED
UPD -->|"bias errors"| BC
UPD -->|"clock offset, drift\n(tight only)"| INNOV
Usage loop
Feed every IMU sample as it arrives, and every fix or set of GNSS measurements at the timestamp it is
valid for. Timestamps are expressed in seconds (or as Time instances) on a common time base.
A fix or a set of measurements is compared against the INS solution at the time of the last provided IMU
sample: the solution is not advanced or moved back to the timestamp of the fix. Provide each fix right
after the IMU sample whose timestamp is closest to it; otherwise the distance travelled between both
timestamps is attributed to INS errors (1.5 m for a 50 ms offset at 30 m/s).
INSLooselyCoupledKalmanFilteredEstimator
// gyro/accelerometer noise and bias PSDs, and fix position/velocity noise standard deviations
INSLooselyCoupledKalmanConfig config = new INSLooselyCoupledKalmanConfig(
gyroNoisePSD, accelerometerNoisePSD, accelerometerBiasPSD, gyroBiasPSD,
positionNoiseSD, velocityNoiseSD);
double epochInterval = 1.0; // minimum seconds between Kalman filter epochs
INSLooselyCoupledKalmanFilteredEstimator estimator =
new INSLooselyCoupledKalmanFilteredEstimator(config, epochInterval);
// initial position, velocity and attitude; the instance is kept and updated in place
estimator.setFrame(initialFrame);
// on every IMU sample (e.g. at 100 Hz)
estimator.update(bodyKinematics, imuTimestamp);
// on every position and velocity fix (e.g. at 1 Hz), at the timestamp of the fix
boolean epochRun = estimator.updatePositionAndVelocity(ecefPosition, ecefVelocity, fixTimestamp);
ECEFFrame solution = estimator.getFrame(); // corrected INS solution
INSLooselyCoupledKalmanState state = estimator.getState(); // solution, biases and covariance
Without fixes this estimator behaves as a pure inertial navigator. getLastKinematicsTimestamp() returns the
timestamp of the last integrated IMU sample and getLastStateTimestamp() the timestamp of the last Kalman
filter epoch.
propagate(…) is deprecated on this class. It no longer runs a Kalman filter epoch (an epoch needs
a measurement): it only initializes or synchronizes the Kalman state with the INS solution and always
returns false. Use updatePositionAndVelocity(…) instead.
INSGNSSLooselyCoupledKalmanFilteredEstimator
INSGNSSLooselyCoupledKalmanFilteredEstimator estimator =
new INSGNSSLooselyCoupledKalmanFilteredEstimator(config, epochInterval);
// on every IMU sample
estimator.updateBodyKinematics(bodyKinematics, imuTimestamp);
// on every set of GNSS measurements, at the timestamp they were taken
if (INSGNSSLooselyCoupledKalmanFilteredEstimator.isUpdateMeasurementsReady(gnssMeasurements)) {
estimator.updateMeasurements(gnssMeasurements, gnssTimestamp);
}
GNSSEstimation estimation = estimator.getEstimation();
INSLooselyCoupledKalmanState state = estimator.getState();
The measurements are first solved by least squares into a position and velocity solution. The first
solution initializes the position and velocity of the INS solution; from then on each solution is used
as the Kalman measurement at the timestamp of the measurements — it is not navigated forward in time.
propagate(…) does not run an epoch and always returns false.
INSGNSSTightlyCoupledKalmanFilteredEstimator
INSGNSSTightlyCoupledKalmanFilteredEstimator estimator =
new INSGNSSTightlyCoupledKalmanFilteredEstimator(tightlyCoupledConfig, epochInterval);
// on every IMU sample
estimator.updateBodyKinematics(bodyKinematics, imuTimestamp);
// on every set of GNSS measurements, at the timestamp they were taken
if (INSGNSSTightlyCoupledKalmanFilteredEstimator.isUpdateMeasurementsReady(gnssMeasurements)) {
estimator.updateMeasurements(gnssMeasurements, gnssTimestamp);
}
GNSSEstimation estimation = estimator.getEstimation();
INSTightlyCoupledKalmanState state = estimator.getState();
Here tightlyCoupledConfig is an INSTightlyCoupledKalmanConfig. The least-squares GNSS solution is only
used to initialize position, velocity and receiver clock offset and drift until the Kalman filter state
exists; IMU samples start being integrated once that first solution is available. Afterwards
updateMeasurements(…) runs the Kalman filter epoch directly on the INS-propagated state, using the
pseudo-ranges and pseudo-range rates as the measurement, and the attitude is re-orthonormalized after each
epoch. propagate(…) only runs an epoch for measurements that were provided before the estimator was
ready to propagate (for example before its configuration was set); measurements already consumed by an
epoch are never used twice.
Both INS/GNSS estimators report failures of the inertial navigation or of the filter as INSGNSSException.
Class Reference
Javadoc and source links for the classes used in the examples above: