Calibration Data Model

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

Classes: Triad, AccelerationTriad, AngularSpeedTriad, MagneticFluxDensityTriad, SpeedTriad, DistanceTriad, BodyKinematicsSequence, FrameBodyKinematics, FrameBodyMagneticFluxDensity, StandardDeviationBodyKinematics, StandardDeviationFrameBodyKinematics, StandardDeviationBodyMagneticFluxDensity, StandardDeviationFrameBodyMagneticFluxDensity, StandardDeviationTimedBodyKinematics, TimedBodyKinematics, TimedBodyKinematicsAndMagneticFluxDensity, IMUErrors, CalibrationException (see the Class Reference table at the end of this page for Javadoc and source links).

Every calibrator in Accelerometer Calibration, Gyroscope Calibration, and Magnetometer Calibration consumes measurements built from a small set of shared, composable data classes. Understanding these once avoids repeating them on every calibrator page.

Triads

Triad<U, M> is the generic base for "three related scalar measurements sharing a unit," specialized as AccelerationTriad, AngularSpeedTriad, MagneticFluxDensityTriad, SpeedTriad, and DistanceTriad. Each wraps three com.irurueta.units measurements (e.g. three Acceleration values) as a single 3-axis vector, with conversions to/from a raw double[]/Matrix for use in the linear algebra that calibrators perform internally.

AccelerationTriad triad = new AccelerationTriad(0.15, -0.18, -9.79); // m/s^2, default unit

double[] asArray = triad.getValuesAsArray();
double norm = triad.getNorm(); // magnitude of the 3-axis vector

Conventions shared by all containers

  • SI units internally. Raw double getters and setters are always in m/s^2 (specific force), rad/s (angular rate), T (magnetic flux density), s (time) and radians/metres (geodetic position). The overloads that take Acceleration, AngularSpeed, MagneticFluxDensity, Time, Angle or Distance objects convert on the way in and out, so the unit you pass does not change the stored value.

  • Body-frame vectors. Specific force, angular rate and magnetic flux density are resolved about the body axes in the forward-right-down convention described in the error model. The known frame that some containers carry describes where the body is, not the axes the reading is resolved in.

  • Triads versus matrices. A Triad is a convenience wrapper; calibrators convert it with getValuesAsMatrix() / getValuesAsArray(), and getNorm() returns the Euclidean norm, which is what the norm-based families of the non-linear model consume.

  • One standard deviation per sensor, not per axis. The StandardDeviation* containers hold a single specific-force deviation (m/s^2) and a single angular-rate deviation (rad/s) (or one for the field, in T). They are used to weight measurements. The accelerometer measurement generator fills the value with the mean of the three per-axis standard deviations of the samples in the static interval, i.e. the per-sample deviation, not that deviation divided by (see PSD and root-PSD for how that relates to root-PSD).

  • Everything is copyable and serializable. Containers implement Serializable and Cloneable and offer copy constructors, copyFrom and copyTo.

Building up a measurement

Calibration measurements are built by progressively attaching more context to a raw BodyKinematics (specific force + angular rate) or magnetic-flux-density reading:

