Euresys Coaxlink Скачать руководство пользователя страница 14

Coaxlink Programmer's Guide   

 Euresys::EGrabber

}

1. Create a 

Euresys::EGrabber

 object. The second and third arguments of the constructor are omitted here. The

grabber will use the first device of the first interface present in the system.

2. Allocate 3 buffers. The grabber automatically determines the required buffer size.
3. Start the grabber. Here, we ask the grabber to fill 10 buffers. If we don't want the grabber to stop aer a specific

number of buffers, we can do 

grabber.start(GenTL::GENTL_INFINITE)

, or simply 

grabber.start()

.

Starting the grabber involves the following operations:
• the 

AcquisitionStart

 command is executed on the camera;

• the 

DSStartAcquisition

 function is called to start the data stream.

In this example, we assume that the camera and frame grabber are properly configured. For a real application,

it would be safer to run a 

configuration script

 before starting acquisitions (and before allocating buffers for that

matter). This will be shown in another example.

4. Wait for a buffer filled by the grabber. The result is a 

Euresys::ScopedBuffer

. The term 

scoped

 is used to

indicate that the lifetime of the buffer is the current scope (i.e., the current block).

5. Retrieve  the  buffer  address.  This  is  done  by  calling  the 

getInfo

  method  of  the  buffer.  This  method  takes  as

argument a 

BUFFER_INFO_CMD

. In this case, we request the 

BUFFER_INFO_BASE

, which is defined in the

standard 

GenTL header file

:

enum BUFFER_INFO_CMD_LIST

{

  BUFFER_INFO_BASE      = 0, /* PTR    Base address of the buffer memory. */

  BUFFER_INFO_SIZE      = 1, /* SIZET  Size of the buffer in bytes. */

  BUFFER_INFO_USER_PTR  = 2, /* PTR    Private data pointer of the GenTL 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_t BUFFER_INFO_CMD;

Notice that 

getInfo

 is a template method, and when we call it we must specify the type of value we expect.

BUFFER_INFO_BASE

 returns a pointer; this is why we use 

getInfo<void *>

.

6. Do the same to retrieve the timestamp of the buffer. This time, we use the 

uint64_t

 version of 

getInfo

 to match

the type of 

BUFFER_INFO_TIMESTAMP

.

Note that, for Coaxlink, timestamps are always 64-bit and expressed as the number of microseconds that have

elapsed since the computer was started.

7. We reach the end of the 

for

 block. The local variable 

buf

 gets out of scope and is destroyed: the 

ScopedBuffer

destructor is called. This causes the GenTL buffer contained in 

buf

 to be re-queued (given back) to the data stream

of the grabber.

Example of program output:

buffer address: 0x7f3c32c54010, timestamp: 11247531003686 us

buffer address: 0x7f3c2c4bf010, timestamp: 11247531058080 us

buffer address: 0x7f3c2c37e010, timestamp: 11247531085003 us

buffer address: 0x7f3c32c54010, timestamp: 11247531111944 us

buffer address: 0x7f3c2c4bf010, timestamp: 11247531137956 us

buffer address: 0x7f3c2c37e010, timestamp: 11247531163306 us

buffer address: 0x7f3c32c54010, timestamp: 11247531188600 us

buffer address: 0x7f3c2c4bf010, timestamp: 11247531213807 us

buffer address: 0x7f3c2c37e010, timestamp: 11247531239158 us

buffer address: 0x7f3c32c54010, timestamp: 11247531265053 us

We can see that the three buffers that were allocated (let's call them A at 

0x7f3c32c54010

, B at 

0x7f3c2c4bf010

,

and C at 

0x7f3c2c37e010

) are used in a round-robin fashion: A → B → C → A → B → C → ... This is the result of:

• the FIFO nature of input and output buffer queues:

14

Содержание Coaxlink

Страница 1: ...PROGRAMMER S GUIDE Coaxlink Coaxlink Driver Version 7 1 EURESYS s a 2017 Document version 7 1 637 built on 2017 04 14...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 6: ...ut it is fairly di icult to use and logging is very poor Instead we recommendusingtheEuresysimplementationbundledwiththeCoaxlinkso warepackage Thisimplementationalso allows writing powerful configurat...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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_...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 34: ...res GenApi commands CAM file Euresys GenApi script CallbackOnDemand Callback functions CallbackSingleThread CallbackMultiThread Initialization MultiCam MCSTATUS status McOpenDriver NULL if status MC_O...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Отзывы: