The navigation module in GTSAM provides specialized tools for inertial navigation, GPS integration, and sensor fusion. Here’s an overview of key components organized by category:
Classes¶
Core Navigation Types¶
NavState: Represents the complete navigation state , i.e., attitude, position, and velocity. It also implements the group . See the NavState user guide.
ImuBias: Models constant biases in IMU measurements (accelerometer and gyroscope).
Invariant Kalman Filtering¶
ManifoldEKF: Implements an EKF for states that operate on a differentiable manifold.
LieGroupEKF: Implements an EKF for states that operate on a Lie group with state dependent dynamics.
InvariantEKF: Implements an EKF for states that operate on a Lie group with group composition (state independent) dynamics. See the InvariantEKF user guide.
Attitude Estimation¶
PreintegrationParams: Parameters for IMU preintegration.
PreintegratedRotation: Handles gyroscope measurements to track rotation changes.
AHRSFactor: Attitude and Heading Reference System factor for orientation estimation.
AttitudeFactor: Factors for attitude estimation from reference directions.
IMU Preintegration (See also below)¶
PreintegrationBase: Base class for IMU preintegration classes.
ManifoldPreintegration: Implements IMU preintegration using manifold-based methods as in the Forster et al paper.
TangentPreintegration: Implements IMU preintegration using tangent space methods, developed at Skydio.
LieGroupPreintegration: Integrates IMU increments with the
NavStategroup exponential described by Brossard, Barrau, and Bonnabel.ImuFactor: IMU factor.
CombinedImuFactor: IMU factor with built-in bias evolution.
GNSS Integration¶
GPSFactor: Factor for incorporating GPS position measurements.
BarometricFactor: Incorporates barometric altitude measurements.
PseudorangeFactor: Precise GNSS positioning.
DopplerFactor: GNSS range-rate measurements for velocity and clock-drift estimation.
Magnetic Field Integration¶
MagFactor: Factor for incorporating magnetic field measurements.
MagPoseFactor: Factor for incorporating magnetic field measurements with pose constraints.
Simulation Tools¶
Scenario: Base class for defining motion scenarios.
ConstantTwistScenario: Implements constant twist (angular and linear velocity) motion.
AcceleratingScenario: Implements constantly accelerating motion.
ScenarioRunner: Executes scenarios and generates IMU measurements.
AHRSFactor and Preintegration¶
This section describes the classes primarily involved in Attitude and Heading Reference Systems (AHRS), which rely on gyroscope measurements for orientation preintegration.
The key components are:
Parameters (
PreintegratedRotationParams):Stores parameters specific to gyroscope integration, including gyro noise covariance, optional Coriolis terms, and the sensor’s pose relative to the body frame.
Rotation Preintegration (PreintegratedRotation):
Handles the core logic for integrating gyroscope measurements over time to estimate the change in orientation (
deltaRij).Calculates the Jacobian of this integrated rotation with respect to gyroscope bias (
delRdelBiasOmega).
AHRS Preintegrated Measurements (
PreintegratedAhrsMeasurements):Inherits from
PreintegratedRotationand adds the calculation and storage of the covariance matrix (preintMeasCov_) associated with the preintegrated rotation.This class specifically accumulates the information needed by the
AHRSFactor.
AHRS Factor (AHRSFactor):
A factor that constrains two
Rot3orientation variables and aVector3bias variable using the information accumulated in aPreintegratedAhrsMeasurementsobject.It effectively measures the consistency between the orientation change predicted by the integrated gyro measurements and the orientation change implied by the factor’s connected state variables.
IMU Factor and Preintegration¶
This section describes the classes involved in preintegrating full IMU measurements (accelerometer and gyroscope) for use in factors like ImuFactor and CombinedImuFactor.
The key components are:
Parameters (
...Params):PreintegratedRotationParams: Base parameter class (gyro noise, Coriolis, sensor pose).PreintegrationParams: Adds accelerometer noise, gravity vector, integration noise.PreintegrationCombinedParams: Adds parameters for bias random walk covariance.
Preintegration Interface (
PreintegrationBase):An abstract base class defining the common interface for different IMU preintegration methods. It manages the bias estimate used during integration (
biasHat_) and the time interval (deltaTij_).Defines pure virtual methods for integration, bias correction, and state access.
Preintegration Implementations:
ManifoldPreintegration: Concrete implementation ofPreintegrationBase. Integrates directly on theNavStatemanifold, storing the result as aNavState. Corresponds to Forster et al. RSS 2015.TangentPreintegration: Concrete implementation ofPreintegrationBase. Integrates increments in the 9D tangent space ofNavState, storing the result as aVector9.LieGroupPreintegration: Specializes the manifold implementation by applying increments with theNavStateexponential and by using the corresponding nonlinear group bias correction. It stores the result as aNavState.
Preintegrated Measurements Containers:
PreintegratedImuMeasurements: Stores the result of standard IMU preintegration along with its 9x9 covariance (preintMeasCov_).PreintegratedCombinedMeasurements: Similar, but designed for theCombinedImuFactor. Stores the larger 15x15 covariance matrix (preintMeasCov_) that includes correlations with the bias terms.
IMU Factors (
...Factor):ImuFactor: A 5-way factor connecting previous pose/velocity, current pose/velocity, and a single (constant during the interval) bias estimate. Does not model bias evolution between factors.
ImuFactor2: A 3-way factor connecting previous
NavState, currentNavState, and a single bias estimate. Functionally similar toImuFactorbut uses the combinedNavStatetype.CombinedImuFactor: A 6-way factor connecting previous pose/velocity, current pose/velocity, previous bias, and current bias. Includes a model for bias random walk evolution between the two bias states.
Important notes¶
The compiled
DefaultPreintegrationTypeused byImuFactors andPreintegrated*Measurementsis selected by two CMake options:GTSAM_LIEGROUP_PREINTEGRATION=ONselectsLieGroupPreintegrationand takes precedence if both options are enabled.Otherwise,
GTSAM_TANGENT_PREINTEGRATION=ON(the default) selectsTangentPreintegration.With both options disabled,
ManifoldPreintegrationis used. Select this backend for the implementation from Forster et al. (2017).
If you wish to use any preintegration type other than the default, you must template your PIMs and factors on the desired preintegration type using the template-supporting classes
PreintegratedImuMeasurementsT,ImuFactorT,ImuFactor2T,PreintegratedCombinedMeasurementsT, orCombinedImuFactorT.Named backend selection is a C++ template API. Python and MATLAB expose only the aliases selected when GTSAM is compiled.
NavStatestores tangent blocks in(R,p,v)order, whereas Brossard et al. write the matrix in(R,v,p)order. Translate the position and velocity blocks when comparing equations.Lie-group integration does not change the chart used by optimization.
LieGroupPreintegrationapplies IMU increments withNavState::expmap, whileNavState::retractandlocalCoordinatesretain GTSAM’s component-wise optimization chart.omegaCoriolisis the angular velocity of the navigation frame, expressed in navigation-frame coordinates in radians per second. When it is set,PreintegrationBase::predictand AHRS prediction use the exact rotating-Earth transition from Brossard, Barrau, and Bonnabel rather than an additive Coriolis approximation. The covariance recursion is unchanged because Earth rotation changes prediction and residual assembly, not the preintegrated IMU measurement.For , GTSAM evaluates the exact transition with stable SO(3) kernels. In GTSAM’s kernel conventions, Brossard’s position term is ; using
DexpFunctor::Gamma()alone would have the wrong small-angle coefficients. AHRS uses the corresponding exact attitude law .use2ndOrderCoriolisremains inPreintegrationParamsand its serialized layout for compatibility, but it is ignored: the exact model is used for every nonzeroomegaCoriolis.NavState::coriolisandPreintegratedRotation::integrateCoriolisare retained as deprecated legacy helpers and are no longer used internally.n_gravitymust be the gravity vector consistent with the chosen navigation-frame origin. If a local frame is translated, absorb the constant centrifugal contribution associated with that origin shift inton_gravity.Using the combined IMU factor is not recommended. Typically biases evolve slowly, and hence a separate, lower frequency Markov chain on the bias is more appropriate.
For short-duration experiments it is even recommended to use a single constant bias. Bias estimation is notoriously hard to tune/debug, and also acts as a “sink” for any modeling errors. Hence, starting with a constant bias is a good idea to get the rest of the pipeline working.
- Forster, C., Carlone, L., Dellaert, F., & Scaramuzza, D. (2017). On-Manifold Preintegration for Real-Time Visual–Inertial Odometry. IEEE Transactions on Robotics, 33(1), 1–21. 10.1109/tro.2016.2597321