flowchart LR BK["BodyKinematics\n(raw specific force + angular rate)"] --> TBK["TimedBodyKinematics\n(+ timestamp)"] TBK --> SDTBK["StandardDeviationTimedBodyKinematics\n(+ measurement std devs)"] BK --> SDBK["StandardDeviationBodyKinematics\n(+ measurement std devs)"] SDBK --> FBK["FrameBodyKinematics\n(+ known NED/ECEF frame)"] FBK --> SDFBK["StandardDeviationFrameBodyKinematics\n(+ std devs, + frame)"] SEQ["BodyKinematicsSequence&lt;T&gt;"] -.orders many TimedBodyKinematics-like items.-> TBK BMFD["BodyMagneticFluxDensity"] --> FBMFD["FrameBodyMagneticFluxDensity\n(+ known frame)"] FBMFD --> SDFBMFD["StandardDeviationFrameBodyMagneticFluxDensity\n(+ std devs)"]
  • TimedBodyKinematics / TimedBodyKinematicsAndMagneticFluxDensity — add a (relative) timestamp, needed once measurements must be processed in sequence (e.g. by EasyGyroscopeCalibrator, which integrates angular rate over time).

  • StandardDeviationBodyKinematics / StandardDeviationBodyMagneticFluxDensity — add the measurement’s standard deviation, used to weight measurements in a least-squares/robust fit (e.g. by a noise estimator's output).

  • FrameBodyKinematics / FrameBodyMagneticFluxDensity — add the known NED/ECEF/velocity/orientation frame the measurement was taken at. This is what lets a "known frame" calibrator solve for sensor errors directly, without needing to also estimate orientation. Internally the frame is an ECEFFrame (getFrame()), with NED views getNedFrame() / setNedFrame(). FrameBodyKinematics also keeps a previousFrame and the timeInterval between the two frames: together they describe the motion over one sample, which is what the true specific force and angular rate are derived from (see Accelerometer Calibration). FrameBodyMagneticFluxDensity instead carries the decimal year needed to evaluate the WMM at that position.

  • StandardDeviationFrameBodyKinematics / StandardDeviationFrameBodyMagneticFluxDensity — both of the above combined; the most complete measurement type, used by most linear/non-linear least-squares calibrators.

  • BodyKinematicsSequence<T extends TimedBodyKinematics> — a collection of timed kinematics samples captured while the device was moving, bracketed by static periods. Items may be added in any order; getSortedItems() returns them by ascending timestamp. The static periods are not stored sample by sample, only as the mean specific force before and after the sequence (getBeforeMeanFx/Fy/Fz(), getAfterMeanFx/Fy/Fz()), which approximates gravity in body axes at the start and at the end. This is the measurement unit consumed by EasyGyroscopeCalibrator and is built by the interval detector/generator pipeline.

BodyKinematics rawKinematics = new BodyKinematics(0.15, -0.18, -9.79, 0.001, -0.0005, 0.02);

// a "known frame" measurement: raw kinematics + std devs + the frame it was taken at
NEDPosition position = new NEDPosition(Math.toRadians(41.3851), Math.toRadians(2.1734), 0.0);
CoordinateTransformation attitude = new CoordinateTransformation(
        0.0, 0.0, 0.0, FrameType.LOCAL_NAVIGATION_FRAME, FrameType.BODY_FRAME);
NEDFrame frame = new NEDFrame(position, attitude);

StandardDeviationFrameBodyKinematics measurement =
        new StandardDeviationFrameBodyKinematics(frame);
measurement.setKinematics(rawKinematics);
measurement.setSpecificForceStandardDeviation(0.01);
measurement.setAngularRateStandardDeviation(0.001);

IMUErrors

A container for a complete IMU error model: accelerometer bias and (scale factor/cross-coupling), gyroscope bias, , and (g-dependent bias), plus each sensor’s noise root-PSD and quantization level (see the sensor error model). It is the output of a full calibration run (assembled by IMUErrorsCreator, see calibration/fixers.adoc#imu-errors-creator) and can also be used as the input to a synthetic-data generator (BodyKinematicsGenerator) to simulate a specific, imperfect IMU for testing.

Field Shape Unit

Accelerometer biases

3

m/s^2

Gyroscope biases

3

rad/s

accelerometerScaleFactorAndCrossCouplingErrors ( )

3x3

unit-less

gyroScaleFactorAndCrossCouplingErrors ( )

3x3

unit-less

gyroGDependentBiases ( )

3x3

rad s / m (= rad/s per m/s^2)

Accelerometer noise root-PSD

scalar

m s^-1.5

Gyroscope noise root-PSD

scalar

rad s^-0.5

Accelerometer / gyroscope quantization level

scalar

m/s^2 / rad/s

Biases can be given as double[], 3x1 Matrix or arrays of Acceleration / AngularSpeed; sizes are checked and a wrong size raises IllegalArgumentException, as does a negative noise root-PSD. The shorter constructors leave and the quantization levels at zero.

The matrix stored here is the same full matrix (scale factors on the diagonal) that the calibrators estimate and the fixers expect; the model applies it as (see the inverse model). The Javadoc describes it as the product of a unit-diagonal misalignment matrix and a diagonal scale-factor matrix :

and notes that when the sensor z axis is assumed aligned with the body z axis the three lower-triangular entries (the "common z-axis" simplification of the linear model).

The no-argument IMUErrors() constructor initializes the two scale-factor/cross-coupling matrices to the identity, although the field Javadoc says the default is the zero matrix. Because the model uses , an IMUErrors created that way and not overwritten would double the signal. For an ideal sensor, set the matrices explicitly to the zero matrix (as in the example below).
double[] accelerometerBiases = {0.02, -0.01, 0.05};
double[] gyroBiases = {1e-4, -5e-5, 2e-5};
Matrix accelerometerMa = new Matrix(3, 3);
Matrix gyroMg = new Matrix(3, 3);
double accelerometerNoiseRootPsd = 1.2e-3;
double gyroNoiseRootPsd = 3.5e-5;

IMUErrors imuErrors = new IMUErrors(accelerometerBiases, gyroBiases, accelerometerMa, gyroMg,
        accelerometerNoiseRootPsd, gyroNoiseRootPsd);

CalibrationException

Thrown by calibrators when the underlying numerical solve fails (e.g., an ill-conditioned or rank-deficient measurement set — too few measurements, or measurements that don’t sufficiently excite all axes; see how many measurements are needed). It extends InertialException and carries a message and/or cause. Calibrators raise it from calibrate(); a calibrator that was not given enough data or inputs raises NotReadyException instead, before any solving starts.

Class Reference

Javadoc and source links for the classes used in the examples above:

Class Javadoc Source

Triad

Javadoc

Source

AccelerationTriad

Javadoc

Source

AngularSpeedTriad

Javadoc

Source

MagneticFluxDensityTriad

Javadoc

Source

SpeedTriad

Javadoc

Source

DistanceTriad

Javadoc

Source

BodyKinematics

Javadoc

Source

BodyKinematicsSequence

Javadoc

Source

FrameBodyKinematics

Javadoc

Source

FrameBodyMagneticFluxDensity

Javadoc

Source

StandardDeviationBodyKinematics

Javadoc

Source

StandardDeviationFrameBodyKinematics

Javadoc

Source

StandardDeviationBodyMagneticFluxDensity

Javadoc

Source

StandardDeviationFrameBodyMagneticFluxDensity

Javadoc

Source

StandardDeviationTimedBodyKinematics

Javadoc

Source

TimedBodyKinematics

Javadoc

Source

TimedBodyKinematicsAndMagneticFluxDensity

Javadoc

Source

IMUErrors

Javadoc

Source

CalibrationException

Javadoc

Source

Where to go next