Care-O-Bot: Configuring the Allied Vision Technologies Prosilica GC1380CH GigE Camera Pair

Many of the hints summarized on this page originate from the AVT knowledge base (http://www.alliedvisiontec.com/de/support/knowledge-base.html) and the available documentation.

Configuration of the Ethernet Connection

  • Camera setup is done as described in Tutorials for the Prosilica camera. In standard configuration, the right camera, which is the master camera, should have the IP 192.168.21.101 and the slave camera on the left side should receive the address 192.168.21.102.

  • Helpful tools are part of the prosilica_gige_sdk package. They directly access the camera hardware and don't need a running prosilica node. ListCameras helps to find the available cameras. Use CLIpConfig to configure the IP addresses of the cameras:

     rosrun prosilica_gige_sdk CLIpConfig -l
    gives you the 6 digit Unique IDs of your cameras. Then type
     rosrun prosilica_gige_sdk CLIpConfig -u <insert Unique ID of right camera> -s -m FIXED -i 192.168.21.101 -n 255.255.0.0
     rosrun prosilica_gige_sdk CLIpConfig -u <insert Unique ID of left camera> -s -m FIXED -i 192.168.21.102 -n 255.255.0.0

    The remainder of camera parameters can be accessed with the SampleViewer. After configuring the ethernet successfully, you can determine the IP addresses and camera IDs with the tool:

     rosrun prosilica_gige_sdk ListCameras

    (If you receive an error message like ./ListAttributes: error while loading shared libraries: libPvAPI.so: cannot open shared object file: No such file or directory follow this work-around: As root, create a file /etc/ld.so.conf.d/libPvAPI.conf with contents /opt/ros/diamondback/stacks/camera_drivers/prosilica_gige_sdk/lib [you might have to adapt this to your path] and run sudo ldconfig)

  • Specifically for the Care-O-Bot you should make sure that the ethernet adaptor to the cameras has an appropriate IP address. The cameras should be connected to computer 2. To check the IP address of its adapter, ssh to computer 2 and use ifconfig:
     ssh -X root@cob3-3-pc2
     ifconfig
  • The standard IP address for the ethernet adapter to the cameras is 192.168.21.99. To yield this configuration automatically, open the file /etc/network/interfaces and add the following lines of code to it (where eth1 is supposed to be the ethernet adaptor to which the cameras are connected - please change if else on your robot!):
     auto eth1  
     iface eth1 inet static
     address 192.168.21.99   # IP of network adapter to cameras
     netmask 255.255.0.0   # netmask
  • If you do not obtain the correct network configuration for your network adaptor to the cameras after rebooting, you should turn off or uninstall the network-manager package (sudo apt-get remove network-manager) or use the following commands after booting the computer.
     sudo ifdown eth1
     sudo ifup eth1
  • You might have to change the configuration of the IP addresses in the respective configuration file of the camera driver. You can find those files in the folder of the cob_hardware_config package at cob_hardware_config/cob3-x/config/cameras/. Open the files parameters_right.yaml and parameters_left.yaml. In those configuration files, find the following line and adapt the IP address to your left and right camera's address, respectively:

     ip_address: 192.168.21.101
  • You can verify the correctness of your ethernet configuration by displaying both camera images. Please follow the Quick Launch Guide.

  • If the LEDs on the cameras flash but no image can be acquired, try to detach and re-attach the ethernet connector at both cameras.

Performance Optimization

To obtain the best performance with the prosilica cameras you should apply the following optimization steps (also written at http://www.alliedvisiontec.com/de/support/knowledge-base.html?tx_nawavtknowledgebase_piList[uid]=8&tx_nawavtknowledgebase_piList[mode]=single).

Configure the Network to use Jumbo Frames

  • The MTU of the GigE ethernet adaptor of the Care-O-Bot should be changed to accommodate for Jumbo frames. This is necessary at the PC on the Care-O-bot which is directly connected to the camera switch (usually this is PC2, so log on PC2 for the following modifications). Jumbo Frames support is enabled by changing the MTU to a value larger than the default of 1500. You can use the ifconfig command to increase the MTU size each time after rebooting your robot with
     sudo ifconfig ethx mtu 9000
    where ethx is the adapter name (e.g. eth1) and 9000 the maximum size of the frames to be used by the camera. To find out the number x of the ethernet adaptor, enter
     ifconfig
    and use that adaptor with IP=192.168.21.99. This one connects to the camera switch.

    To set these settings at boot time under Ubuntu Linux, create the file /etc/network/if-up.d/cob_mtu

     sudo gedit /etc/network/if-up.d/cob_mtu
    and add the lines
     #!/bin/sh
     ifconfig eth1 mtu 9000
    to it. Replace eth1 by the used adaptor for the camera switch if else. Make the file executable by
     sudo chmod +x /etc/network/if-up.d/cob_mtu
    Finally, restart the network interface by
     sudo ifdown eth1
     sudo ifup eth1
  • Enable the use of Jumbo frames in the switch that connects the cameras to the computer:
    • In case of the Cisco SLM2008 Switch attach a network cable from your notebook to the switch, reconfigure your IP with
    •   sudo ifconfig eth0 192.168.1.32
      and open 192.168.1.254 in a web browser. After entering admin as username and password you will be presented with a user interface for changing the settings of the switch. Go to Port Configuration and enable Jumbo frames at the check box and set speed of all ports to 1000Full. Then save your changes.
    • In case of the Cisco SG200-8 Switch attach a network cable from your notebook to the switch, reconfigure your IP with
        sudo ip a a 192.168.1.1/24 dev eth0

      and open 192.168.1.254 in a web browser. After entering "cisco" as username and password you are forced to change the password first (please use the password "care-o-bot"), then you will be presented with a user interface for changing the settings of the switch. Go to "Port Management" -> "Port Settings". Select g1 and press "Edit...". Set the MTU to 9216 and press "Apply". Copy the settings to all other ports g2-g8 with "Copy Settings...". Then save your changes by clicking "Save" in the top right corner.

  • Finally, start the SampleViewer tool from the prosilica_gige_sdk package to enable Jumbo frames in the camera settings. For each camera, open the properties dialogue and set the property PacketSize to 9000. Do not forget to store your changes by selecting a slot and storing the setting on the camera memory. This setting should be loaded on startup, so adjust the startup slot setting to be the same number and not factory.

Then check whether you can still receive images from your camera using the launch files or the SampleViewer tool. Depending on the capabilities of the ethernet adaptor you might have to decrease the MTU value from 9000 to 6000 or 4000. If set to a lower value, the camera's PacketSize should be adjusted accordingly. Just try it out until you actually receive images. You should not test with two cameras simultaneously before you followed the stereo setup, especially the GigE/StreamBytesPerSecond has to be set appropriately to receive any images.

Reduce the Number of CPU Interrupts

You can reduce the number of CPU interrupts to decrease its workload caused by the camera. Just open the file /etc/modprobe.d/e1000e.conf and add the line

options e1000e InterruptThrottleRate=1000,1000

Allocating Rx Buffers when Using Jumbo Frames

Allocating Rx buffers when using Jumbo Frames on 2.6.x kernels may fail if the available memory is heavily fragmented. This issue may be seen with PCI-X adapters or with packet split disabled. This can be reduced or eliminated by changing the amount of available memory for receive buffer allocation, by increasing /proc/sys/vm/min_free_kbytes. It should be the same as the Jumbo frame size. Open the file /etc/sysctl.conf and append the line

vm.min_free_kbytes=9000

at the end.

Stereo-Configuration of the Camera Pair

After succeeding with the network configuration we can now check or set the optimal settings for the stereo mode of both Prosilica cameras (see also hints at http://www.alliedvisiontec.com/de/support/knowledge-base.html?tx_nawavtknowledgebase_piList[uid]=6&tx_nawavtknowledgebase_piList[mode]=single).

For the Care-O-Bot we define the right camera to be the master camera (IP=192.168.21.101) and the left camera to be the slave (IP=192.168.21.102). The right camera is the camera on the right side when looking at the robot from behind. On the Care-O-Bot platform there should be an external trigger wire from the master camera to the slave camera.

If you use the Care-O-Bot launch files prosilica_left.launch and prosilica_right.launch from cob_bringup/components/ for starting the cameras, you do not have to adjust anything since the correct settings are already prepared in the parameters_left.yaml and parameters_right.yaml files, which you can find in cob_hardware_config/ROBOT/config/cameras (dependent on your robot model, you replace the folder ROBOT by the value chosen for the ROBOT variable, e.g. when you have the Care-O-bot 3-2 you use folder cob3-2).

  • [For cob3-4 the settings "ImageFormat/PixelFormat", "Acquisition/Trigger/FrameStartTriggerMode" (only slave=left) and "IO/SyncOut/1/SyncOut1Mode" (only master=right) are set directly in camera memory slot 1. All other settings must be set on runtime by the prosilica_camera node]

However, we recommend that you check the settings once after starting the launch files. Use the ListAttributes <IP-address of your camera> tool from the prosilica_gige_sdk package to compare the actual settings with the desired settings. Especially, check whether the following settings are correct:

Slave camera (left camera, IP=192.168.21.102):

  • Acquisition/Trigger/FrameStartTriggerMode: SyncIn1

  • Controls/Exposure/ExposureMode: Auto
  • Controls/Exposure/Auto/ExposureAutoMax: 25000
  • Controls/Exposure/Auto/ExposureAutoTarget: 40
  • Controls/Gain/GainMode: Auto
  • Controls/Gain/Auto/GainAutoTarget: 40
  • Controls/Whitebalance/WhitebalMode: Auto
  • PacketSize: 9000

  • StreamBytesPerSecond: 55000000

  • ImageFormat/PixelFormat: BGR24

Master camera (right camera, IP=192.168.21.101):

  • Acquisition/Trigger/FrameStartTriggerMode: Freerun
  • Controls/Exposure/ExposureMode: Auto
  • Controls/Exposure/Auto/ExposureAutoMax: 25000
  • Controls/Exposure/Auto/ExposureAutoTarget: 40
  • Controls/Gain/GainMode: Auto
  • Controls/Gain/Auto/GainAutoTarget: 40
  • Controls/Whitebalance/WhitebalMode: Auto
  • PacketSize: 9000

  • StreamBytesPerSecond: 54000000

  • IO/SyncOut/1/SyncOut1Mode: Exposing
  • ImageFormat/PixelFormat: BGR24

If you do not want to use the Care-O-Bot launch files, you should set the required parameters in the camera memory directly. Start the SampleViewer utility from the prosilica_gige_sdk package, select each camera and open the properties dialogue. Depending on the mode of the respective camera (master/slave) you should set the settings listed above.

The packet size parameter defines the size of Jumbo frames. You should use the same value as for the switch and ethernet adaptor. StreamBytesPerSecond is very important to be set since you have a bandwidth around 120000000 to distribute among your devices. You will not receive images if all your devices together need more bandwidth than this value. If the master triggers the slave, make sure that the master has a little lower bandwidth than the slave so that both arrive at the same frame rate. If you do not have an external trigger, set the FrameStartTriggerMode property of the slave to Freerun as well.

With the ExposureAutoMax parameter you can specify the maximal exposure time in microseconds, which should not be too high if you like to have stereo cameras well synchronized. The ExposureAutoTarget parameter specifies the target value of the mean intensity. It ranges between 0 (=black) and 100 (=white). For best synchronization, turn ExposureMode to Manual and set an appropriate value for exposure (in seconds) in the yaml file. Also make sure that auto_adjust_stream_bytes_per_second is set to False in the yaml files to avoid automatic bandwidth adaptation which does not work properly with stereo rigs.

Save your changes on camera memory by selecting a slot in the ConfigFile/ConfigFileIndex property and save it via ConfigFile/ConfigFileSave. You should load this configuration on power up, so choose the same index for the ConfigFile/ConfigFilePowerUp property.

Calibration of the Camera Pair

Please use the automatic calibration tool for Care-O-bot which is available with the cob_calibration package.

Wiki: cob_camera_sensors/AVT_Prosilica (last edited 2012-07-19 11:11:40 by NadiaHammoudeh)