Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Calibrating the PR2's Cameras
Description: Calibrate the PR2's Narrow Stereo, Wide Stereo, Forearm Cams & ProsilicaTutorial Level: BEGINNER
Contents
The wide stereocams, narrow stereocams, prosilica and both forearm cams need to be calibrated periodically.
Stereo Cameras
Launch one of the launch files below, depending on which stereo-pair you are calibrating. Use the large, 7x6 foam checkerboard.
roslaunch pr2_calibration_launch calibrate_narrow_stereo.launch roslaunch pr2_calibration_launch calibrate_wide_stereo.launch
The Stereo Calibration Tutorial provides more details about how to run this calibration.
Warning: Sometimes committing the intrinsics to flash fails. Make sure to look at rxconsole for any errors about writing to flash.
Dual Checkerboards for Narrow Stereo Camera
New in D
Starting in Diamondback, you will be able to use both the large and small checkerboard to calibrate the narrow stereo camera. Use the large checkerboard at a range of about 4m, and the small checkerboard at ranges of 0.7 to 1.5m.
Note: You must hold the small checkerboard horizontally, with the "grip tape" at the top or bottom. Do not tilt the small checkerboard during calibration.
Verifying Stereo Camera Calibration
To check if the stereo cameras are well calibrated, place the large checkerboard in front of the robot about 2-3m from the cameras.
rosrun camera_calibration cameracheck.py stereo:=wide_stereo --size=7x6 --square=0.108
The cameracheck.py tool will print out the epipolar error and square size of the checkerboard. If the epipolar error is less than 0.5 (pixels) the calibration should be OK. The true dimension of the checkerboard is 108mm for each square.
When verifying the narrow stereo camera, run the same procedure as above, replacing "wide" with "narrow". The narrow verification has an extra step to make sure the calibration works for short distances. Hide the large checkerboard from the camera's FOV and run:
rosrun camera_calibration cameracheck.py stereo:=narrow_stereo --size=5x4 --square=0.025
Use the small checkerboard and hold it about 1m from the head. Verify that the epipolar error is less than 0.5 (pixels).
Forearm Cameras
Launch one of the launch files below, depending on which forearm cam you are calibrating. Use the small, 5x4 checkerboard plate:
roslaunch pr2_calibration_launch calibrate_forearm_left.launch roslaunch pr2_calibration_launch calibrate_forearm_right.launch
Using pr2_mannequin_mode can definitely make this this step simpler.
roslaunch pr2_mannequin_mode pr2_mannequin_mode.launch
The Monocular Calibration Tutorial provides more details about how to run this calibration.
Warning: Sometimes committing the intrinsics to flash fails. Make sure to look at rxconsole for any errors about writing to flash.
Verifying Forearm Camera Calibration
If you want to verify the calibration of the forearm cameras, you can use a large checkerboard and a special tool that checks the shape of the checkerboard. Put the robot into mannequin mode, as above.
rosrun camera_calibration cameracheck.py monocular:=l_forearm_cam --size=7x6
Place the large checkerboard approximately 1.5 to 2m away from the camera. The cameracheck.py tool will print out a linearity error. If the error is less than 0.5 (pixels), the camera is well calibrated.
Note: If you use a different or non-standard checkerboard, you will have to input the size and dimension to cameracheck.py
You should also check the focal length for these monocular cameras:
rostopic echo l_forearm_cam/camera_info/P[0]
For both cameras, the focal length should be within [400, 450].
Prosilica Camera
The Prosilica camera on the PR2 is calibrated using the large checkerboard. Open a terminal, and log in to the robot using "ssh -X". Make sure your robot WAN port is plugged in, since the Prosilica camera publishes a lot of data.
roslaunch pr2_calibration_launch calibrate_prosilica.launch
Move the large checkerboard around the FOV of the Prosilica camera in the range of 1.5-2m. Once the "Calibrate" button is enabled, click "Calibrate". (Note that the calibration process after clicking the "Calibrate" button can take a long time, depending on your cpu speed). Once calibration is completed, "Save" and "Commit" buttons should become enabled. Click "Save" then "Commit". The calibration GUI should close automatically.
Verifying Prosilica Calibration
To verify the Prosilica is calibrated, you first need to put the camera in streaming mode:
rosrun dynamic_reconfigure dynparam set_from_parameters prosilica_driver _trigger_mode:=streaming
Then start image_proc, which will rectify the images:
rosrun image_proc image_proc __ns:=prosilica
Then place the large checkerboard in the FOV of the camera.
rosrun camera_calibration cameracheck.py monocular:=prosilica --size 7x6
Place the checkerboard about 1.5m away from the camera. The cameracheck.py tool will print the epipolar error. If it is less than 0.5px, the camera is well calibrated.
Note: If you use a different or non-standard checkerboard, you will have to input the size and dimension to cameracheck.py