Euresys Coaxlink Programmer'S Manual Download Page 13

Euresys::EGrabber 

   Coaxlink Programmer's Guide

        showInfo();

    } 

catch

 (

const

 std::exception &e) {                                                 

// 7

        std::cout << 

"error: "

 << e.what() << std::endl;

    }

}

1. Include 

EGrabber.h

, which defines the 

Euresys::EGrabber

 class, and includes the other header files we

need (such as 

EGenTL.h

 and the standard 

GenTL header file

).

2. Create a 

Euresys::EGenTL

 object. This involves the following operations:

• locate and dynamically load the Coaxlink GenTL producer (

coaxlink.cti

);

• retrieve  pointers  to  the  functions  exported  by 

coaxlink.cti

,  and  make  them  available  via

Euresys::EGenTL

 methods;

• initialize 

coaxlink.cti

 (this is done by calling the GenTL initialization function 

GCInitLib

).

3. Create a 

Euresys::EGrabber

 object. The constructor needs the 

gentl

 object created in step 2. It also takes

as optional arguments the indices of the interface and device to use.
The purpose of the angle brackets (

<>

) that come aer 

EGrabber

 will become clear later. For now, they can be

safely ignored.

4. Use 

GenApi

 on page 6 to find out the ID of the Coaxlink card. 

Euresys::InterfaceModule

 indicates that we

want an answer from the 

interface module

.

5. Similarly, find out the ID of the device. This time, we use 

Euresys::DeviceModule

 to target the 

device module

.

6. Finally, read the camera resolution. 

Euresys::RemoteModule

 indicates that the value must be retrieved from

the camera.

7.

Euresys::EGrabber

 uses exceptions to report errors, so we wrap our code inside a 

try ... catch

 block.

Example of program output:

Interface:    PC1633 - Coaxlink Quad G3 (2-camera) - KQG00014

Device:       Device0

Resolution:   4096x4096

        

Acquiring images

This program uses 

Euresys::EGrabber

 to acquire images from a camera connected to a Coaxlink card:

 

#include <iostream>

#include <EGrabber.h>

void

 grab() {

    Euresys::EGenTL gentl;

    Euresys::EGrabber<> grabber(gentl);                                     

// 1

    grabber.reallocBuffers(3);                                              

// 2

    grabber.start(10);                                                      

// 3

    

for

 (size_t i = 0; i < 10; ++i) {

        Euresys::ScopedBuffer buf(grabber);                                 

// 4

        

void

 *ptr = buf.getInfo<

void

 *>(GenTL::BUFFER_INFO_BASE);           

// 5

        uint64_t ts = buf.getInfo<uint64_t>(GenTL::BUFFER_INFO_TIMESTAMP);  

// 6

        std::cout << 

"buffer address: "

 << ptr << 

", timestamp: "

 

                  << ts << 

" us"

 << std::endl;

    }                                                                       

// 7

}

