Skip to content
Emanuele Giacomini edited this page Apr 17, 2024 · 3 revisions

To calibrate your camera(s), first generate a target configuration file, gather your sensors/bag and run:

rosrun ca2lib stereo_recorder \
    -l <topic_camera_left> \
    -r <topic_camera_right> \
    -t <target.yaml> \
    -o <output folder>

After enough views of the calibration target are acquired, run the calibration

rosrun ca2lib calibrate_camera \
    -i <images folder> \
    -t <target.yaml> \
    -o <cam_results.yaml>

Onto the extrinsics!

To calibrate the LiDAR relative pose, follow the calibration guide and run the following node

Offline Calibration

We suggest following the offline method as it provides more control over the optimization procedure. The procedure is exactly the same in both cases, we just need a few more arguments to save the measurements on a file. To run the calibration node, type:

rosrun ca2lib calibrate_lidar_camera \
    -c <camera_topic> \
    -i <cam_intrinsics.yaml> \
    -l <cloud_topic> \
    -t <target.yaml> \
    --output-planes <measures.txt>

Once you've acquired your measurements, you can execute the offline calibration node:

rosrun ca2lib calibrate_lidar_camera_offline \
    --input <measures.txt> \
    --output <lidar_in_cam.yaml> \
    --iterations <num_iter> \
    --threshold-inlier <inlier_th> \
    --huber <huber_th> \
    --damping <damping_factor>

This table reports the standard values for iterations, inlier threshold, huber threshold and damping factor

iterations threshold-inlier huber damping
10 3.0 0.1 10.0

We empirically found these values and experiments for the paper ran with them. In case you use more than 3 measurements and encounter NotEnoughMeasurements, you might want to relax some of these parameters:

  • Increase the threshold-inlier (at most 10 or similar)
  • Increase the huber threshold (at most 2.0 or similar)

If during optimization you observe an ever decreasing chi_inliers, you might want to:

  • Increase the number of iterations
  • Decrease the damping factor (set to 0.0 for fast convergence at cost of stability)

Online Calibration

We discourage the use of the online calibration system. In case you want to follow this approach, we suggest applying the tips suggested in the previous section to relax the solver's convergence basin.

To run the calibration, simply run:

rosrun ca2lib calibrate_lidar_camera \
    -c <camera_topic> \
    -i <cam_intrinsics.yaml> \
    -l <cloud_topic> \
    -t <target.yaml> \
    -o <lidar_in_cam.yaml>

Visualization

Once you obtained your extrinsics, you can visualize the LiDAR projection onto the image plane by using:

rosrun ca2lib visualize_lidar_in_camera \
    -c <camera_topic> \
    -i <cam_intrinsics.yaml> \
    -l <cloud_topic>
    -e <lidar_in_cam.yaml>
Clone this wiki locally