Note: This tutorial assumes that you have completed the previous tutorials: Calibrate camera pose to the map frame. |
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. |
Simplify the calibration process for multiple cameras
Description: The camera_pose_toolkits package provides a convenient tool called camera_dispatcher that allows the user to dynamically switch between different cameras. This tutorial shows you how to use it to help manage multiple-camera calibration.Tutorial Level: BEGINNER
Scenario
The scenario is very similar to the previous tutorial, except this time we have multiple wall-mounted cameras to calibrate (localize), and they can be very far apart from each other. Technically, we could just repeat what we did in the previous tutorial for each of the wall camera, which means that we need to restart the single_cam_localization.launch (with different arguments) every time we move to a new camera. A better solution is to launch the localization launch file only once and later dynamically switch cameras.
Operation
Follow the steps in the previous tutorial, but in step 1.6 "Launch camera pose calibration along with camera pose toolkits", type in the following command instead
$ roslaunch camera_pose_toolkits camera_localization.launch new_cam_ns:=wall_cam urdf_cam_ns:=kinect_pr2/rgb mounting_frame:=/map
camera_localization.launch can be found in the camera_pose_toolkits/launch folder. This launch file includes a camera_dispatcher node. wall_cam is actually the user picked output namespace of the dispatcher. The camera dispatcher can relay different camera's image_rect and camera_info messages, based on the selection made through dispatcher_gui.
Then on your local machine, start the gui
$ export ROS_MASTER_URI=http://<your_pr2_name>: $ rosrun camera_pose_toolkits dispatcher_gui.py wall_cam
The argument wall_cam indicates which camera_dispatcher node this gui communicates with. You can select the wall camera you want to calibrate through the drop-down list of the combobox. The gui periodically (every 1 sec) monitors the published topics and repopulate the combobox list with camera namespaces that have '/image_rect' topic.
Tip 1: If you use Kinect or Prosilica camera, make sure each of them is launched from a separate computer, and the ROS_MASTER_URI are remapped to the PR2's.
Tip 2: If you have many cameras to calibrate, make sure each camera is launched with a different namespace; and each camera has a unique optical frame name.
The image below shows the result: the poses of the 3 wall-mounted cameras relative to the 2d map frame.