MAGYC: MAgnetometer and GYroscope Calibration


Full Magnetometer and Gyroscope Bias Estimation using Angular Rates: Theory and Experimental Evaluation of a Factor Graph-Based Approach

IEEE Journal of Oceanic Engineering, 2024

Monterey Bay Aquarium Research Institute (MBARI)

Overview

Micro-Electro-Mechanical Systems (MEMS) Attitude and Heading Reference Systems (AHRS) are commonly used for determining system attitude but are limited by sensor biases. This paper introduces MAgnetometer and GYroscope Calibration (MAGYC), a method that estimates hard- and soft-iron magnetometer biases and gyroscope bias using three-axis angular rate measurements.

The MAGYC approach uses batch and online incremental factor graphs, reducing calibration constraints, removing the need for local magnetic field data, and enabling integration into Smoothing and Mapping frameworks.

Field tests on an underwater vehicle reduced dead reckoning-based position error from 10% to 0.5% of the distance traveled.

MAGYC: Magnetometer and Gyroscope Calibration

This paper introduces MAGYC, a factor graph-based method for magnetometer and gyroscope calibration, offering:

  • Minimal angular movement requirements;
  • No need for local magnetic field or attitude information;
  • Comprehensive calibration of magnetometer and gyroscope;
  • Seamless integration with factor graph frameworks like GTSAM.

MAGYC performs complete calibration of a three-axis magnetometer (hard- and soft-iron) and gyroscope using magnetometer and angular rate measurements, independent of the instrument's attitude. It includes two approaches: batch (MAGYC-BFG) and online incremental (MAGYC-IFG) factor graph methods.

Simulation Results

A Monte Carlo simulation generated 6,000 measurements from a MEMS AHRS during vehicle sinusoidal motions. Three datasets were evaluated: Wide Angular Movement (WAM) for an articulated vehicle, Mid Angular Movement (MAM) for a roll-and-pitch stable vehicle, and Low Angular Movement (LAM) for a surveying vehicle with limited motion.

The table below compares the mean heading RMSE and magnetic field standard deviation for three batch and two real-time calibration methods across the datasets, based on 100 validation runs. The top two results in each column are bolded, with superscripts indicating the failure rate in some simulations.

Field Results

The in-field performance of the proposed and benchmark methods was evaluated during two seafloor mapping surveys in Monterey Bay (2014 and 2024). Each deployment included two experiments. The first, EXP1-14 and EXP1-24, involved 360-degree heading rotations with the platform fixed at 0 degrees pitch, while pitch and roll oscillated slightly due to vehicle dynamics. The second, EXP2-14 and EXP2-24, consisted of "mowing the lawn" surveys: a static platform in EXP2-14 and an active seafloor-following vehicle in EXP2-24.

The figure below shows field results: (a) heading errors for parameters from EXP1-14 (solid) and EXP1-24 (hatched) applied to EXP2-14 and EXP2-24, with red dashed lines marking failures. (b) Norm of XY position errors for EXP2-14, with total and relative errors summarized in the table.

Conclusions

The MAGYC methods demonstrated superior performance in simulations and field tests, excelling under ideal and constrained conditions. Field evaluations highlighted significant improvements in position accuracy and heading error reduction, confirming their practicality for underwater navigation in challenging environments.

These results establish MAGYC as a reliable solution for magnetometer and gyroscope calibration, supporting low-cost navigation system development and improving the performance of marine, aerial, and ground vehicles in real-world applications.

Python Library

Code Documentation PyPI Package

The MAGYC method is available as the Python library magyc, which can be installed with pip install magyc. Developers can clone the magyclib repository and use poetry to manage dependencies and build the library with poetry build. See the documentation for more details.

Example Code

Calibration and evaluation examples are provided as Jupyter notebooks in the magyclib repository. Further details are available in the documentation.

Acknowledgments

This work was supported by the David and Lucile Packard Foundation and FONDECYT-Chile under grant 11180907. The field experimental data used in this study were collected in oceanographic surveys conducted by the Monterey Bay Aquarium Research Institute, led by Chief Scientist Dr. David Caress.

BibTeX

@ARTICLE{10908715,
      author={Rodríguez-Martínez, Sebastián and Troni, Giancarlo},
      journal={IEEE Journal of Oceanic Engineering},
      title={Full Magnetometer and Gyroscope Bias Estimation Using Angular Rates: Theory and Experimental Evaluation of a Factor Graph-Based Approach}, 
      year={2025},
      volume={},
      number={},
      pages={1-10},
      keywords={Magnetometers;Calibration;Gyroscopes;Magnetic tunneling;Mathematical models;Magnetic domains;Estimation;Accelerometers;Noise measurement;Earth;Doppler navigation;gyroscope bias calibration;magnetometer hard-iron bias and soft-iron bias calibration;marine robotics;sensor fusion},
      doi={10.1109/JOE.2024.3523701}}