Source-linked AI summary
Magnetometer calibration using inertial sensors
Manon Kok, Thomas B. Schön
TL;DR
Magnetometer calibration must handle environmental disturbances, sensor errors, and misalignment when magnetometer data are combined with inertial measurements for orientation estimation. The paper formulates calibration as an offline maximum-likelihood orientation-estimation problem, and experiments with two commercial inertial measurement units show good calibration and significantly improved heading estimates.
Problem
Magnetometers require recalibration in magnetically different environments, and accurate orientation estimation also requires calibration and alignment with inertial sensor axes.
Method
The paper estimates orientation and unknown calibration parameters jointly in an offline maximum-likelihood framework, using inertial data and ellipsoid-based initialization.
Results
The algorithm performs well on data from two commercially available inertial measurement units and produces significantly improved heading estimates when calibrated magnetometer data are fused with inertial measurements.
Takeaways & Limitations
The method provides practical magnetometer calibration without specialized additional equipment or known sensor orientation.
Takeaways & Limitations
The current approach assumes a constant local magnetic field and time-independent calibration parameters, while online estimation and wider-field extensions remain future work.
Abstract
from arXiv · showhide
In this work we present a practical algorithm for calibrating a magnetometer for the presence of magnetic disturbances and for magnetometer sensor errors. To allow for combining the magnetometer measurements with inertial measurements for orientation estimation, the algorithm also corrects for misalignment between the magnetometer and the inertial sensor axes. The calibration algorithm is formulated as the solution to a maximum likelihood problem and the computations are performed offline. The algorithm is shown to give good results using data from two different commercially available sensor units. Using the calibrated magnetometer measurements in combination with the inertial sensors to determine the sensor's orientation is shown to lead to significantly improved heading estimates.
1 Introduction
The paper presents a practical offline maximum-likelihood calibration algorithm that corrects magnetic disturbances, sensor errors, and magnetometer–inertial-axis misalignment. Calibration maps ellipsoidal magnetometer data toward a unit sphere and improves heading estimates when combined with inertial measurements.
- The algorithm corrects magnetic disturbances, magnetometer sensor errors, and misalignment between magnetometer and inertial sensor axes.
- The calibration is formulated as a maximum likelihood problem and performed offline without requiring known sensor orientation.
- The calibrated magnetometer data form a unit sphere, illustrated by blue data replacing the pre-calibration red ellipsoid.
- Calibration requires rotating the sensor through all orientations so distorted ellipsoidal measurements can be mapped to a sphere.
2 Related work
Existing calibration methods either rely on heading references, fit magnetometer data to a sphere, or use additional alignment procedures. This work instead uses inertial measurements within an orientation-estimation formulation and reports improved heading accuracy from maximum-likelihood estimates.
- Traditional calibration can require a reference sensor, whereas other approaches use magnetometer-only scalar checking or ellipsoid fitting.
- Magnetometer-only methods can map an ellipsoid to a sphere but cannot determine the sphere’s rotation relative to inertial sensor axes.
- Prior alignment methods may use accelerometer data during low-acceleration periods, requiring a threshold and omitting gyroscope data.
- The proposed formulation estimates sensor orientation together with unknown calibration parameters, using accelerometer and gyroscope data to aid calibration.
- The authors report significant heading-accuracy improvements from maximum-likelihood parameter estimates after ellipsoid and misalignment initialization.
3 Problem formulation
The calibration problem is posed as nonlinear grey-box state-space identification with unknown parameters governing magnetometer measurements. Maximum-likelihood estimation is approximated using an extended Kalman filter because the model lacks a closed-form predictor.
- The model represents sensor orientation as the state, gyroscope angular velocity as input, and accelerometer and magnetometer readings as measurements.
- Unknown calibration parameters enter the magnetometer measurement model, and the parameters are estimated by maximizing the likelihood of the observations.
- The likelihood formulation is rewritten using conditional probabilities and the monotonicity of the logarithm.
- The maximum-likelihood estimator is described as having strong consistency, asymptotic normality, and asymptotic efficiency.
- Because the nonlinear state-space model has no closed-form one-step predictor, the method approximates it with an extended Kalman filter.
- The resulting optimization is non-convex, so good initial parameter values are required.
4 Magnetometer measurement model
The measurement model represents the local magnetic field in navigation and body frames, while calibration accounts for rigid magnetic distortions, sensor errors, and frame misalignment. It assumes time-invariant distortions and a constant local magnetic field.
- A perfectly calibrated magnetometer measures a constant local field whose normalized vector is modeled with unit norm.
- The body-frame magnetic field is obtained by rotating the normalized navigation-frame field according to sensor orientation.
- The local field’s horizontal and vertical components depend on dip angle, while indoor fields may point toward a local rather than Earth magnetic north.
- Calibration models rigidly attached magnetic material through hard-iron offsets and soft-iron orientation-dependent distortions.
- The body frame is aligned with accelerometer axes, and a rotation matrix represents magnetometer-to-body-frame misalignment.
- Magnetometer sensor errors include axis non-orthogonality, zero bias, and unequal axis sensitivity.
- These sensor-error contributions are combined into a 3 × 3 distortion matrix and a 3 × 1 offset vector rather than identified separately.
- The model assumes constant calibration parameters, rigid sensor-axis attachment, and a constant local magnetic field, which may vary across indoor locations.
5 Calibration algorithm
The calibration algorithm estimates magnetometer and inertial parameters by optimizing a maximum-likelihood cost function, with an EKF evaluating orientation-dependent measurements. It uses careful initialization, numerical optimization, and offline computation to estimate calibration quantities including the magnetometer matrix, offset, local field, biases, and noise covariances.
- The algorithm estimates the parameter vector θ by solving a maximum-likelihood optimization problem summarized in Algorithm 1.
- Initial parameters are obtained in three steps, including stationary-data initialization, ellipsoid fitting, and estimation of inertial–magnetometer axis misalignment.
- Each optimization iteration runs an EKF, evaluates the cost function, computes a numerical gradient, and updates the parameter estimate until convergence.
- The optimization uses numerical derivatives because the gradient and Hessian of the nonlinear cost function are not straightforward to compute analytically.
- With nθ = 34, numerical-gradient computation requires at least nθ + 1 EKF-based cost evaluations per iteration, making the procedure computationally expensive.
- The estimated parameters include the calibration matrix D, offset vector o, local magnetic field, gyroscope bias, and sensor-noise covariance matrices.
6 Finding good initial estimates
Good initial estimates are constructed by fitting the magnetometer data to an ellipsoid and then estimating calibration, field, and axis-misalignment parameters from inertial and magnetometer measurements. These estimates initialize the full parameter vector before the non-convex maximum-likelihood optimization.
- The first initialization step estimates gyroscope bias and inertial and magnetometer noise covariances from a short stationary-data batch or prior sensor knowledge.
- A perfectly calibrated magnetometer produces measurements on a sphere, whereas practical sensor errors produce an ellipsoid that calibration maps to a sphere.
- 6.1 Ellipsoid fitting: The ellipsoid-fitting problem is linearized in the parameters using Kronecker products and vectorization, but requires a constraint to avoid the trivial solution ξ = 0.
- 6.1 Ellipsoid fitting: A semidefinite-program formulation constrains the ellipsoid matrix to be positive definite and provides a convex problem with a globally optimal solution.
- 6.1 Ellipsoid fitting: Initial calibration parameters are obtained from the fitted ellipsoid using a Cholesky decomposition, while the remaining rotational ambiguity is restricted to a rotation matrix.
- 6.2 Determine misalignment of the inertial and magnetometer sensor axes: Axis misalignment is estimated by exploiting the rotation-invariance of the inner product between the normalized magnetic field and the vertical direction.
- 6.2 Determine misalignment of the inertial and magnetometer sensor axes: The initial estimates combine magnetometer and inertial measurements, using an EKF-derived orientation estimate that relies only on inertial data for inclination.
7 Experimental results
Experiments with Xsens and Trivisio IMUs show that the calibration maps distorted magnetometer data toward a unit sphere and produces residuals consistent with the model. The calibrated data also improves heading estimates over initial parameter estimates.
- Experimental setup: Data from Xsens and Trivisio IMUs were collected at 100 Hz, using outdoor and indoor setups designed to minimize or introduce controlled magnetic disturbances.The Xsens sensor was placed in an aluminum block, while a phone served as the Trivisio disturbance source without being attached directly to the IMU.
- Calibration results: The normalized residuals approximately follow a N(0, 1) distribution, although Xsens results include a peak near zero and a small number of outliers linked to accelerometer measurement outliers.The validation residuals for the Xsens experiment resemble those from the original data, supporting reuse of the estimated calibration parameters.
- Calibration results: The calibration transforms the Trivisio magnetometer-data ellipsoid onto a unit sphere, with calibrated norms lying around 1 for both experiments.The red pre-calibration ellipsoid and norm are contrasted with the blue calibrated sphere and norm.
- Heading estimation: The Xsens heading mean error decreases from 1.28° with initial estimates to 0.76° with maximum-likelihood estimates.The maximum heading error also decreases from 4.36° to 2.48° after applying the estimates from Algorithm 1.
8 Simulated heading accuracy
The simulation evaluates heading accuracy by comparing calibration parameters from the full maximum-likelihood algorithm with those from its initialization phase. Across 150 Monte Carlo simulations, the full algorithm consistently produces smaller heading error, while magnetometer-norm analysis alone does not distinguish the estimates.
- Simulation setup: The simulations assume Linköping’s local magnetic field and sample calibration, bias, and noise parameters from physically reasonable uniform distributions.The calibration matrix is modeled using diagonal, rotational, and non-orthogonality components.
- Simulation setup: The simulated data contains 100 stationary samples followed by 300 samples rotating around all three axes, with initial gyroscope bias estimated from the stationary segment.The EKF is run using both initial parameter values and their maximum-likelihood estimates.
- Simulation setup: 150 Monte Carlo simulations compare heading RMSE obtained with the full Algorithm 1 estimate and the Step 1 initialization estimate.The heading error is computed from orientation-error quaternions and analyzed through the third Euler-angle component.
- Heading accuracy: The full Algorithm 1 estimate yields consistently small heading RMSE, whereas the Step 1 estimate has a significantly larger spread across simulations.This indicates that executing the full algorithm improves orientation accuracy relative to initialization alone.
- Heading accuracy: The norm of calibrated magnetometer measurements does not reliably identify the better calibration when the objective is improved heading estimation.In all simulations, norm analysis failed to show that the maximum-likelihood estimate was preferable to the initialization estimate.
9 Conclusions
The paper concludes that its offline maximum-likelihood algorithm calibrates magnetometer disturbances, sensor errors, and axis misalignment, with good performance on real sensor-unit data. Future work targets broader measurements, lower computational cost, and online calibration for time-varying magnetic fields.
- Conclusions: The algorithm calibrates magnetic disturbances, magnetometer errors, and misalignment between inertial and magnetometer axes using a maximum-likelihood formulation.Its real-data evaluation used two commercially available inertial measurement units.
- Future work: Including GPS measurements could remove the zero-acceleration assumption and extend the approach to a wider range of applications.The authors note that adding GPS would increase computational cost because the EKF state vector must be extended.
- Future work: The maximum-likelihood optimization is computationally expensive because it requires many costly iterations and numerical-gradient calculations.The authors suggest investigating alternative optimization methods or gradient-estimation strategies.
- Future work: Online estimation of calibration parameters could support slowly time-varying magnetic fields and online data processing.The paper identifies online calibration as a future extension rather than part of the presented offline algorithm.