int

 main() {

    

try

 {

        grab();

    } 

catch

 (

const

 std::exception &e) {

        std::cout << 

"error: "

 << e.what() << std::endl;

    }

13

Summary of Contents for Coaxlink

Page 1: ...PROGRAMMER S GUIDE Coaxlink Coaxlink Driver Version 7 1 EURESYS s a 2017 Document version 7 1 637 built on 2017 04 14...

Page 2: ...rands or documentation of EURESYS s a contained in this book is not allowed without prior notice EURESYS s a may modify the product specification or change the information given in this documentation...

Page 3: ...TL API 8 Euresys EGenTL 10 A first example 10 Relevant files 11 Euresys EGrabber 12 A first example 12 Acquiring images 13 Configuring the grabber 15 Events 16 Background 16 Counters 17 Notifications...

Page 4: ...GenApi scripts 25 doc basics js 25 doc builtins js 30 doc grabbers js 31 doc module1 js 33 EGrabber for MultiCam users 34 NET assembly 40 A first example 40 Di erences between C and NET EGrabber 41 S...

Page 5: ...etect configure and use the features of cameras and frame grabbers in a uniform and consistent way GenTL is about data transport The TL su ix stands for Transport Layer The GenTL standard defines a se...

Page 6: ...ut it is fairly di icult to use and logging is very poor Instead we recommendusingtheEuresysimplementationbundledwiththeCoaxlinkso warepackage Thisimplementationalso allows writing powerful configurat...

Page 7: ...rations These port functions are used by GenApi to load that module s description file and to use its GenApi features System Module coaxlink c Interface Module PC1633 Coaxlink Quad G3 2 camera KQG0001...

Page 8: ...le that contains the frame grabber settings relating to the camera This includes things like triggers and strobes The device module also acts as parent to one data stream and can be viewed as the sibl...

Page 9: ...from write to untyped bu ers the application must determine the required bu er size allocate a temporary bu er convert data to from this bu er and finally release the bu er memory Instead of using the...

Page 10: ...wn This removes the burden of manually checking error codes a er each function call Since GenTL functions return a GC_ERROR output values are returned through pointers passed as arguments Euresys EGen...

Page 11: ...cally load the Coaxlink GenTL producer coaxlink cti retrieve pointers to the functions exported by coaxlink cti and make them available via Euresys EGenTL methods initialize coaxlink cti this is done...

Page 12: ...control PCIe and firmware status A device or local device as opposed to remote device the module that contains the frame grabber settings and features relating to the camera This consists mainly of c...

Page 13: ...on page 6 to find out the ID of the Coaxlink card Euresys InterfaceModule indicates that we want an answer from the interface module 5 Similarly findouttheIDofthedevice Thistime weuseEuresys DeviceMo...

Page 14: ...L Consumer BUFFER_INFO_TIMESTAMP 3 UINT64 Timestamp the buffer was acquired other BUFFER_INFO definitions omitted BUFFER_INFO_CUSTOM_ID 1000 Starting value for GenTL Producer custom IDs typedef int32_...

Page 15: ...onous reset camera control frame grabber controlled exposure include iostream include EGrabber h const double FPS 150 void configure Euresys EGenTL gentl Euresys EGrabber grabber gentl camera configur...

Page 16: ...to validate the configuration outside of the user application The configuration script can easily be shared by several applications written in di erent programming languages C C VB NET The full power...

Page 17: ...on read the value of the CameraTriggerRisingEdge counter int64_t counter grabber getInteger DeviceModule EventCount CameraTriggerRisingEdge Notifications As we ve just seen when an event occurs a dedi...

Page 18: ...inally enable notifications for all data stream events Callback functions When an event occurs and event notification is enabled for that event Euresys EGrabber executes one of several callback functi...

Page 19: ...MID_DATASTREAM_START_OF_CAMERA_READOUT Start of camera readout EVENT_DATA_NUMID_DATASTREAM_END_OF_CAMERA_READOUT End of camera readout For reference the following tables list for each module generatin...

Page 20: ...thread The application asks the grabber to create a dedicated thread for each of its callback functions In each of these threads the grabber waits for a particular category of events When an event oc...

Page 21: ...allbackSingleThread EGrabber CallbackMultiThread EGrabber which is equivalent to EGrabber CallbackOnDemand The EGrabber header file also defines the following type aliases synonyms typedef EGrabber Ca...

Page 22: ...041 Start of camera trigger timestamp 1502091784 us numid 0x8048 Received acknowledgement for previous CXP trigger message timestamp 1502091879 us numid 0x8043 Start of light strobe timestamp 15020928...

Page 23: ...so we don t have to Here we simply enter an infinite loop As you can see moving from CallbackOnDemand to CallbackSingleThread is very simple If instead you want the CallbackMultiThread variant simply...

Page 24: ...ted It gets out of scope and is destroyed the ScopedBuffer destructor is called This causes the GenTL bu er contained in buf to be re queued given back to the data stream of the grabber Example of pro...

Page 25: ...pts dir doc basics js or more simply gentl script coaxlink doc basics js Euresys GenApi Script is case sensitive Statements are always separated by semicolons JavaScript is more permissive Single line...

Page 26: ...1 61803 undefined 1 41421 function RegularExpressions var x CXP 36 _X 124 Like JavaScript Euresys GenApi Script is a dynamically typed language The type of a variable is defined by the value it holds...

Page 27: ...abc123 abc 123 string all operands are converted assertEqual 123456 123 456 to string and concatenated Multiplication and division assertEqual 4 5 3 3 2 Prefix operators typeof var x 0 assertEqual 1 x...

Page 28: ...nction ForLoops var i var sum 0 for i 0 i 6 i sum i assertEqual 15 sum for in loops iterating over indices function ForInLoops var xs 1 10 100 1000 var sum 0 for var i in xs sum xs i assertEqual 1111...

Page 29: ...x 2 catch e Executed if a throw statement is executed assertEqual 1 x caught e finally Executed regardless of whether or not a throw statement is executed Also executed if a return statement causes t...

Page 30: ...ean 3 Boolean 3 true console log Number false Number false 0 console log Number true Number true 1 console log Number 3 14 Number 3 14 3 14 console log Number 0x16 Number 0x16 22 console log Number 1e...

Page 31: ...to the directory where coaxlink scripts are installed var mod require coaxlink doc builtins js doc grabbers js This file describes the grabbers object of Euresys GenApi Script It can be executed by r...

Page 32: ...terfacePort console log Playing with port tag get f console log InterfaceID port get InterfaceID set f v port set LineSelector TTLIO11 execute f port execute DeviceUpdateList features re console log F...

Page 33: ...d console log Bootstrap register Standard is OK 0xc0a79ae5 else console log Bootstrap register Standard is standard console log Bootstrap register Revision is revision doc module1 js This file describ...

Page 34: ...res GenApi commands CAM file Euresys GenApi script CallbackOnDemand Callback functions CallbackSingleThread CallbackMultiThread Initialization MultiCam MCSTATUS status McOpenDriver NULL if status MC_O...

Page 35: ...tus McSetParamInt surface MC_SurfaceSize BUFFER_SIZE if status MC_OK status McSetParamPtr surface MC_SurfaceAddr mem if status MC_OK status McSetParamPtr surface MC_SurfaceContext USER_PTR i if status...

Page 36: ...e value grabber setString M name value where H is a MC_HANDLE the global MC_CONFIGURATION handle a board handle or a channel handle and M specifies the target module either SystemModule InterfaceModul...

Page 37: ...wait for a surface status McWaitSignal channel MC_SIG_SURFACE_PROCESSING timeout info if status MC_OK MCHANDLE surface info SignalInfo process surface make surface available for new images status McS...

Page 38: ...C_SIG_END_EXPOSURE handle END_EXPOSURE event break private MCHANDLE channel void MCAPI GlobalCallbackFunction MCSIGNALINFO info if info info Context MyGrabber grabber MyGrabber info Context grabber on...

Page 39: ...cWaitSignal channel MC_SIG_END_EXPOSURE timeout info if status MC_OK handle END_EXPOSURE event private EGrabber class MyGrabber public EGrabber CallbackOnDemand public MyGrabber EGenTL gentl EGrabber...

Page 40: ...Device 0 dev System Console WriteLine Resolution 0 x 1 width height static void Main try 6 showInfo catch System Exception e 6 System Console WriteLine error 0 e Message 1 Create a Euresys EGenTL obje...

Page 41: ...EGrabberCallbackMultiThread EGrabber Methods C NET getInfo MODULE TYPE cmd getInfo MODULE cmd out getInteger MODULE f getInteger MODULE f getFloat MODULE f getFloat MODULE f getString MODULE f getStr...

Page 42: ...ackSingleThread grabber new Euresys EGrabberCallbackSingleThread gentl showEvents grabber catch System Exception e System Console WriteLine error 0 e Message 1 Run a config js script which should prop...

Page 43: ...830397 us EVENT_DATA_NUMID_CIC_CAMERA_TRIGGER_FALLING_EDGE timestamp 2790830401 us EVENT_DATA_NUMID_CIC_CXP_TRIGGER_ACK timestamp 2790842190 us EVENT_DATA_NUMID_CIC_ALLOW_NEXT_CYCLE timestamp 27908421...

Page 44: ...troller Part of Coaxlink card that controls a camera and its associated illumination devices Hosted in the device module CoaXPress High speed digital interface standard that allows the transmission of...

Page 45: ...resysCustom h Interface module GenTL module that represents a frame grabber Parent of the device module I O toolbox Part of Coaxlink card that controls digital I O lines and implements tools such as r...

Reviews: