A ROS package containing GUIs for calibrating accelerometers and magnetometers typically found within Inertial Measurement Units (IMUs).
Author/Maintainer: Paul D'Angio, pcdangio (at) gmail.com
License: MIT
- Installation: Instructions for installing this package.
- Usage: Instructions for using this package.
- Nodes: A detailed description of the calibration nodes available for use.
- Qt 5+ (software framework for graphical user interfaces)
- Qt 5+ Data Visualization Module (Qt module for 3D data visualization)
- Robot Operating System (ROS) (robotic software architecture)
- sensor_msgs_ext (ROS extended sensor messages)
- ifopt (ROS package for IPOPT optimization)
- rosbag (ROS package for saving ROS topic data)
To build from source, clone the latest version from this repository into your catkin workspace and compile the package using
cd catkin_workspace/src
git clone https://github.com/pcdangio/ros-calibration_imu.git calibration_imu
cd ../
catkin_make
This package includes several nodes for calbrating components of your IMU. See the Nodes section for available nodes to run and more specific instructions on how to use them.
rosrun calibration_imu <node_name>
This package includes the following nodes for calibration:
This node offers calibration tools for 3-dimensional magnetometers commonly found in IMUs. Magnetometers often experience hard-iron and soft-iron distortions from magnets and metal objects that are statically mounted near the magnetometer. These distortions depend on the design/geometry of your system's hardware. This node will calculate a calibration that reduces these effects and gives a more accurate magnetometer reading.
The node can be run with the following command:
rosrun calibration_imu magnetometer
Executing this command will start up the magnetometer calibration GUI.
The calibration routine needs a set of uncalibrated data to process so it can detect hard-iron and soft-iron distortions. The uncalibrated data is collected by rotating your platform/magnetometer in specific patterns while recording it's data. To collect data:
- CRITICAL: Ensure your platform is in it's operational configuration. Things like batteries, covers, or other ferrous/magnetic components will all have an effect on the calibration, so they should all be mounted and/or connected during the calibration process.
- CRITICAL: Set up your platform in an outdoor area free from nearby magnetic interference (e.g. buildings, power lines, metal plates, etc.)
- Set up the node to subscribe to your platform's ROS topic for magnetometer data. The magnetometer node automatically subscribes to the
imu/magnetometer
(sensor_msgs_ext/magnetometer) topic, which may be remapped when starting the magnetometer node. CRITICAL: Ensure that the magnetometer is transmitting uncalibrated data through the above topic. - Click on the "Start" button in the Data Collection box of the GUI. You will see data start populating in the 3D plot, with a large red point indicating the most recently collected point. The rate at which data is collected can be limited by setting the
~/max_data_rate
parameter (in Hz) in the ROS parameter server. - Rotate your platform in all directions. You will be able to see a 3D ellipsoid start forming in the plot window (a red point shows the current position). Once you can clearly see the general shape of a bounded 3D ellipsoid, you may stop collection. NOTE: It is very important for the data points to fully bound the ellipsoid, while it is NOT important to have a lot of points.
The calibration routine can now be executed on the collected data. To calibrate:
- Enter the true magnetic field strength in the supplied text box. You may look up the true field strength using NOAA's World Magnetic Model and your current location on earth. NOTE: You must enter the total field strength, in nT.
- Start the calibration. It should take anywhere from 1s-30s depending on how many data points you have. Once the calibration is complete, it will appear in the calibration textbox. If you have all plots enabled, you will be able to see the 3D ellipsoid that was fit to your data, the true magnetic field sphere, and a calibrated set of your data points that should align closely with the true field sphere.
- You may export your calibration by either copying the calibration text box, saving it to JSON format, or saving it to YAML format.
This node offers calibration tools for 3-dimensional accelerometers commonly found in IMUs. Accelerometers typically exhibit distortions in the form of offset and range scale. This node will calculate a calibration that reduces these effects and gives a more accurate accelerometer reading.
NOTE: Accelerometer calibrations should be applied to accelerometer data BEFORE any frame transformations.
The node can be run with the following command:
rosrun calibration_imu accelerometer
Executing this command will start up the accelerometer calibration GUI.
The calibration routine needs a set of uncalibrated data points to process so it can detect scale and offset distortions. The uncalibrated data is collected by placing your platform/accelerometer in 6 specific orientations and using the "Grab" functions. To collect data:
- Set up the node to subscribe to your platform's ROS topic for raw (not transformed) accelerometer data. The accelerometer node automatically subscribes to the
imu/accelerometer
(sensor_msgs_ext/accelerometer) topic, which may be remapped when starting the accelerometer node. CRITICAL: Ensure that the accelerometer is transmitting uncalibrated data through the above topic. - Click on the "Start Collection" button in the Data Collection box of the GUI. You will see real-time accelerometer data being populated in the bar chart. The data is taken from a moving average of the actual accelerometer readings. You can set the size of the moving average window by setting the
~/sample_size
parameter in the ROS parameter server. - Rotate your platform/accelerometer into each of the 6 indicated orientations, and use the "Grab" button to save the data for each orientation. The orientation label will turn green when it has been successfully grabbed. Some important notes:
- CRITICAL: The platform/accelerometer must be absolutely motionless during a grab. Rest your platform/accelerometer on stable ground, and do not touch it while grabbing. Use something stable as a stand to assist in holding the platform/accelerometer in the desired orientation.
- NOTE: It is NOT important for the platform/accelerometer to be exactly in the listed orientation. As long as the platform/accelerometer is within +/-45deg of that orientation, the calibration routine will still function properly (it fits an ellipsoid to the data to derive the actual limits for each axis).
The calibration routine can now be executed on the collected data. To calibrate:
- Enter the true gravity acceleration constant in the supplied text box. You may look up the true field strength using NOAA's World Magnetic Model and your current location on earth.
- Start the calibration. It should take anywhere from 1s-5s depending on your computer performance. Once the calibration is complete, it will appear in the calibration textbox. The graph will now show the "Fit" and "Calibration" data. The fit is the calculated range of uncalibrated accelerometer data based on the collected data. The fit plot shows the offset and scale errors of the uncalibrated accelerometer. The calibration plot shows the offset and range of the accelerometer after the calibration is applied. This can be used to verify the accuracy of the calibration.
- You may export your calibration by either copying the calibration text box, saving it to JSON format, or saving it to YAML format.