Configure PointGrey Cameras for ROS
Inside of the pointgrey_camera_driver
package is a cfg
folder containing PointGrey.cfg
. This file contains configurable parameters for ROS's dynamic reconfigure. All options come with a default value that can be changed to ensure certain settings do not need to be reconfigured after the node starts. When you launch the ROS node, the driver configures the camera to the settings defined in the cfg file. Even if you have altered the settings through Flycapture, they will be overwritten using the default settings defined in the cfg. While the node is running you can use dynamic_reconfigure, available through rqt, to alter the settings until desired outcomes are achieved, but none of these changes are persisted.
NOTE: To ensure changes for PointGrey.cfg
are reflected in subsequent node starts be sure to rebuild the pointgrey_camera_driver
node.
Frame Rate
7 frames per second (FPS) is the default value at start for frame_rate. Changing the default frame_rate will not guarantee that the desired frame rate will be reached. FLIR Cameras will automatically change to the next highest frame rate possible if the frame rate selected is too high. The cap in frame rate is primarily related to amount of data being generated.
Region of Interest
After configuring the frame_rate you may still not get the full fps defined if the Region of Interest (ROI) is too large. Using FlyCapture software you would be able to get 30 FPS at the full camera resolution but ROS messages add extra overhead that has been noted to cause the camera image publish rate to be lower than the camera's defined frame_rate when at full resolution.
Changing the Region of Interest (ROI) allows the user to select a specific portion of an image for the camera to transmit. This results in smaller image sizes as well as more relevant information because you can ignore areas of the images that may not be important to your application (e.g. the hood of a vehicle). Note that ROI has no effect on color processing, since theBayer tilling in the region of interest is left intact.
In PointGrey.cfg
change the parameters for format7_roi_width
and format7_roi_height
to change the size of the region of interest. Change format7_x_offset
and format7_y_offset
to move the region of interest within the full resolution image bounds.
Calculating Bandwidth
FLIR provides a sample calculation in their Knowledge Base article under the 'Calculating Required Bandwidth' section. For simplicity the calculation is provided here:
Height x Width x Frame Rate x Bytes per Pixel = Bandwidth in Bytes per Second
For example here is the calculation for the BFLY-PGE-20E4C-CS which has a max resolution of 1600 x 1200 and typically in Raw8 format which is 1 Byte/Pixel
1600 x 1200 x 30 (FPS) x 1 = 57600000 (54.93 MB)
Configuring Features in FlyCap2 for Linux
Default camera settings can be saved to a memory channel to be loaded when the camera is started. You can save to the Memory Channels through the Advanced Camera Settings tab. Note that saving to the "default" channel resets the camera.
Packet delay can be configured through Flycapture to allow multiple GigE cameras to function on the same network.
GigE Camera's IP Addresses are on the 169.254.x.x IP Subnet out of the box. You can change the IP Addresses of GigE cameras using FlyCap2 by following the directions on FLIR's Knowledge Base Article.
For USB 3.1 cameras, make sure to follow all steps in this Technical Application Note (especially the USBFS section).
Image Consistency Error with Multiple GigE Cameras
Image Consistency errors may be seen when running the PointGrey ROS Driver with multiple GigE cameras, even if they are on separate interfaces.The problem may be due memory buffer issues. In Ubuntu there is a default buffer size for UDP memory you can increase the size of the buffer temporarily by running the following commands. For more information see the Flir (formerly Point Grey) Knowledge Base Article.
sudo sysctl -w net.core.rmem_default=1048576 net.core.rmem_max=16777215 net.core.wmem_default=1048576 net.core.wmem_max=16777215
If the commands improve the problem and image consistency errors are not seen anymore you can set them by adding the following lines to /etc/sysctl.conf
net.core.rmem_default = 1048576 net.core.rmem_max = 16777215 net.core.wmem_default = 1048576 net.core.wmem_max = 16777215