This repository contains a ROS package with tools for computing and applying calibration parameters to IMU measurements.
- Note: This is the HIRO group's adaptation of the
imu_calib
package for multiple imus. Usage will be described below.
The package contains two nodes. The first computes the accelerometer calibration parameters and saves them to a YAML file, and needs to be run only once. After you have run this node to generate the YAML calibration file, the second node uses that file to apply the calibration to an uncalibrated IMU topic to produce a calibrated IMU topic.
Computes the accelerometer calibration parameters. It should be run directly with a rosrun in a terminal rather than from a launch file, since it requires keyboard input. After receiving the first IMU message, the node will prompt you to hold the IMU in a certain orientation and then press Enter to record measurements. After all 6 orientations are complete, the node will compute the calibration parameters and write them to the specified YAML file.
The underlying algorithm is a least-squares calibration approach based on and similar to that described in STMicroeletronics Application Note AN4508. Due to the nature of the algorithm, obtaining a good calibration requires fairly accurate positioning of the IMU along each of its axes.
imu_data_<imu_num>
(sensor_msgs/Imu)
The raw, uncalibrated IMU measurements fromimu_num
~calib_file
(string, default: "imu_calib.yaml")
The file to which the calibration parameters will be written~measurements
(int, default: 500)
The number of measurements to collect for each orientation~reference_acceleration
(double, default: 9.80665)
The expected acceleration due to gravity
To run with our changes:
# from a catkin workspace..
catkin build
source devel/setup.bash
rosrun imu_calib do_calib <imu_num>
In order for the last command to work, you will need data (specifically, Imu messages) being published to the imu_data_<imu_num>
topic.
Applies the accelerometer calibration parameters computed by the do_calib node. Also optionally (enabled by default) computes the gyro biases at startup and subtracts them off.
imu_data_<imu_num>
(sensor_msgs/Imu)
The raw, uncalibrated IMU measurements fromimu_num
.
corrected_imu_data_<imu_num>
(sensor_msgs/Imu)
The corrected, calibrated IMU measurements
~calib_file
(string, default: "imu_calib.yaml")
The file from which to read the calibration parameters~calibrate_gyros
(bool, default: true)
Whether to compute gyro biases at startup and subsequently subtract them off~gyro_calib_samples
(int, default: 100)
The number of measurements to use for computing the gyro biases
To run with our changes:
# from a catkin workspace..
catkin build
source devel/setup.bash
rosrun imu_calib apply_calib <imu_num>
In order for the last command to work, you will needed to have performed do_calib
(see above with our relevant steps), which will write the imu calibration parameters to a yaml file. From there, apply_calib
will take that yaml file and messages from the imu_data_<imu_num>
nodes and apply calibration.