FireWire IEEE1394 cameras

Connect your camera to the computer, which should have a FireWire IEEE1394a or IEEE1394b slot. Then, in Ubuntu, you only need coriander to check that the camera is recognized and working. If it is not already installed, just install coriander. Then, run it (in old Ubuntu distributions, you may have to run it as sudo):

    $ coriander  

It will automatically detect all your FireWire cameras, as shown in the following screenshot:

The great thing about coriander is that it also allows us to view the image and configure the camera. Indeed, our advice is to use the coriander package's camera configuration interface and then take those values into ROS, as we will see later. The advantage of this approach is that coriander gives us the dimensional values of some parameters. In ROS, there are certain parameters that sometimes fail to set, that is, gamma, and they may need to be set beforehand in coriander as a workaround.

Now that we know that the camera is working, we can close coriander and run the ROS FireWire camera driver (with roscore running). The camera driver package can be installed with:

    $ sudo apt-get install ros-kinetic-camera1394  

If it is not available yet on ROS Kinetic, build it from source on a workspace. It can be obtained from https://github.com/ros-drivers/camera1394; simply clone the repository into a workspace and build it.

The camera driver is run with:

    $ rosrun camera1394 camera1394_node  

Simply run roscore and the previous command. It will start the first camera on the bus, but note that you can select the camera by its GUID, which you can see in the coriander package's GUI.

The FireWire camera's supported parameters are listed and assigned sensible values in the camera1394/config/firewire_camera/format7_mode0.yaml file, as shown in the following code:

guid: 00b09d0100ab1324 # (defaults to first camera on bus) 
iso_speed: 800 # IEEE1394b 
video_mode: format7_mode0 # 1384x1036 @ 30fpsbayer pattern 
# Note that frame_rate is overwritten by frame_rate_feature; some 
useful values: # 21fps (480) frame_rate: 21 # max fps (Hz) auto_frame_rate_feature: 3 # Manual (3) frame_rate_feature: 480 format7_color_coding: raw8 # for bayer bayer_pattern: rggb bayer_method: HQ auto_brightness: 3 # Manual (3) brightness: 0 auto_exposure: 3 # Manual (3) exposure: 350 auto_gain: 3 # Manual (3) gain: 700 # We cannot set gamma manually in ROS, so we switch it off auto_gamma: 0 # Off (0) #gamma: 1024 # gamma 1 auto_saturation: 3 # Manual (3) saturation: 1000 auto_sharpness: 3 # Manual (3) sharpness: 1000 auto_shutter: 3 # Manual (3) #shutter: 1000 # = 10ms shutter: 1512 # = 20ms (1/50Hz), max. in30fps auto_white_balance: 3 # Manual (3) white_balance_BU: 820 white_balance_RV: 520 frame_id: firewire_camera camera_info_url:
package://chapter5_tutorials/calibration/firewire_camera/
calibration_firewire_camera.yaml

The values must be tuned by watching the images acquired, for example in coriander, and setting the values that give better images. The guid parameter is used to select the camera, which is a unique value. You should set the shutter speed to a frequency equal to, or a multiple of, the electric light you have in the room to avoid flickering. If outside in sunlight, you only have to worry about setting a value that gives you an appropriate amount of light. You can use a high gain, but it will introduce noise. However, in general, it is better to have salt-and-pepper noise such as that of a low shutter speed (to receive most light), because with a low shutter speed, we have motion blur and most algorithms perform badly with it. As you can see, the configuration depends on the lighting conditions of the environment, and you may have to adapt the configuration to them.

That is quite easy using coriander or the rqt_reconfigure interface (see the following screenshots and the upcoming code, for instance):

    $ rosrun rqt_reconfigure rqt_reconfigure /camera
    $ coriander

In order to better understand how to properly set the parameters of the camera to obtain high-quality images, which are also algorithm-friendly, you are encouraged to find out more about the basic concepts of photography, such as the exposure triangle, which is a combination of shutter speed, ISO, and aperture:

Here, the camera's namespace is /camera. Then, we can change all the parameters that are specified in the camera1394 dynamic reconfigure .cfg file, as shown in Chapter 3, Visualization and Debugging Tools. Here, for your convenience, you can create a launch file, which is also in launch/firewire_camera.launch:

<launch> 
  <!-- Arguments --> 
  <!-- Show video output (both RAW and rectified) --> 
  <arg name="view" default="false" /> 
  <!-- Camera params (config) --> 
  <arg name="params" default="$(find chapter5_tutorials)/
config/firewire_camera/format7_mode0.yaml" /> <!-- Camera driver --> <node pkg="camera1394" type="camera1394_node" name="camera1394_node"> <rosparam file="$(argparams)" /> </node> <!-- Camera image processing (color + rectification) --> <node ns="camera" pkg="image_proc" type="image_proc"
name="image_proc" /> <!-- Show video output --> <group if="$(arg view)"> <!-- Image viewer (non-rectified image) --> <node pkg="image_view" type="image_view"
name="non_rectified_image"> <remap from="image" to="camera/image_color" /> </node> <!-- Image viewer (rectified image) --> <node pkg="image_view" type="image_view"
name="rectified_image"> <remap from="image" to="camera/image_rect_color" /> </node> </group> </launch>

The camera1394 driver is started with the parameters shown so far. It also runs the image pipeline that we will see in the sequel in order to obtain the color-rectified images using the Debayer algorithm and the calibration parameters (once the camera has been calibrated). We have a conditional group to visualize the color and color-rectified images using image_view (or rqt_image_view).

In sum, in order to run a FireWire camera in ROS and view the images, once you have set its GUID in the parameters file, simply run the following command:

    $ roslaunch chapter5_tutorials firewire_camera.launch view:=true

Then, you can also configure it dynamically with rqt_reconfigure.

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

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