ADPylon

author:

Xiaoqiang Wang, Paul Scherrer Institute

Overview

This is an areaDetector driver for GenICam cameras using the Pylon library.

GenICam is a Generic Interface for Cameras from the European Machine Vision Association (EMVA).

ADPylon is derived from the base class ADGenICam, which handles many of the details of mapping GenICam features to EPICS records.

ADPylon class describes this class in detail.

As it name implies, ADPylon uses the Basler Pylon library. It runs on Windows, and on many Linux with glibc 2.27+ and gcc 8.1+ (e.g. Ubuntu 18, RHEL 8. Debian 10). The header files and Windows import libraries are include, so it is ready to build for Windows. Because of the sheer size of the Linux libraries, they are not included. To build, unpacked the Linux SDK to /opt/pylon, and define this in the areaDetector top level CONFIG_SITE.local file,:

WITH_PYLON = YES
PYLON_INCLUDE = /opt/pylon/include
PYLON_LIB = /opt/pylon/lib

Prior to using ADPylon with a specific camera model, the XML file must be read from the camera using the arv-tool utility, as described in the ADGenICam documentation.

The EPICS database file and OPI screens must then be generated by running the Python programs as described in the ADGenICam documentation.

The Pylon SDK must be downloaded and installed on the machine prior to running the IOC because it installs the necessary drivers.

ADPylon driver

ADPylon inherits from ADGenICam. It adds the following parameters and EPICS records that are specific to ADPylon.

EPICS record names

Record types

drvInfo string

Description

TimeStampMode, TimeStampMode_RBV

bo, bi

PYLON_TIME_STAMP_MODE

Controls whether the TimeStamp attribute comes from the camera internal time stamp or from the EPICS time. Choices are Camera (0), and EPICS (1).

UniqueIdMode, UniqueIdMode_RBV

bo, bi

PYLON_UNIQUE_ID_MODE

Controls whether the UniqueId attribute comes from the camera internal value or from the driver. Choices are Camera (0), and Driver (1).

ConvertPixelFormat, ConvertPixelFormat_RBV

mbbo, mbbi

PYLON_CONVERT_PIXEL_FORMAT

Controls conversion of the pixel format read from the camera to a different format. For example this can be used to convert BayerRG8 to RGB8, which allows the camera to send 8-bit Bayer color data over the bus and then convert to 24-bit RGB on the host computer, reducing the required bandwidth by a factor of 3 and increasing the frame rate.

ConvertBitAlign, ConvertBitAlign_RBV

mbbo/mbbi

PYLON_CONVERT_BIT_ALIGN

Sets the alignment of the bits in the target pixel type if the target bit depth is greater than the source bit depth, e.g., if you are converting from a 12-bit to a 16-bit format. Choices are [0:”LSB”, 1:”MSB”]. LSB means alignment with the least significant bit. e.g. 12-bit data is not left-shifted, so bits 12-15 are 0. MSB means alignment with the most significant bit. e.g. 12-bit data is left-shifted by 4 bits, so bits 0-3 are 0.

ConvertShiftBits, ConvertShiftBits_RBV

longout/longin

PYLON_CONVERT_SHIFT_BITS

Controls how many bits are shifted left (positive) or right (negative) additionally for mono. The range is between -16 and 16.

GC_StatBufferReceived_RBV

longin

GC_I_Statistic_Total_Buffer_Count

Number of frames delivered since acquisition was started.

GC_I_StatBufferFailed_RBV

longin

GC_I_Statistic_Failed_Buffer_Count

Number of buffers with at least one failed packet.

GC_StatBufferUnderrun_RBV

longin

GC_I_Statistic_Buffer_Underrun_Count

Number of frames lost because there were no buffers in the queue.

GC_StatPacketReceived_RBV

longin

GC_I_Statistic_Total_Packet_Count

Number of packets received.

GC_StatPacketFailed_RBV

longin

GC_I_Statistic_Failed_Packet_Count

Number of failed packets.

GC_StatPacketRequested_RBV

longin

GC_I_Statistic_Resend_Request_Count

Number of packets requested by packet resend commands.

GC_StatPacketResent_RBV

longin

GC_I_Statistic_Resend_Packet_Count

Number of emitted packet resend commands sent.

If Chunk data is enabled, they are extracted as NDArray attributes. If camera specific EPICS records are loaded, they are also set to EPICS records.

IOC startup script

The command to configure an ADPylon camera in the startup script is:

ADPylonConfig(const char *portName, const char *cameraId,
                  size_t maxMemory, int priority, int stackSize)

portName is the name for the ADPylon port driver

cameraId is the either the serial number of the camera or the camera index number in the system. The serial number is normally printed on the camera, and it is also the last part of the camera name returned by arv-tool, for example for "Basler-23524298", it would be 23524298. If cameraId is less than 1000 it is assumed to be the system index number, if 1000 or greater it is assumed to be a serial number.

maxMemory is the maximum amount of memory the NDArrayPool is allowed to allocate. 0 means unlimited.

priority is the priority of the port thread. 0 means medium priority.

stackSize is the stack size. 0 means medium size.

MEDM screens

The following is the MEDM screen ADPylon.adl when controlling a Basler acA1300-200uc camera. ADPylon.adl is very similar to ADGenICam.adl, with a few additional widgets for the PVs that are specific to ADPylon.

../_images/ADPylon.png

The following are the MEDM screens Basler_acA1300_200uc-features_[1-4].adl when controlling an acA1300-200uc USB3 camera. These screens were autogenerated by the Python script in ADGenICam, and are specific to this camera model. They are loaded from the “Camera-specific features” related display widget in the above screen.

../_images/ADPylon_features1.png
../_images/ADPylon_features2.png
../_images/ADPylon_features3.png
../_images/ADPylon_features4.png