USB cameras

Now we are going to do the same thing with USB cameras. The only problem is that, surprisingly, they are not inherently supported by ROS. First of all, once you have connected the camera to the computer, test it with a chat or video meeting program, for example, Skype or Cheese. The camera resource should appear in /dev/video?, where ? should be a number starting with 0 (that may be your internal webcam if you are using a laptop).

There are two main options that deserve to be mentioned as possible USB camera drivers for ROS. First, we have usb_cam. To install it, use the following command:

    $ sudo apt-get install ros-kinetic-usb-cam  

Then, run the following command:

    $ roslaunch chapter5_tutorials usb_cam.launch view:=true  

It simply does rosrun usb_cam usb_cam_node and shows the camera images
with image_view (or rqt_image_view), so you should see something similar to
the following screenshot. It has the RAW image of the USB camera, which is already in color:

Similarly, another good option is gscam, which is installed as follows:

    $ sudo apt-get install ros-kinetic-gscam  

Then, run the following command:

    $ roslaunch chapter5_tuturials gscam.launch view:=true  

As for usb_cam, this launch file performs a rosrun gscam and also sets the camera's parameters. It also visualizes the camera's images with image_view (or rqt_image_view), as shown in the following screenshot:

The parameters required by gscam are as follows (see config/gscam/logitech.yaml):

gscam_config: v4l2src device=/dev/video0 !video/x-rawrgb,
framerate=30/1 ! ffmpegcolorspace frame_id: gscam camera_info_url:
package://chapter5_tutorials/calibration/gscam/
calibration_gscam.yaml

The gscam_config parameter invokes the v4l2src command with the appropriate arguments to run the camera. The rest of the parameters will be useful once the camera is calibrated and used in the ROS image pipeline.

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

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