From MobileRobots Research and Academic Customer Support
The camera video signal is usually connected to an analog "framegrabber" device on the onboard computer. The four types of framegrabbers sold with robots by MobileRobots are the following:
- an analog framegrabber (creates digital images from an analog video signal) on a PC-104 card attached to an onboard computer (such as the Sensoray SX-311). This is the image capture device used with the Canon VCC pan/tilt camera.
- an IEEE-1394 (Firewire) interface (also a PC-104 card),
- a Sensoray 2553 USB analog framegrabber,
- an ethernet camera or framegrabber (e.g. Axis M7001) connected either to the secondary ethernet port on the onboard computer or to the robot's internal ethernet network.
- the MobileRanger stereo camera has its own nDepth processing board on the computer, with its own driver (older "focus" or newer "eagle" driver) that provides a set of v4l video devices (/dev/video0, /dev/video1, /dev/video2, etc.) providing raw, calibration and depth map images.
- another camera, if it happens to work with Linux V4L or Windows VFW (this depends on the camera).
For IEEE-1394 (FireWire) devices, use the operating system's standard Firewire libraries (e.g. the Linux libdc1394 Library). You can use the Coriander application to test the camera and settings. (If the camera is a stereo camera, use the stereo camera libraries instead).
For Axis ethernet cameras and devices, use an HTTP library such as libcurl or similar to request images from the device's web server.
To obtain images from the an analog framegrabber on the onboard computer (e.g. Sensoray SX-311) and from MobileRanger's nDepth board, there are several options:
- Write a program using OpenCV (available for Windows, Linux and Mac). OpenCV is a large framework and toolbox for advanced image/machine vision processing, with a particular focus on robotics. See the VideoCapture class to capture images from the framegrabber.
- Write a program using the standard Linux Video4Linux capture API (for analog framegrabber)
- Write a program using the Linux libdc1394 Library library (for IEEE-1394/Firewire camera)
- Choose from a variety of Linux tools, such as the xawtv tools: "streamer" for example simply captures images and saves them to a file; "webcam" captures images and uses FTP or SSH to copy them to another computer; etc.
- ACTS does color-based object tracking on the capture image, and also provides the images to a remote program using ArNetworking. ACTS supports the three types of devices listed above.
- SAVServer encodes captured images using JPEG and sends them to a remote program using ArNetworking. SAV supports a PC-104 framegrabber on the onboard computer.
- Use the Linux "Coriander" application to view images and try different settings
- Write a program using the MobileRobots VisLib library for Linux, which captures video and provides a simple infrastructure for processing the images. Note, however, VisLib is no longer actively maintained or developed.
- Write a program using libfg on Linux
- Write a program using other video capture APIs
More about using SAVServer
savServer is a program which opens the framegrabber and provides images using ArNetworking on port 7070. It is part of the "SAV" package which may be downloaded from the support website, and which also contains a client program which displays the images. MobileEyes is also able to display the images. ArNetworking includes an example program called
getVideoExample which connects to the server using ArNetworking and requests images at a regular interval, and saves them to a file. You can find it in the
Aria/ArNetworking/examples directory. Run it like this:
getVideoExample -host host -port 7070 -rate 10
Where host is the hostname or IP address of the robot running savServer, or
localhost if running on the same computer. The rate is the number of images to request per second. It may be a fraction (e.g. 10.5). Note that if the rate is too high, you may exceed the capability of the network and software to transfer the image in time.
You can also save the images in a series of files rather than one, by supplying the -counter option. Use -help for a list of all options and tips.
See also: How can I make a movie from image files?
To connect to savServer on port 7070 with MobileEyes, use "host:7070", where host is the hostname or IP address of the robot computer running savServer. For example, 10.0.151.32:7070 or robot.local:7070
Some SAVServer options can be configured by editing SAVconfig.txt.
If you run savServer, then run arnlExample, sonarnlExample, or mogsExample on the same computer, then the ARNL server will first connect to the savServer, and relay all video requests and replies between its client and savServer. This allows a program such as getVideoExamlpe or MobileEyes can connect to the ARNL server (on its normal port) and request video images, which are forwarded from savServer. (Internally, it uses the ArHybridVideoForwarder class to do this.)
More about Coriander
"coriander" is a tool for viewing images and testing DC1394 (Firewire) cameras under Linux. Several cameras that MobileRobots includes with robots are DC1394 including the Bumblebee and PowerCube-Arm camera. DV Firewire video cameras (camcorders) will 'NOT work with coriander.
- If Coriander is not yet installed, install it with apt-get (robot must be connected to the internet). All robots with Debian 5, and later robots with Debian 3.1 and with 1394 cameras such as the Bumblebee stereocamera have Coriander preinstalled.
- verify the camera is plugged in and powered on (check for its power LED; you may need to use one of the robot's AUX power switches to turn it on)
- double click the desktop icon or type 'coriander' into a terminal
- click on the services tab
- Choose the appropriate format
- For the Bumblebee stereo camera: select Format 7 from the formats menu; under the format 7 tab reduce max packet size (using the slider) to just below maximum
- Select the capture method, in the Method menu (at the bottom)
- For most-efficient transfer, select Video1394
- select "downsample" from the Bayer filter selection
- For a stereo camera, select the stereo-vision type
- start or restart the ISO stream (important)
- in the "pipeline" row of buttons: click the "Receive" button to begin reading data from the camera (not yet visible until next step) - the number shown under the button is the framerate,
- in the "pipeline" row of buttons: then click "Display" and you should see a display of the video images.
Coriander displays the modes that your DC1394 camera reports as supported. Limits on the onboard computer resources may cause instability. Try enabling framedropping, or reducing the frame count. Always restart the ISO stream after making changes. Remember coriander is only providing an interface to the libdc1394 library, and it will be faster to use this library directly for custom application.
Other video viewing programs and libraries
Other programs that can be useful to check the operation of the camera and framegrabber are:
- xawtv for Linux
- mplayer for Linux (see http://www.mplayerhq.hu/DOCS/HTML/en/tv-input.html)
Some development libraries that might be useful are
I get a blue image from my frame grabber. What's wrong?
If you get a blue image from the frame grabber, it means that the frame grabber is working, but does not get a video signal. This can be because of lack of signal from the camera or because you are using the wrong channel on the frame grabber.
Make sure that the camera power is switched on. On most robots camera power is controlled by the AUX1 switch on the user interface panel on the side or top of the robot. Sony cameras have a power switch on the camera as well. Check that the power and video cables are connected to the camera. When a Canon VCC4 or VCC5 camera has power, a green LED will light on the front of the camera base.
The frame grabber has two channels. Usually the camera is connected to channel 0, but you can try different channel numbers in ACTS with the -n comand line option. E.g. to use channel 1, run acts like so:
$ acts -n 1
Once you find the correct channel, edit the Acts.pref file appropriately.
If you are using a PAL format camera, you must use the correct parameter in your software, e.g. in ACTS the "PALCamera" parameter must be false for NTSC, true for PAL.
I get an error about finding or opening the device when a program tries to open the video device. What's wrong?
Check that either the bttv driver (Linux 2.4/RedHat 7) or v4l driver (Linux 2.6/Debian Linux 3 and later) is installed properly:
- type this command: dmesg | grep bttv
- or this command for v4l: dmesg | grep v4l
- Do you see log messages indicating that the driver loaded and found the Sensoray 311 framegrabber card. E.g.:
bttv: driver version 0.7.91 loaded bttv: using 2 buffers with 2080k (4160k total) for capture bttv: Host bridge is Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX Host bridge bttv: Host bridge needs ETBF enabled. bttv: Bt8xx card found (0). bttv0: Bt878 (rev 17) at 00:09.0, irq: 9, latency: 64, memory: 0x82000000 bttv0: detected: Sensoray 311 [card=73], PCI subsystem ID is 6000:0311 bttv0: using: BT878(Sensoray 311) [card=73,insmod option] bttv0: enabling ETBF (430FX/VP3 compatibility) bttv0: i2c: checking for MSP34xx @ 0x80... not found bttv0: i2c: checking for TDA9875 @ 0xb0... not found bttv0: i2c: checking for TDA7432 @ 0x8a... not found bttv0: registered device video0 bttv0: registered device vbi0
The important things to check are that bttv or v4l reports that a card is found, and reports that detected or is using a certain device (Sensoray 311 [card=73] in the example above). If you do not see this output, or if it says there are no cards found, or other errors then you have a problem with your driver installation. See Linux Video Drivers and Contact Support for help.
The device is named /dev/video0
How can I tell if my frame grabber is working?
The easiest way to test the frame grabber is to use ACTS or ACTS Demo or a video viewing program (e.g. Coriander (see above) or xawtv in Linux or one of the example programs in Windows) to try to see the camera image. If you get a blue image, the frame grabber is working, but gets no signal.
How do I install drivers for the frame grabber?
I get a scrambled image in software using the analog framegrabber
The image provided by the analog framegrabber is a raw YUV image at a resolution of 320x240, make sure your software is configured to expect that or automatically detect this format. (For example, for the gscam driver in ROS, set environment variable GSCAM_CONFIG="v4l2src ! video/x-raw-yuv, width=320, height=240 ! ffmpegcolorspace" before running gscam.)
The input from the camera is NTSC. You can reconfigure the framegrabber if it has changed with the following command:
v4l2-ctl -s ntsc