IMU Calibration

This documentation was generated with the assistance of AI. Please report any inaccuracies.

The com.irurueta.navigation.inertial.calibration package (and its accelerometer, gyroscope, magnetometer, bias, generators, intervals, and noise sub-packages) estimates the systematic errors of an accelerometer, gyroscope, and/or magnetometer — bias, scale factor, and cross-axis coupling — and, once known, corrects ("fixes") raw sensor readings back to their true values.

This package is by far the largest in the library (around 280 classes). Rather than one page per class, this documentation groups classes by what they do, since the vast majority of classes are boilerplate variants (different robust outlier-rejection strategies, different measurement orderings, unit conversions) of a much smaller number of distinct algorithms.

The sensor error model

Every calibratable sensor in this library (accelerometer, gyroscope, magnetometer) is assumed to follow the same linear error model: a fixed bias, plus a matrix of scale-factor and cross-coupling errors applied to the true signal, plus noise. For the accelerometer:

The gyroscope additionally picks up a g-dependent bias driven by the specific force sensed by the accelerometer (typically caused by mass unbalance in the spinning/vibrating element):

and the magnetometer follows the accelerometer’s form, with "hard iron" playing the role of bias and "soft iron" playing the role of cross-coupling:

Sensor error model: bias offset plus scale-factor and cross-coupling misalignment

Calibration means estimating and (and, for the gyroscope, ) from measurements taken at known or partially-known references. Fixing means applying the inverse of this model to a raw reading once those parameters are known, to recover (see Fixers: Undoing the Sensor Error Model).

, , and above are always resolved about body-frame axes — the raw sensor reading itself is never "in NED." NED only appears as one of two interchangeable ways to describe the known frame/position some calibrators need alongside a measurement: FrameBodyKinematics (see Calibration Data Model) stores that frame internally as ECEFFrame and exposes an NED-converted view via getNedFrame()/setNedFrame(), and calibrator families such as KnownPositionAccelerometerCalibrator (Accelerometer Calibration) and TurntableGyroscopeCalibrator (Gyroscope Calibration) accept a position as either NEDPosition or ECEFPosition — neither is mandatory. Only the magnetometer’s WMM-position families (Magnetometer Calibration) and the bias estimators require geodetic (NED-style latitude/longitude/height) position, since that is what the WMM and gravity models are keyed on.

Do not confuse the point above (the resolving frame for a known position, which is flexible) with the body-frame axis convention of , , and themselves, which is not flexible: every equation and every Ma/Mg/Gg/Mm matrix in this package assumes the raw sensor vector already follows Groves' forward-right-down (FRD) body convention (§2.1.4, [book-groves]) — see the same warning on the estimators page for the exact conversion to apply if your IMU instead reports an ENU-aligned body convention. This library performs no such conversion itself; getting it wrong will not raise an error, only wrong bias/scale-factor/cross-coupling estimates.

Map of the package

Page Covers

Calibration Data Model

Data containers shared by every calibrator: triads, BodyKinematics-based measurement types, IMUErrors.

Fixers: Undoing the Sensor Error Model

AccelerationFixer, AngularRateFixer, MagneticFluxDensityFixer, BodyKinematicsFixer, IMUErrorsCreator — applying the inverse error model.

Accelerometer Calibration

The accelerometer sub-package: ~79 classes, 4 distinct calibration algorithms x 5 robust-estimator variants.

Gyroscope Calibration

The gyroscope sub-package: ~86 classes, including the Tedaldi et al. "Easy" calibrator and quaternion integrators.

Magnetometer Calibration

The magnetometer sub-package: ~79 classes, mirroring the accelerometer’s algorithm/robust-estimator structure.

Static/Dynamic Interval Detection and Measurement Generation

Static/dynamic interval detection and measurement-sequence generation — the preprocessing step before calibration.

Noise and Approximate-Bias Estimators

Noise (PSD/root-PSD) and approximate-bias estimators used to seed calibrators and Kalman filter configs.

Why so many classes per algorithm?

Every non-trivial calibration algorithm in accelerometer, gyroscope, and magnetometer appears in up to six forms:

flowchart LR A["Known<X>...Calibrator\n(base: assumes every measurement is trustworthy)"] --> B["RANSACRobust...\n(random sample consensus)"] A --> C["MSACRobust...\n(RANSAC + soft cost function)"] A --> D["LMedSRobust...\n(least median of squares)"] A --> E["PROSACRobust...\n(RANSAC + measurement quality ordering)"] A --> F["PROMedSRobust...\n(LMedS + measurement quality ordering)"]

The base (non-robust) calibrator is the one that actually implements the algorithm’s math — it assumes every input measurement can be trusted. The five Robust* classes wrap it with an outlier-rejection strategy from `irurueta-numerical-computing’s robust-estimator framework, useful when some measurements (e.g. from a noisy or disturbed static interval) might be bad. This documentation describes each algorithm’s math once and lists all six forms in a summary table, rather than repeating the same equations six times.

Where to go next