Skip to main content

Calibrating Teleop-Tongs

Calibrate the Webcam

After setting up your camera, you need to calibrate it.

⚠️ Warning The calibration scripts contain parameters for camera name and resolution. Customize these parameters if necessary.

📝 Note: If you face permission issues with the camera or any other USB device, execute the following commands:

sudo usermod -a -G dialout $USER
newgrp dialout

First, generate a calibration board using the following command:

cd teleop_tongs
python3 webcam_calibration_create_board.py

This should result in the following PNG file.

webcam_aruco_calibration_board.png

Print this image out without scaling it. The resulting printout should match the dimensions specified in the PNG file.

Mount the resulting printout on a flat surface that you can move around the camera to capture calibration images with the ring light turned on.

Use the following command and your calibration pattern to collect calibration images for your Mi USB Webcam. The entire calibration board should be visible and not too far away, or else the calibration images can lead to errors.

python3 webcam_calibration_collect_images.py

The images will be stored in the following directory.

./webcam_calibration_images/<camera name>/<camera resolution>

Once you've collected the calibration images, run the following command to process the images.

python3 webcam_calibration_process_images.py

Processing the images will generate a YAML calibration file similar to the following file.

./webcam_calibration_images/<camera name>/<camera resolution>/camera_calibration_results_20231211211703.yaml

Test the Camera

To make sure that your camera detects the ArUco markers on your tongs, turn on the ring light and run the following code from the root directory.

python3 teleop_example.py

You should see images from the camera with green boxes drawn around detected ArUco markers.