|Note: This tutorial assumes that you have completed the previous tutorials: ROS tutorials.|
|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.|
How to Configure and Use the WGE100 Stereo Camera on a PR2Description: This tutorial is an introduction to using the WGE100 stereo camera connected to a PR2 robot. After reading it you should be able to bring up the WGE100 stereo camera and display the images.
Keywords: stereo, camera, driver
Tutorial Level: BEGINNER
Next Tutorial: How to calibrate a stereo camera How to process stereo images
Typically there will be no need to launch the stereo camera configuration on the PR2 because it is launched at startup with the rest of the robot. Most users should skip directly to Viewing Stereo Images. In the case that the stereo camera configuration is not loaded, the following launch files will need to be launched.
If PR2 is not started
If the robot is not up and able to move (i.e. pr2_etherCAT is not running) you will need to launch the robot:
$ sudo robot start
This should bringup the stereo cameras and you can proceed to the Viewing Stereo Images step unless you need to start the stereo cameras independently or just want to learn more about what happens behind the scenes.
If PR2 is already started
If the robot is up and able to move (i.e. pr2_etherCAT is running) but the stereo cameras were not brought up, you will need to launch the dual stereo configuration:
$ roslaunch pr2_bringup config/dualstereo_camera.launch
This launch file loads the following:
A wge100_camera_node per WGE100 camera.
A wge100_multi_configurator for each stereo pair, which replicates its parameters to each camera's driver.
Stereo image processing for each stereo pair
pr2_controller_manager with suitable controllers running:
One MultiTriggerController per WGE100 camera trigger line (i.e.one for both of the stereo cameras).
A pr2_camera_synchronizer node in charge of setting the triggers and camera drivers into triggering states that are consistent with the user's desires. This is important for stereo cameras firing at the same time and controlling the relationship between the texture projector and the camera exposure.
Calibrating the Stereo
Before you can reconstruct depth from a pair of stereo images, the cameras need to be calibrated. The robots initially ship with calibrated stereo cameras, but this calibration can degrade or be lost over time. If you need to calibrate your stereo cameras, see the tutorial.
Viewing Stereo Images
stereo_view stereo:=<stereo namespace> image:=<image topic identifier>
For example, to view stereo image pairs on topics /my_stereo_cam/left/image_rect_color and /my_stereo_cam/right/image_rect_color, use:
$ stereo_view stereo:=/my_stereo_cam image:=image_rect_color
stereo_view also shows the disparity image computed from the stereo pair, color-mapped for clarity.
You may save the current image pair by left-clicking on either display window. By default, images will be saved as left0000.jpg, right0000.jpg, left0001.jpg, right0001.jpg....
On the robot, you can view the unrectified images from the monochrome, narrow field-of-view stereo pair with:
$ stereo_view stereo:=narrow_stereo image:=image_raw
Or you could view the unrectified color images from the color, wide field-of-view stereo pair with:
$ stereo_view stereo:=wide_stereo image:=image_color
Using the Texture Projector
To improve the effectiveness of stereo reconstruction, the PR2 is equipped with a projector that can project a texture onto featureless surfaces. The easiest way to use the projector is from a dynamic reconfigure GUI:
rosrun dynamic_reconfigure reconfigure_gui camera_synchronizer_node
You can then decide, for each camera, what its _trig_mode setting should be. For example, to start streaming textured images on narrow_stereo_textured, set narrow_stereo_trigger_mode to WithProjector. The PR2's texture projector should turn on, and you should be able to see unrectified textured images with:
$ stereo_view stereo:=narrow_stereo_textured image:=image_raw
Note: narrow_stereo_textured and narrow_stereo will only be streaming images when the camera is taking images with the correct projector state. For example, if the projector is off, there will be no images on narrow_stereo_textured.
To learn about other ways of using dynamic reconfiguration to change a node's settings, look at this tutorial
For an in depth view of the PR2's camera systems and how to configure them, you can refer to the pr2_camera_synchronizer documentation.