C++ package for magnetic calibration
🧑🏫 Thomas LE MEZO [email protected] (ENSTA Bretagne, Lab-STICC)
🧑🏫 Maël GODARD [email protected] (ENSTA Bretagne, Lab-STICC)
- 📁 /dataset : folder containing the input datasets
- 📁 /include : folder containing header files
- 📁 /src : folder containing source files
- 🗒️ CMakeLists.txt CMakeLists to compile
- 🗒️ package.xml
- 🗒️ README.md
- C++
- Eigen
- Vtk 9.0
- CMake
- Clone the repository :
# for ssh clone
git clone [email protected]:godardma/magnetic_calibration.git
# for https clone
git clone https://github.com/godardma/magnetic_calibration.git
- Open a terminal in the created folder
- Setup the build folder :
mkdir build && cd build && cmake ..
From a terminal in the build folder :
make && ./mag_calibration
An exemple main file can be found here
The main steps are :
-
Create an instance of the object MagneticCalibration
-
Fill the field "magnetometer_data_regularized_" :
- Use the function "generate_data" to use the the default dataset, no need to regularize it
- Fill the field "magnetometer_data_" by hand and regularize the dataset
- Fill the field "magnetometer_data_" from a file using the function "create_data_from_file" and regularize the dataset
The regularization is done by calling the function "regularize_data", arguments are the limit of point in a box and its limit size
-
Perform the ellipsoid fit with the "compute_ellipsoid" function to get its center and the transformation matrix (noted TR) between the ellipsoid and a sphere
Other useful functions provided are :
- correct_data: Applies the correction to "magnetometer_data_" and stores the result in "magnetometer_data_corrected_"
- check_correction: Performs an ellipsoid fit on "magnetometer_data_corrected_" to check if it matches a sphere as it should
- view_data: to visualize the data, arguments are point size and the range of the displayed axis
- In black the raw data, stored magnetometer_data_
- In red the regularized data, stored magnetometer_data_regularized
- In green the corrected data, stored magnetometer_data_corrected, and the corresponding sphere
The package seems to struggle to perform a proper calibration when big values are passed as inputs. We highly suggest to keep the values in the range [-1000,1000] by scaling your inputs if necessary to get a proper result.
This package is under GNU General Public License
The credits belong to Thomas LE MEZO (ENSTA Bretagne, Lab-STICC) and Maël GODARD (ENSTA Bretagne Lab-STICC)