Advertisement

PROGRAMMER GUIDE
Coaxlink
Coaxlink Driver Version 9.5.2
© EURESYS s.a. 2018 - Document D204EN-Programmer Guide-Coaxlink-9.5.2.2015 built on 2018-03-28

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Coaxlink Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Euresys Coaxlink Series

  • Page 1 PROGRAMMER GUIDE Coaxlink Coaxlink Driver Version 9.5.2 © EURESYS s.a. 2018 - Document D204EN-Programmer Guide-Coaxlink-9.5.2.2015 built on 2018-03-28...
  • Page 2 EURESYS s.a. shall not be liable for any loss of or damage to revenues, profits, goodwill, data, information systems or other special, incidental, indirect, consequential or punitive damages of any kind arising in connection with the use of the hardware or the software of EURESYS s.a.
  • Page 3: Table Of Contents

    3.1. System module 3.2. Interface module 3.3. Device module 3.4. Data stream module 3.5. Buffer module 3.6. GenTL API 4. Euresys::EGenTL 4.1. A first example 4.2. Relevant files 5. Euresys::EGrabber 5.1. A first example 5.2. Acquiring images 5.3. Configuring the grabber 5.4.
  • Page 4 Coaxlink Programmer Guide 6. Euresys GenApi scripts 6.1. doc/basics.js 6.2. doc/builtins.js 6.3. doc/grabbers.js 6.4. doc/module1.js 7. EGrabber for MultiCam users 8. .NET assembly 8.1. A first example 8.2. Differences between C++ and .NET EGrabber 8.3. Single thread callbacks 9. Definitions...
  • Page 5: Introduction

    1. Introduction Coaxlink Programmer Guide 1. Introduction The Application Programming Interface (API) for Coaxlink cards is based on GenICam. The goal of GenICam is to provide a standardized, uniform programming interface for using cameras and frame grabbers based on different physical interfaces (CoaXPress, GigE Vision, etc.) or from different vendors.
  • Page 6: Genapi

    EMVA provides a reference implementation, but it is fairly difficult to use, and logging is very poor. Instead, we recommend using the Euresys implementation bundled with the Coaxlink software package. This implementation also allows writing powerful configuration scripts. Features What the user gets from GenApi is a bunch of named features, organized in categories.
  • Page 7 2. GenApi Coaxlink Programmer Guide Commands There is also another kind of features: commands (e.g., ). Commands are AcquisitionStart special: they don't have any associated value; they have side effects. Command features are meant to be executed. When a command is executed, some action happens in the camera (e.g., a software trigger is generated).
  • Page 8: Gentl

    Coaxlink Programmer Guide 3. GenTL 3. GenTL GenTL defines 5 types of objects, organized in a parent/child relationship: the system module the interface module the device module the data stream module the buffer module Each module: ● corresponds to a particular element of the system; ●...
  • Page 9: System Module

    This module is at the top of the parent/child tree. coaxlink.cti The system module provides basic information about the GenTL producer: things like the complete path to and the vendor name (Euresys). coaxlink.cti The real point of the system module is to list the interfaces (or frame grabbers) present in the system.
  • Page 10: Data Stream Module

    Instead of using the GenTL API directly, we recommend using either: library which deals with these complications so that the user doesn't Euresys::EGenTL have to; or the library which provides a high-level, easy-to-use interface.
  • Page 11: Euresys::egentl

    4. Euresys::EGenTL Coaxlink Programmer Guide 4. Euresys::EGenTL is a library of C++ classes that provide the same functionality as standard Euresys::EGenTL GenICam GenTL, but with a more user-friendly interface. For example, it uses std::string instead of raw pointers, and error codes are transformed into exceptions.
  • Page 12: A First Example

    Coaxlink Programmer Guide 4. Euresys::EGenTL Some GenTL functions retrieve information about the camera or frame grabber. These functions fill a buffer with a value, and indicate in an the actual void * INFO_DATATYPE type of the value. uses C++ templates to make these functions easy to...
  • Page 13: Relevant Files

    4. Euresys::EGenTL Coaxlink Programmer Guide 1. Include , which contains the definition of the class. EGenTL.h Euresys::EGenTL 2. Create a object. This involves the following operations: Euresys::EGenTL locate and dynamically load the Coaxlink GenTL producer ( coaxlink.cti retrieve pointers to the functions exported by , and make them available coaxlink.cti...
  • Page 14: Euresys::egrabber

    Coaxlink Programmer Guide 5. Euresys::EGrabber 5. Euresys::EGrabber is a library of C++ classes that provide a high-level interface. It is built on Euresys::EGrabber top of the library, and is recommended for most users. Euresys::EGenTL A .NET assembly, built on top of the C++ classes, is also provided.
  • Page 15: A First Example

    // 1 static const uint32_t CARD_IX = 0; static const uint32_t DEVICE_IX = 0; void showInfo() { Euresys::EGenTL gentl; // 2 Euresys::EGrabber<> grabber(gentl, CARD_IX, DEVICE_IX); // 3 std::string card = grabber.getString<Euresys::InterfaceModule>("InterfaceID"); // 4 std::string dev = grabber.getString<Euresys::DeviceModule>("DeviceID"); // 5 int64_t width = grabber.getInteger<Euresys::RemoteModule>("Width");...
  • Page 16: Acquiring Images

    Coaxlink Programmer Guide 5. Euresys::EGrabber 4. Use "GenApi" on page 6 to find out the ID of the Coaxlink card. indicates that we want an answer from the interface module. Euresys::InterfaceModule 5. Similarly, find out the ID of the device. This time, we use...
  • Page 17 5. Euresys::EGrabber Coaxlink Programmer Guide 3. Start the grabber. Here, we ask the grabber to fill 10 buffers. If we don't want the grabber to stop after a specific number of buffers, we can do grabber.start(GenTL::GENTL_ , or simply INFINITE) grabber.start()
  • Page 18: Configuring The Grabber

    Coaxlink Programmer Guide 5. Euresys::EGrabber We can see that the three buffers that were allocated (let's call them A at 0x7f3c32c54010 , and C at ) are used in a round-robin fashion: A → B → C → 0x7f3c2c4bf010 0x7f3c2c37e010 A →...
  • Page 19 5. Euresys::EGrabber Coaxlink Programmer Guide int main() { try { configure(); } catch (const std::exception &e) { std::cout << "error: " << e.what() << std::endl; 1. Enable triggers on the camera. 2. Tell the camera to look for triggers on the CoaXPress link.
  • Page 20: Events

    Coaxlink Programmer Guide 5. Euresys::EGrabber The configuration script can easily be shared by several applications written in different programming languages: C++, C#, VB.NET... The full power of Euresys GenApi scripts is available. 5.4. Events Background Coaxlink cards generate different kinds of events:...
  • Page 21: Counters

    5. Euresys::EGrabber Coaxlink Programmer Guide Counters Coaxlink firmware counts each occurrence of each event (except new buffer events) and makes this counter available in a GenApi feature named . Each event has its own counter, EventCount and the value of...
  • Page 22: Callback Functions

    When an event occurs, and event notification is enabled for that event, Euresys::EGrabber executes one of several callback functions. These callback functions are defined in overridden virtual methods: class MyGrabber : public Euresys::EGrabber<> public: private: // callback function for new buffer events virtual void onNewBufferEvent(const NewBufferData&...
  • Page 23: Event Identification

    5. Euresys::EGrabber Coaxlink Programmer Guide Event identification When an event is notified to the application, the callback function that is executed indicates the category of that event. The actual event that occurred is identified by a numerical ID, called , and defined in numid include/GenTL_v1_5_EuresysCustom.h...
  • Page 24: Examples

    Coaxlink Programmer Guide 5. Euresys::EGrabber Data stream module – Data Stream category Callback function Data type prefix numid onDataStreamEvent DataStreamData EVENT_DATA_NUMID_DATASTREAM_ Device module – CIC category Callback function Data type prefix numid onCicEvent CicData EVENT_DATA_NUMID_CIC_ Interface module – I/O Toolbox category...
  • Page 25 5. Euresys::EGrabber Coaxlink Programmer Guide 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 occurs, the corresponding callback function is executed in that thread.
  • Page 26: Events And Callbacks Examples

    Coaxlink Programmer Guide 5. Euresys::EGrabber 5.6. Events and callbacks examples On demand callbacks This program displays basic information about CIC events generated by a grabber: #include <iostream> #include <EGrabber.h> using namespace Euresys; // 1 class MyGrabber : public EGrabber<CallbackOnDemand> {...
  • Page 27 5. Euresys::EGrabber Coaxlink Programmer Guide 6. The callback function receives a . This structure is defined in onCicEvent const CicData & . It contains a few pieces of information about the event that include/EGrabberTypes.h occurred. Here, we display the of each event. The...
  • Page 28: Single Thread And Multi Thread Callbacks

    Coaxlink Programmer Guide 5. Euresys::EGrabber Single thread and multi thread callbacks This program displays basic information about CIC events generated by a grabber, this time using the model. CallbackSingleThread #include <iostream> #include <EGrabber.h> using namespace Euresys; class MyGrabber : public EGrabber<CallbackSingleThread> {...
  • Page 29: New Buffer Callbacks

    This program shows how to access information related to new buffer events. It uses , but it could use another callback method just as well. CallbackMultiThread #include <iostream> #include <EGrabber.h> using namespace Euresys; class MyGrabber : public EGrabber<CallbackMultiThread> { public: MyGrabber(EGenTL &gentl) : EGrabber<CallbackMultiThread>(gentl) { runScript("config.js");...
  • Page 30: Relevant Files

    Coaxlink Programmer Guide 5. Euresys::EGrabber 4. We reach the end of the block where the local variable has been created. It gets out of scope and is destroyed: the destructor is called. This causes the GenTL buffer ScopedBuffer contained in to be re-queued (given back) to the data stream of the grabber.
  • Page 31: Euresys Genapi Scripts

    Coaxlink Programmer Guide 6. Euresys GenApi scripts The Euresys GenApi Script language is documented in a few GenApi scripts. For convenience, they are also included here. 6.1. doc/basics.js // Euresys GenApi Script uses a syntax inspired by JavaScript, but is not // exactly JavaScript.
  • Page 32 = 1.41421; // x: [3.14159, 2.71828, 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, which can change. function DynamicVariables() { var x = 1;...
  • Page 33 1 !== 2); // Equality (==) and inequality (!=) JavaScript operators lead to confusing // and inconsistent conversions of their operands. They are not implemented // in Euresys GenApi Script. // Relational operators: < <= > >= assert(1 < 2);...
  • Page 34 Coaxlink Programmer Guide 6. Euresys GenApi scripts assertEqual('object', typeof {}); assertEqual('object', typeof []); assertEqual('object', typeof /re/); assertEqual('object', typeof null); // Postfix operators: ++ -- var x = 0; assertEqual(0, x++); assertEqual(1, x); assertEqual(1, x--); assertEqual(0, x); // Function call: () assertEqual(6, multiply(3, 2));...
  • Page 35 6. Euresys GenApi scripts Coaxlink Programmer Guide for (var i in xs) { sum += xs[i]; assertEqual(1111, sum); var obj = { one: 1, two: 2 }; var sum = 0; for (var p in obj) { sum += obj[p];...
  • Page 36 Coaxlink Programmer Guide 6. Euresys GenApi scripts finallyDone = false; try { x = 1; if (action === 'fail') { throw action; } else if (action === 'return') { return; x = 2; } catch (e) { // Executed if a throw statement is executed.
  • Page 37: Doc/Builtins.js

    Coaxlink Programmer Guide 6.2. doc/builtins.js // This file describes the builtins (functions or objects) of Euresys GenApi // Script. It can be executed by running 'gentl script // coaxlink://doc/builtins.js'. // The builtin object 'console' contains a single function, log, which can be // used to output text to the standard output.
  • Page 38: Doc/Grabbers.js

    = require(coaxlink://doc/builtins.js); 6.3. doc/grabbers.js // This file describes the 'grabbers' object of Euresys GenApi Script. It can // be executed by running 'gentl script coaxlink://doc/grabbers.js'. // The builtin object 'grabbers' is a list of objects giving access to the // available GenTL modules/ports.
  • Page 39 6. Euresys GenApi scripts Coaxlink Programmer Guide // Ports also have the following functions to work on GenICam features: get(f) | get value of f set(f,v) | set value v to f execute(f) | execute f features([re]) | get list of features [matching regular expression re]...
  • Page 40: Doc/Module1.Js

    "Revision" is ' + revision); 6.4. doc/module1.js // This file describes the special 'module' variable of Euresys GenApi Script. // It can be executed by running 'gentl script coaxlink://doc/module1.js'. It // is also dynamically loaded by the coaxlink://doc/builtins.js script.
  • Page 41 6. Euresys GenApi scripts Coaxlink Programmer Guide return x + 2; , hello: function() { console.log('Hello from ' + module.filename); console.log('module.exports contains: '); for (var e in module.exports) { console.log('- ' + e + ' (' + typeof module.exports[e] + ')');...
  • Page 42: Egrabber For Multicam Users

    Buffers announced to the data stream MC_Cluster Remote device (camera) MultiCam parameters GenApi set/get features GenApi commands CAM file Euresys GenApi script CallbackOnDemand Callback functions CallbackSingleThread CallbackMultiThread Initialization // MultiCam MCSTATUS status = McOpenDriver(NULL); if (status != MC_OK) { //EGrabber Euresys::EGenTL gentl;...
  • Page 43 7. EGrabber for MultiCam users Coaxlink Programmer Guide status = McSetParamInt(channel, MC_Connector, CONNECTOR); if (status != MC_OK) { //EGrabber Euresys::EGrabber<> grabber(gentl, CARD_INDEX, DEVICE_INDEX); Surface creation (automatic) //MultiCam status = McSetParamInt(channel, MC_SurfaceCount, BUFFER_COUNT); if (status != MC_OK) { //EGrabber grabber.reallocBuffers(BUFFER_COUNT); Surface creation (manual) //MultiCam for (size_t i = 0;...
  • Page 44 Coaxlink Programmer Guide 7. EGrabber for MultiCam users Surface cluster reset //MultiCam MCSTATUS status; for (size_t i = 0; i < BUFFER_COUNT; ++i) { MCHANDLE surface; status = McGetParamInst(channel, MC_Cluster + i, &surface); if (status != MC_OK) { status = McSetParamInt(surface, MC_SurfaceState, MC_SurfaceState_FREE); if (status != MC_OK) { status = McSetParamInt(channel, MC_SurfaceIndex, 0);...
  • Page 45 (name, value) grabber.setString<RemoteModule> (name, value) Script files //MultiCam ; CAM file ChannelParam1 = Value1; ChannelParam2 = Value2; //EGrabber // Euresys GenApi Script var grabber = grabbers[0]; grabber.DevicePort.set('DeviceFeature1', Value1); grabber.DevicePort.set('DeviceFeature2', Value2); grabber.RemotePort.set('CameraFeatureA', ValueA); Acquisition start/stop //MultiCam // start "live" McSetParamInt(channel, MC_GrabCount, MC_INFINITE);...
  • Page 46 Coaxlink Programmer Guide 7. EGrabber for MultiCam users //EGrabber // wait for a buffer Buffer buffer = grabber.pop(timeout); // process buffer // make buffer available for new images buffer.push(grabber); //EGrabber // wait for a buffer ScopedBuffer buffer(grabber, timeout); // process buffer // ScopedBuffer destructor takes care of making buffer available for new images Callbacks //MultiCam...
  • Page 47 7. EGrabber for MultiCam users Coaxlink Programmer Guide private: MCHANDLE channel; void MCAPI GlobalCallbackFunction(MCSIGNALINFO *info) { if (info && info->Context) { MyGrabber *grabber = (MyGrabber *)info->Context; grabber->onEvent(info); //EGrabber class MyGrabber : public EGrabber<CallbackSingleThread> { public: MyGrabber(EGenTL &gentl) : EGrabber<CallbackSingleThread>(gentl) { // configure grabber // enable "NewBuffer"...
  • Page 48 Coaxlink Programmer Guide 7. EGrabber for MultiCam users private: //EGrabber class MyGrabber : public EGrabber<CallbackOnDemand> { public: MyGrabber(EGenTL &gentl) : EGrabber<CallbackOnDemand>(gentl) { // configure grabber // enable "Cic" events enableEvent<CicData>(); void waitForEvent(uint64_t timeout) { // wait for an event processEvent<CicData>(timeout); private: // onCicEvent is called by processEvent when a "Cic"...
  • Page 49: Net Assembly

    FirstExample { class ShowInfo { const int CARD_IX = 0; const int DEVICE_IX = 0; static void showInfo() { using (Euresys.EGenTL gentl = new Euresys.EGenTL()) { // 1 using (Euresys.EGrabberCallbackOnDemand grabber = new Euresys.EGrabberCallbackOnDemand(gentl, CARD_IX, DEVICE_ IX)) { // 2 String card = grabber.getStringInterfaceModule("InterfaceID");...
  • Page 50: Differences Between C++ And .Net Egrabber

    Coaxlink Programmer Guide 8. .NET assembly 1. Create a object. This involves the following operations: Euresys.EGenTL locate and dynamically load the Coaxlink GenTL producer ( coaxlink.cti retrieve pointers to the functions exported by coaxlink.cti initialize coaxlink.cti 2. Create a object. The constructor needs the Euresys.EGrabberCallbackOnDemand...
  • Page 51: Single Thread Callbacks

    This is the C# version of the C++ CallbackSingleThread CallbackSingleThread example: using System; namespace Callbacks { class CallbackExample { static void showEvents(Euresys.EGrabberCallbackSingleThread grabber) { grabber.runScript("config.js"); // 1 grabber.onCicEvent = delegate(Euresys.EGrabberCallbackSingleThread g, // 2 Euresys.CicData data) { System.Console.WriteLine("timestamp: {0} us, {1}", // 3...
  • Page 52 // 6 while (true) { // 6 static void Main() { try { using (Euresys.EGenTL gentl = new Euresys.EGenTL()) { using (Euresys.EGrabberCallbackSingleThread grabber = new Euresys.EGrabberCallbackSingleThread(gentl)) { showEvents(grabber); } catch (System.Exception e) { System.Console.WriteLine("error: {0}", e.Message); 1. Run a script which should: config.js...
  • Page 53: Definitions

    9. Definitions Coaxlink Programmer Guide 9. Definitions Acronyms Camera and Illumination Controller Common Transport Interface CoaXPress EMVA European Machine Vision Association PFNC Pixel Format Naming Convention SFNC Standard Features Naming Convention Glossary Buffer module GenTL module that represents a memory buffer. Buffers must be announced to the data stream that will fill them with image data.
  • Page 54 Coaxlink Programmer Guide 9. Definitions Camera and illumination controller 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 data from a device (e.g., a camera) to a host (e.g., a frame grabber inside a computer) over one or several coaxial cables.
  • Page 55 9. Definitions Coaxlink Programmer Guide Info command Numerical identifier used to query a specific piece of information from a GenTL module. Info commands are defined either in the standard GenTL header file, or in a vendor-specific header file (e.g., info commands specific to Coaxlink are defined in include/GenTL_v1_5_ EuresysCustom.h Interface module...

Table of Contents