In the previous section, we discussed laser scanner simulation. In this section, we will see how to simulate a camera. A camera is an important sensor for all kinds of robots. We will see how to launch both mono and stereo camera simulations. You can use the following commands to launch the simulations.
Mono camera:
$ roslaunch sensor_sim_gazebo camera.launch
Stereo camera:
$ roslaunch sensor_sim_gazebo stereo_camera.launch
You can view the image from the camera either using Rviz or using a tool called image_view
.
You can look at the mono camera view using the following command:
$ rosrun image_view image_view image:=/sensor/camera1/image_raw
Figure 18: Image from simulated camera
To view images from a simulated stereo camera, use the following commands:
$ rosrun image_view image_view image:=/stereo/camera/right/image_raw $ rosrun image_view image_view image:=/stereo/camera/left/image_raw
This commands will display two image windows from each camera of the stereo camera, which is shown here:
Figure 19: Image from simulated stereo camera
Similar to the laser scanner plugin, we are using a separate plugin for mono and stereo cameras. You can see the Gazebo plugin definition in sensor_sim_gazebo/urdf/camera.xacro
and stereo_camera.xacro
.
The lib_gazebo_ros_camera.so
plugin is used to simulate a mono camera, and libgazebo_ros_multicamera.so
for a stereo camera.
3.145.38.117