Note: This tutorial assumes that you have completed the previous tutorials: ROS tutorials. |
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 Connect to an IEEE 1394 Camera
Description: This tutorial is an introduction to using a digital camera connected to an IEEE 1394 bus. It explains how to connect to a 1394 camera, configure it, and display the images.Tutorial Level: BEGINNER
Next Tutorial: Setting Parameters Dynamically
Contents
Compiling
Start by getting the dependencies and compiling the driver.
$ rosdep install camera1394 $ rosmake camera1394
Attaching a Camera
This driver only supports cameras meeting the IIDC standard. Attach the camera to the IEEE 1394 interface using an appropriate cable. If you are not familiar with IEEE 1394 cables and connectors, see the Wikipedia entry, which explains the various standards and versions. Most cameras can receive power from the bus, but the 4-pin cable connectors found on many laptops do not provide power. In that case, provide power to the camera over whatever separate connector is provided by the manufacturer.
Checking Connectivity with Coriander
Usually, the best tool for checking connectivity to IIDC cameras is coriander.
To install it on Ubuntu systems:
$ sudo apt-get install coriander
Other Linux distributions provide some similar command.
Run the coriander program:
$ coriander
This should bring up a graphical interface. The Camera Select pull-down shows all IIDC cameras attached to the computer.
Coriander may fail with a permission error on many Linux distributions. If so, change the permissions for /dev/raw1394 to allow access for your user ID.
Select the desired camera. Note the sixteen hexadecimal digits of its GUID, in this example, 08144361026320a0.
Now click on the Services tab. The Format pull-down lists the video formats provided by that device.
Select the desired mode, the ISO Control speed, and frames per second (fps) rate. Then, verify that the camera works by pressing the Display button.
Running the Camera1394 Driver
Now, start the camera1394 driver using the parameters discovered by coriander.
$ rosrun camera1394 camera1394_node _guid:=08144361026320a0 _video_mode:=640x480_mono8 _iso_speed:=400 _frame_rate:=30 [ INFO] [1276368181.508444956]: Found camera with GUID 8144361026320a0 [ INFO] [1276368181.508796118]: camera model: Unibrain Fire-i BCL 1.2 [ INFO] [1276368181.512701922]: [08144361026320a0] opened: 640x480_mono8, 30 fps, 400 Mb/s [ WARN] [1276368181.737658512]: [08144361026320a0] calibration does not match video mode (publishing uncalibrated data)
Ignore the warning message for now. Later, we'll cover camera calibration.
This shows the topics being published:
$ rostopic list
The list should include (at least):
/camera/camera_info /camera/image_raw /camera1394_node/parameter_descriptions /camera1394_node/parameter_updates
Viewing the Raw Images
First, build image_view. In a new window, run:
$ rosmake image_view
Then, run image_view to see the images being published:
$ rosrun image_view image_view image:=camera/image_raw
We started the camera with all of its default settings. For some cameras that generates a good image automatically. Others may require parameter adjustments. Later tutorials explain how to set them.
If you have a color camera, the image may be black and white with a strange texture. Many IIDC color cameras publish images using a Bayer pattern. If the camera does use Bayer filtering, you'll want to read the Setting Bayer Parameters tutorial. If the camera does not use Bayer encoding, you can skip that one.
Starting the ROS Image Pipeline
First, build image_proc. In a new window, run:
$ rosmake image_proc
Then, run image_proc in the camera namespace to process the images being published:
$ ROS_NAMESPACE=camera rosrun image_proc image_proc
This should not output any messages if it's working correctly. But, it should publish a whole list of new topics. To verify that, in another window, run:
$ rostopic list
The list of topics should now include these (and perhaps some others):
/camera/image_color /camera/image_mono /camera/image_rect /camera/image_rect_color
To view the image_proc output, in another terminal run:
$ rosrun image_view image_view image:=camera/image_mono
The image_color topic requires us to configure the camera to produce color images. The image_rect and image_rect_color topics require us to calibrate the camera. Those tasks are explained in later tutorials.
Setting Camera Parameters
To view some these other topics, we need to set some more camera parameters. Please continue with the Dynamic Configuration tutorial.