areaDetector / aravisGigE

An EPICS areaDetector driver using the glib aravis library for video acquisition with Genicam cameras
GNU Lesser General Public License v3.0
15 stars 15 forks source link

This support module is now archived. Please use https://github.com/areaDetector/ADAravis instead



aravisGigE EPICS Support Module

Introduction

This module is a thin wrapper to the aravis library for industrial cameras the use the GenICam standard. These include 1Gbit Ethernet, 10Gbit Ethernet, and USB3 cameras and detectors.

Support for USB3 cameras was added in R2-2 of this module, when it switched from aravis 0.4.1 to aravis 0.5.13. The module name aravisGigE is now a misnomer, but there are no plans to change the name.

GenICam cameras contain an XML file that can be downloaded via a URL. This XML file contains a description of all of the features that the camera supports, organized in categories. The aravisGigE driver can control any parameter exposed in this XML file. Python scripts are included for creating databases, edm screens, and medm screens from the XML file.

Tested working cameras:

Tested mostly working cameras:

The following is a summary of the files included in aravisGigE:

If you need to add a new camera, read the "Adding a new camera" section

Installation

This araviGigE repository module does not include the underlying aravis library. However, it does include an install.sh script that downloads a version of the aravis library into the aravisGigE/vendor subdirectory, and the top-level aravisGigE/Makefile builds the aravis library and tools, as well as the EPICS aravisGigE library and example IOC.

You are now ready to build the module.

System configuration

In order to run Ethernet cameras without dropping frames it is usually necessary to increase a system buffer. This is particularly true if running multiple cameras from the same Linux machine. The following instructions were copied from a Point Grey/FLIR KnowledgeBase article.

Increase the amount of memory Linux uses for receive buffers using the sysctl interface. 
Whereas the system standard (default) and maximum values for this buffer default to 128 KB and 120 KB respectively, 
increasing both of these parameters to 1 MB significantly improves image streaming results.

Note: On some ARM boards, you may need to increase the receive buffer size to greater than 1 MB before noticing 
improved streaming results. Increasing the buffer size can enhance receive performance, but it also uses more memory.

The following sysctl command updates the receive buffer memory settings:

sudo sysctl -w net.core.rmem_max=1048576 net.core.rmem_default=1048576

Note: In order for these changes to persist after system reboots, the following lines must be manually added 
to the bottom of the /etc/sysctl.conf file:

net.core.rmem_max=1048576
net.core.rmem_default=1048576

Once changes are persisted, they can be reloaded at any time by running the following command in sysctl:

sudo sysctl -p

To use USB3 cameras on Linux, the Point Grey/FLIR KnowledgeBase article 10016 is helpful. It suggests the following (with some minor edits):

To set the maximum usbfs memory limit until the next reboot, run this command:
$ sudo modprobe usbcore usbfs_memory_mb=1000

This method does not work with Ubuntu 14.04 or newer. With Ubuntu 14.04, users must set the memory limit permanently.

To set the maximum usbfs memory limit permanently:
1. Open the /etc/default/grub file in any text editor. Find and replace:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
with this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.usbfs_memory_mb=1000"

2. Update grub with these settings:

On some older Linux systems:
sudo update-grub

On Centos 7, for example:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

3. Reboot and test a USB 3.1 camera.

If this method fails to set the memory limit, run the following command:

$ sudo sh -c 'echo 1000 > /sys/module/usbcore/parameters/usbfs_memory_mb'
To confirm that you have successfully updated the memory limit, run the following command:

cat /sys/module/usbcore/parameters/usbfs_memory_mb

In order for non-root users to access USB cameras on Linux a udev rule must be created to give read/write permission to the selected users or groups. Here is one way to do this:

  1. Download the aravis.rules file from https://github.com/AravisProject/aravis/blob/master/aravis.rules.

  2. Copy the aravis.rules file to /etc/udev/rules.d/.

  3. Run sudo udevadm control -R to restart the udev daemon on RHEL/Centos. The command may be different on other Linux systems.

  4. If restarting the daemon is not sufficient then reboot the PC for the rules file to take effect.

Adding a new camera

Known Bugs

Build Instructions for example IOC

An IOC built using these build instructions is available in iocs/aravisGigEIOC