Simulating stereo and mono cameras in Gazebo

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 command to launch the simulations for a mono camera:

$ roslaunch sensor_sim_gazebo camera.launch 

You can use the following command to launch the simulations for a 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 

You should see the image window as shown here:

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 will display two image windows from each camera of the stereo camera, as shown here:

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 here, in our repository: https://github.com/PacktPublishing/ROS-Robotics-Projects-SecondEdition/tree/master/chapter_10_ws/sensor_sim_gazebo/urdf.

The lib_gazebo_ros_camera.so plugin is used to simulate a mono camera and libgazebo_ros_multicamera.so for a stereo camera. We will now learn how to interface the cameras with ROS. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.175.180