The EyeLogic Software Development Kit (SDK) is a free software package for building custom applications that use an EyeLogic eye tracking device. It provides the ability to connect to your device from any custom application via an Application Programming Interface (API). The EyeLogic SDK is available in the following programming languages C++, C#, C, and Python. It can also be used with any other programming language that can import dynamic link libraries (DLLs), such as Visual Basic or Matlab.
For each directly supported language, there is a short and simple example program to help you start developing your first EyeLogic application.
This manual describes how to use the EyeLogic API for Python and gives a step-by-step introduction on how to start with your own Python program.
Please refer to the EyeLogic Server documentation for system requirements and installation instructions.
The SDK has no additional requirements. It is built for Microsoft Windows (32 bit or 64 bit) only. The included sample projects are written for Microsoft Visual Studio 2017 or newer. Other compilers are not supported at this time.
To use an EyeLogic eye tracking device from within your application, you need the EyeLogic Server and the EyeLogic SDK. Check the download page for the latest version of both packages: https://www.eyelogicsolutions.com/downloads/
The software is written to support backwards compatibility, i.e. updating the EyeLogic Server software will not break support for your device, regardless of the model. This guide assumes that you are installing the latest version of the EyeLogic Server. Please always update to the latest server version before reporting an error to the EyeLogic Support.
On the other hand, it is not always necessary to update the SDK and API DLLs. Since you as a programmer would have to recompile your application with each SDK update, we have designed the SDK to allow the server to communicate with older API versions. So when you ship your application, simply add the EyeLogic API DLLs of the current version to your package. It will be compatible with both current and newer versions of the server.
See Shipping Your Application for a tutorial on how to ship your application.
The EyeLogic SDK does not need to be installed. It is shipped as a .zip file that simply needs to be extracted to any directory on your hard drive. Make sure you have user rights to that directory, e.g. any directory within C:\Program Files or similar is problematic as it requires admin rights to access those files every time you start your program. It is recommended to use a local user directory.
Note: The SDK has to be installed on the same computer as the server. Please see the main server manual for help on installing the server.
After extracting the .zip file, the directory contains one subfolder for each supported programming language. Open the cpp folder, the content should be:
In the directory, into which you unpacked the SDK EyeLogicSDK
, navigate to the sub-directory python
. Open the one of the .py files with your favorite python development environment.
If you have your python interpreter in the windows PATH, then you may start the demo application by just double-clicking the .py file, e.g. democlient_main_sample_polling.py. Alternatively, open a console, change the actual directory to EyeLogicSDK\python
and enter the following line:
python democlient_main_sample_polling.py
Before running the application check that the EyeLogic Server is running (see the EyeLogic Server manual). If the server is running, there will be an EyeLogic icon in the Windows system tray.
Note that your firewall might block the connection between your program and the server. In this case, add a rule to your firewall to allow your application to open TCP/UDP ports to an application on localhost (for the windows defender, just click "accept").
If you have reached this point, you have set up your EyeLogic SDK correctly. You are now ready to start developing your own application. See the next section Concepts for the basic programming concepts and for a tutorial on how to deploy and ship your application.
The EyeLogic software consists of two main parts: The server
and the API
. The server is the neccessary driver for your eye tracking device. It detects your device and handles the communication. The API is part of the EyeLogic Standard Development Kit (SDK). It consists of .dll files that can be used by your application to connect to the EyeLogic Server, start tracking and receive eye tracking data.
The server is designed to run continuously as a background process on your computer. When not actively tracking, the server uses a negligible amount of your computer's resources. Once an EyeLogic eye tracking device is connected, the Server application automatically detects it automatically and allows the user to set it up via the Server configuration dialogue (see the Server icon in the Windows tray bar). If for some reason the server background process is not running (the tray icon is missing), you can start the server manually from the Windows Start menu.
The API is a set of .dll files that can be used by any custom program (called a user application
). These DLLs allow the user application to connect to the (running) server. Note that it the EyeLogic Server can run on the same machine as the user application, or they can run on different PCs. See Dual PC Setup for how to set up the setup with running the server and the user application running on different machines.
For an easy start to developing a new application, it is recommended that you copy the existing sample folder to a new location (e.g. EyeLogic_SDK\python with all its contents). The sample source file already provides a fully functional implementation. From this sample code, you can easily modify and extend the code to suit your individual experiment.
Alternatively you can start a new python project from scratch. In that case be sure that your development environment is able to find the path for the EyeLogic python module (which is <Location of your EyeLogic_SDK>\python
.
The usual control flow between the custom application/API and the server is characterised by the following steps:
GazeSample
s to the user application, see also Gaze Samples. All information which is passed from the server to the user application is passed via asyncronous callbacks
. The application must register it's own implementations of these callback functions with the API (see Example Program for a sample implementation).
Note that you need to calibrate to get valid gaze samples (see Gaze Samples). Any gaze samples reported before the system is calibrated will not contain valid eye data.
The Dual PC Setup is a special setup where the EyeLogic Server runs on a different computer than the user application.
The most common use case for the Dual PC Setup would be the following. Running an experiment with an operator constrolling the eye tracking device and a participant performing a task. The participant uses a different PC (which displays the experiment) than the operator (who can control the eye tracker via the EyeLogic Server software).
The operator's computer (called the Operator PC) must have the EyeLogic driver software (the EyeLogic Server) installed and running. The eye tracker is physically attached to a monitor that is connected to the participant's computer (called the Experiment PC). The USB cable of the eye tracker is plugged into the USB port of the Operator PC!
The operator can now use the server to detect the eye tracking device. On the Experiment PC, any custom application that presents an experiment to the participant can use the EyeLogic API to remotely connect to the server. To do this, the application should use the API calls:
requestServerList()
to obtain a list of all EyeLogic servers in the local network (LAN/WLAN) which are running and are configured to allow remote connections connectRemote()
to conntect to a specific server from that list setActiveScreen()
to set the screen connected to the Experiment PC as the active screen for eye tracking (replacing the default main screen of the Operator PC) Note, that a server must allow remote connections for it to be found. You can enable this in the settings of the server window.
If the connection is successful, the client can operate as usual as if it were connected to a local server. See the demo application "dualpc" demo application in the SDK for an example.
In this section, the code of the Python example program is explained in some detail.
The file starts with an include section. It adds
from eyelogic.ELApi import *
in order to find all neccessary definitions of the EyeLogic API.
The next relevant part is the definition of the callback functions.:
@SampleCallback def sampleCallback(sample: POINTER(ELGazeSample))
@EventCallback def eventCallback(event: ELEvent)
These are the callback functions which are invoked from the EyeLogic software whenever an event occurs. Those functions are defined in the following lines. The example code simply prints the event to the console, but here you may write your custom implementation.
In the __main__
section, the application implements its control flow. It consists of the following code lines:
api = ELApi("Demo Client") api.registerEventCallback(eventCallback)
This constructs a new instance of the ELApi class. The instanciation will automatically initialize the library and it will also be automatically deinitialized when object api goes out of scope. The call to registerEventCallback
registers your own instance of the event callback with the EyeLogic API. From now on all incoming events will call the eventCallback( )
method from the code above.
resultConnect = api.connect()
Connects to the EyeLogic server. Check the return code to see if the connection was established successfully.
screenConfig = api.getActiveScreen()
and
deviceConfig = api.getDeviceConfig()
are called in order to obtain information about the active screen and the connected eye tracking device.
resultTracking = api.requestTracking(0)
Tells the device to start tracking and the Server to start sample processing. Parameter 0 specifies the frame rate mode. If your device is capable of multiple frame rate modes (60Hz, 120Hz or 250Hz), you can specify a different number. The list of available frame rate modes is part of the DeviceConfig and can be obtained by calling getDeviceConfig(). The first frame rate mode (DeviceConfig.frameRates[0]) is the default mode, which is usually the highest available speed mode on your system.
resultCalibrate = api.calibrate(0)
Performs a calibration. This method blocks until the calibration is finished - i.e. completed or cancelled. The parameter 0 indicates the type of calibration. A list of available calibration methods is part of the DeviceConfig and can be obtained by calling api.getDeviceConfig( ).
The example program waits for 10 seconds and then closes the connection:
api.disconnect() api.registerGazeSampleCallback(None) api.registerEventCallback(None)
The last two lines unregister the callback functions. Be sure to unregister them before destroying the API object.
Gaze samples are the most important data which is generated by the eye tracker. The eye tracker provides one gaze sample per frame. Each sample contains information about the time of measurement, the position of the eyes, the pupil radius and the point at which the user is lokking on a stimulus plane (usually a computer monitor).
When you want to ship your application, be sure to include all relevant files so that it can run on different computers. The EyeLogic functionality will only work on computers that have the EyeLogic Server installed. The installed server must be at least be of the same version as the supplied API DLLs (a newer server version is acceptable).
In addition to the relevant files of your application, you need to ship the contents of the bin/ folder of your language (typically including some .dll files). Place the contents of the bin/ folder in the working directory of your application and ship them together.
IMPORTANT – PLEASE READ CAREFULLY:
The License Agreement is a legal agreement between you and EyeLogic GmbH and its affiliates (“EyeLogic”, “we”, or “us”). This license agreement governs your use of the EyeLogic software and any third party software that may be distributed therewith (collectively the “software”). EyeLogic agrees to license the software to you (personally and/or on behalf of you employer) (collectively “you” or “your”) only if you accept all the terms contained in this license agreement. By installing, using, copying, or distributing all or any portion of the software, you accept and agree to be bound by all of the terms and conditions of this license agreement.
If you do not agree with any of the terms of this license agreement, do no install or use the software.
Disclaimer of Warranties: You acknowledge and agree that the application is provided on an “as is” and “as available” basis, and that your use of or reliance upon the application and any third party content and services accessed thereby is at you sole risk and discretion. EyeLogic and its affiliates, partners suppliers and licensors hereby disclaim any and all representations, warranties and guaranties regarding the application and third party content and services, whether express, implied or statutory, and including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, furthermore, EyeLogic and its affiliates, partners, suppliers and licensors make no warranty that
No advice or information whether oral or written, obtained by you from EyeLogic or from the application will create any warranty not expressly made herein or create any liability on the part of EyeLogic.
If the licensee modifies or replaces any of the third party open source software included in the software, EyeLogic is not obligated to provide any updates, maintenance, warranty, technical or other support or services for the resultant modified Software. You expressly acknowledge that any failure or damage to any hardware, software or systems as a result of such modification to the open source components of the software is excluded from the terms of any EyeLogic warranty.
EyeLogic is a manufacturer of high precision and high quality eye tracking devices, mainly for scientific and research use cases. EyeLogic GmbH is a spin-off of the Free University of Berlin, faculty of mathematics and computer science and has a vast experience in image processing and computer vision.
For technical support questions contact us via mail at: suppo rt@e yelog icso lutio ns.c om
EyeLogic GmbH Schlesische Str. 28 10997 Berlin Germany www: https://www.eyelogicsolutions.com
Copyright © EyeLogic GmbH