Calibration - Camera
Contents
Calibration - Camera#
This section describes the intrinsic and extrinsic calibration procedures.
What you will need
You can see the camera image on the laptop.
What you will get
That your camera intrinsics and extrinsics are calibrated and stored on the Duckiebot.
Materials#
Calibration board#

Fig. 47 Calibration checkerboard#
If you do not have one already:
Download the Calibration checkerboard pdf
Print it with A3 Format
Fix the checkerboard to a rigid planar surface that you can move around
Note
The squares must have side equal to 0.031 m = 3.1 cm. Please measure this, as having the wrong size will make your Duckiebot crash.
In case your squares are not of the right size, make sure your printer settings are on A3 format, no automatic scaling, 100% size.
Warning
If the pattern is not rigid the calibration will be useless. You can print on thick paper or adhere to something rigid to achieve this.
Optional material#
This is not necessary, but you could also use a “lane” during the extrinsic calibration procedure.
Intrinsic Calibration#
Every camera is a little bit different, so we need to do a camera calibration procedure to account for the small manufacturing discrepancies. This process will involve displaying a predetermined pattern to the camera, and using it to solve for the camera parameters. For more information, see our theory slides. And the procedure is basically a wrapper around the ROS camera calibration tool.
Launch the intrinsic calibration application#
Next you can launch the intrinsic calibration program with:
dts duckiebot calibrate_intrinsics [your_duckiebot_hostname]
You should see an application launching, similar to the following figure, on the laptop.

Fig. 48 Intrinsic camera calibration tool#
Troubleshooting
SYMPTOM
Only a black window starts up
RESOLUTION
Try resizing the window manually once using cursor, and you should see the window content correctly.
Calibration dance#
Position the checkerboard in front of the camera until you see colored lines overlaying the checkerboard. You will only see the colored lines if the entire checkerboard is within the field of view of the camera.
You should also see colored bars in the sidebar of the display window. These bars indicate the current range of the checkerboard in the camera’s field of view:
X bar: the observed horizontal range (left - right)
Y bar: the observed vertical range (top - bottom)
Size bar: the observed range in the checkerboard size (forward - backward from the camera direction)
Skew bar: the relative tilt between the checkerboard and the camera direction
Also, make sure to focus the image by rotating the mechanical focus ring on the lens of the camera.
Warning
Do not touch the focus anymore, ever, as it will invalidate calibration.
Now move the checkerboard right/left, up/down, and tilt the checkerboard through various angles of relative to the image plane. After each movement, make sure to pause long enough for the checkerboard to become highlighted. Once you have collected enough data, all four indicator bars will turn green. Press the “CALIBRATE” button in the sidebar.
Calibration may take a few moments. Note that the screen may dim. Don’t worry, the calibration is working.

Fig. 49 Calibration step#
Save the calibration results#
If you are satisfied with the calibration, you can save the results by pressing the “COMMIT” button in the side bar. (You never need to click the “SAVE” button.)

Fig. 50 Committing the calibration#
This will automatically save the calibration results on your Duckiebot:
/data/config/calibrations/camera_intrinsic/[your_duckiebot_hostname].yaml
You can view or download the calibration file using the Dashboard running at http://[your_duckiebot_hostname].local
under File Manager
in the sidebar on the left, navigating to config/calibrations/camera_intrinsic/
.
Keeping your calibration valid#
Warning
Do not change the focus during or after the calibration, otherwise your calibration is no longer valid.
Do not use the lens cover anymore; removing the lens cover may change the focus.
Extrinsic Camera Calibration#
Setup#
Arrange the Duckiebot and checkerboard according to Fig. 51. Note that the axis of the wheels should be aligned with the y-axis.

Fig. 51 Extrinsic calibration setup#
Fig. 52 shows a view of the calibration checkerboard from the Duckiebot. To ensure proper calibration there should be no clutter in the background.

Fig. 52 Extrinsic calibration view#
Launch the extrinsic calibration pipeline#
Run:
dts duckiebot calibrate_extrinsics [your_duckiebot_hostname]
First the output will instruct you place your robot on the calibration box and press Enter. If all goes well the program will complete.
And this will automatically save the calibration results on your Duckiebot:
/data/config/calibrations/camera_extrinsic/[your_duckiebot_hostname].yaml
Similar to intrinsic calibration, you can also view or download the calibration file using the Dashboard.
Troubleshooting#
Troubleshooting
SYMPTOM
You see a long complicated error message that ends with something about findChessBoardCorners failed
.
RESOLUTION
Your camera is not viewing the full checkerboard pattern. Most likely part of the chess board pattern is occluded. Possibly you didn’t assemble your Duckiebot correctly or you did not put it on the calibration pattern properly.