-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Camera IMU calibration
The camera-imu calibration tool estimates the spatial and temporal parameters of a camera system with respect to an intrinsically calibrated IMU. Image and IMU data has to be provided in a ROS bag.
The calibration parameters are estimated in a full batch optimization using splines to model the pose of the system. Detailed information about the approach can be found in the following papers: (see 1, 2)
A video tutorial for the IMU-camera calibration can be found here:
(Credits: @indigomega)
The intrinsic parameters of the IMU (e.g. scales, axis misalignment, nonlinearities,...) need to be calibrated beforehand and its correction applied to the raw measurements. If not, one should use an IMU model which calibrates these values.
Further an IMU configuration YAML has to be created containing the following statistical properties for the accelerometers and gyroscopes:
- noise density
- bias random walk
Please refer to the YAML formats page for the data format and the IMU Noise Model page for the theory. The simplest way to recover these parameters is to compute an Allan Deviation using the ori-drs/allan_variance_ros tool.
Create a ROS bag containing the raw image streams either by directly recording from ROS sensor streams or by using the bagcreater script on a list of image files and a CSV file containing the IMU measurements.
The calibration target is fixed in this calibration and the camera-imu system is moved in front of the target to excite all IMU axes. It is important to ensure good and even illumination of the calibration target and to keep the camera shutter times low to avoid excessive motion blur.
Good results have been obtained by using a camera rate of 20 Hz and an IMU rate of 200 Hz.
Tips:
- try to excite all IMU axes (rotation and translation)
- avoid shocks, especially at the beginning/end when you pick up the sensor
- keep the motion blur low:
- low shutter times
- good illumination
- ensure low jitter timestamps in same clock
WARNING: If you are using a calibration target with symmetries (checkerboard, circlegrid), movements which could lead to flips in the target pose estimates have to be avoided. The use of an Aprilgrid is recommended to avoid this problem entirely.
The tool must be provided with the following input:
-
--bag filename.bag
ROS bag containing the image and IMU data
-
--cam camchain.yaml
intrinsic and extrinsic calibration parameters of the camera system. The output of the multiple-camera-calibration tool can be used here. (see YAML formats)
-
--imu imu.yaml
contains the IMU statistics and the IMU's topic (see YAML formats)
-
--target target.yaml
the calibration target configuration (see Calibration targets)
The calibration can be run using:
kalibr_calibrate_imu_camera --bag [filename.bag] --cam [camchain.yaml] --imu [imu.yaml] --target [target.yaml]
The temporal calibration is turned on by default and can be disabled using the --no-time-calibration argument. More information about options is available using the help argument:
kalibr_calibrate_imu_camera --h
Example command of sample bag file (download it here):
rosrun kalibr kalibr_calibrate_imu_camera \
--target april_6x6.yaml \
--imu imu_adis16448.yaml \
--imu-models calibrated \
--cam cam_april-camchain.yaml \
--bag imu_april.bag
The calibration will produce the following output files:
- report-imucam-%BAGNAME%.pdf: Report in PDF format. Contains all plots for documentation.
- results-imucam-%BAGNAME%.txt: Result summary as a text file.
- camchain-imucam-%BAGNAME%.yaml: Results in YAML format. This file is based on the input camchain.yaml with added transformations (and optionally time shifts) for all cameras with respect to the IMU. Please check the format on the YAML formats page.
One should make sure to inspect the IMU timestamp DTs. One example of bad IMU timestamps where a burst of IMU are send at a rate of 1ms with gaps of 6ms between (caused by sending messages in buffers and directly republishing them).
![](https://private-user-images.githubusercontent.com/2222562/240753184-35d0bc93-5a98-455b-902c-461288a17bda.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5NjQxNjcsIm5iZiI6MTcyNTk2Mzg2NywicGF0aCI6Ii8yMjIyNTYyLzI0MDc1MzE4NC0zNWQwYmM5My01YTk4LTQ1NWItOTAyYy00NjEyODhhMTdiZGEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTBUMTAyNDI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTg4OWYxZGMzZDlkOTgyN2QzNDE5N2JlZDU0ZGNiY2E5ZDJjMGIwYjFhZTJjNGI2MWU5OGQxOWM2YWIwYTk2YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.RmenAmii9Qt8jemrLY7H1BuXfU9WUleNooFq-gHEhgg)
If you have this, than likely your hardware is messed up and you will run into calibration problems. You will need to rectify the timestamp problems.
Please cite the appropriate papers when using this toolbox or parts of it in an academic publication.
- Paul Furgale, Joern Rehder, Roland Siegwart (2013). Unified Temporal and Spatial Calibration for Multi-Sensor Systems. In Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), Tokyo, Japan.
- Paul Furgale, T D Barfoot, G Sibley (2012). Continuous-Time Batch Estimation Using Temporal Basis Functions. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), pp. 2088–2095, St. Paul, MN.
Multiple camera calibration
Camera-IMU calibration
Multi-IMU and IMU intrinsic calibration
Rolling Shutter camera calibration
(only ROS):
Camera focus
Calibration validator
ROS2 support
Supported camera models
Calibration targets
Bag format
YAML formats
IMU Noise Model
Example: Calibrating a VI-Sensor
Example: Calibrating RealSense Cameras