- MATLAB scripts and C++ library (use separately) that calibrate accelerometer and magnetometer's outputs.
The algorithm implemented in this project minimizes the following problems in both accelerometer and magnetometer:
- For each sensor:
- The non-orthoganality of all axes,
- Different scale factors of all axes,
- Centre biases.
- For magnetometer (when used with accelerometer):
- Misalignment of three magnetometer's axes from three accelerometer's axes respectively.
After calibration, both sensors' readings should fit on the surface of spheres with their centres at the origin, but not on ellipsoids, like in the figure above.
All the mathematical details involved in this algorithm are available in this pdf.
-
For C++,
- ALGLIB math library, requires version 3.20.
- Eigen math library.
- ellipsoid-fit library.
-
For MATLAB,
- ellipsoid_fit_new function.
- For C++, please refer to this page and its header file for more details.
- For MATLAB, please refer to this page and their function files for more explanations.
- Demo for calibrating accelerometer or magnetometer when it is used solely,
- first include acc_log.csv as data file.
- Accelerometer Calibration Example.cpp for C++.
- calibration_acc_interface.m for MATLAB.
- Demo for calibrating magnetometer with well-calibrated accelerometer,
- first include acc_mag_log.csv as data file.
- Magnetometer Calibration Example.cpp for C++.
- calibration_mag.m for MATLAB.
- 1.0.0
- Initial Release
This project is licensed under the Apache-2.0 license - see the LICENSE file for details.