Note: This tutorial assumes that you have completed the previous tutorials: Connecting to the Camera.
(!) 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 Set IEEE 1394 Camera Parameters Dynamically

Description: This tutorial explains how to use dynamic reconfigure to change IEEE 1394 camera driver parameters.

Tutorial Level: BEGINNER

Next Tutorial: Setting Bayer Color Parameters Configuring Features

Preliminary Steps

Start the camera1394 driver, image_view, and image_proc as described in the previous Connecting to an IEEE 1394 Camera tutorial.

Running the Reconfigure GUI

Parameters for the camera driver we started in the previous tutorial can be altered at any time using the rqt_reconfigure GUI:

$ rosrun rqt_reconfigure rqt_reconfigure

This brings up a window like this:

Camera1394-GUI.png

For now, let's concentrate on the parameters we discovered with coriander and used to start the camera:

  • guid

  • video_mode

  • frame_rate

  • iso_speed

Resetting these parameters causes the driver to close and then re-open the device. So, you should leave them alone while downstream nodes are actively processing the image data stream. The image_pipeline nodes will normally handle any changes correctly.

The important thing to understand about these parameters is that although the interface allows many possible settings, most will not work with your specific camera. Setting illegal values is likely to cause the camera to stop responding. Many cameras will start streaming data again as soon as they receive valid settings. Others may need various kinds of resets. The TroubleShooting page lists several techniques for getting stuck cameras working again.

One way to avoid this problem is to select only values that showed up when viewing the camera with coriander. Another is to consult the technical manual for your camera.

New in Diamondback Recent versions of the driver will only set video_mode and frame_rate to values actually supported by the camera, making it easier to experiment with different settings without hanging the device.

Bus Bandwidth

The IEEE 1394 bus provides "isochronous" bandwidth reservation for real-time devices such as cameras. This guarantees that bus resources will be available when the camera needs to send data.

Older 1394a buses have a total of 400 Megabits/second available, the default iso_speed. If your bus interface, cable and camera all support the newer 1394b standard, you can change iso_speed to 800, although the default setting will probably work.

It is important never to configure the device to use more bandwidth than is available on the bus. The camera's bandwidth usage depends on its video_mode (both image size and number of bits per pixel) and frame_rate. If you set an invalid combination of these parameters, the camera driver will log an error message, and stop streaming images. If that happens, back off to less resource-intensive values for those parameters.

Ignoring packet overhead, the bandwidth for a specific video_mode (in bits per second) is approximately: frame_rate * width * height * bits_per_pixel. The number of bits per pixel is determined by the color type:

  • mono8: 8 bits

  • yuv411: 12 bits

  • yuv422: 16 bits

  • yuv444: 24 bits

  • rgb8: 24 bits

If multiple cameras are active on the same bus, their combined bandwidth cannot exceed 80% the total iso_speed of the bus.

Color Images

Some cameras produce raw color images using one of the rgb8, yuv422, yuv444 or yuv411 modes. Check with coriander or the camera technical documentation to see which are supported.

If one of them is, change video_mode to one the camera provides. At that point the image_view should show color images for the camera/image_raw topic. You should also see color data by viewing the camera/image_color topic like this:

$ rosrun image_view image_view image:=camera/image_color

Some cameras use Bayer encoding for color information. The Setting Bayer Color Parameters tutorial explains how to configure that. If your camera uses Bayer encoding, read that tutorial next.

Otherwise, skip the Bayer tutorial and proceed directly to the Configuring Features tutorial.

Wiki: camera1394/Tutorials/SettingIEEE1394CameraParametersDynamically (last edited 2013-04-07 18:08:03 by ArjunIyer)