Home › Forums › Eye Tracking Devices › Tobii EyeX Linux?
- This topic has 28 replies, 5 voices, and was last updated 3 years, 8 months ago by
Grant [Tobii].
- AuthorPosts
- 25/01/2019 at 01:54 #9277
Suhyung
ParticipantI have been reading many topics asking for linux sdk for tobii eye trackers since 2014, and the response was always that the sdk is under development… I tested the EyeX on windows succesfully, and now I want to integrate it with ROS in Ubuntu 14.04, but I failed to find a suitable sdk of this eye tracker. Is there any sdk that would allow read the gaze data in linux?
Thanks you in advance25/01/2019 at 13:40 #9281Grant [Tobii]
KeymasterHi @my5tery and thanks for your query. There is now available an early alpha release of the Stream Engine API for linux for you to try.
You can view the instructions for installation @ https://developer.tobii.com/consumer-eye-trackers/stream-engine/getting-started/
Hopefully this is exactly what you are looking for. Please let us know if we can be of any further assistance.
30/01/2019 at 12:52 #9287Suhyung
ParticipantThank you for your response. I have tried to install it, but the targetted version is Ubuntu 16.04 LTS, and I am running on ubuntu 14.04 LTS. I think this is the reason that I failed to install the required softwares. It gives me error while I am installing.
Isn’t there any other way to use the eye tracker on ubuntu?30/01/2019 at 14:05 #9288Suhyung
ParticipantI am upgrading to Ubuntu 16.04 LTS now, I will try with this one 🙂
30/01/2019 at 16:20 #9289Suhyung
ParticipantI am trying to install it on Ubuntu 16.04 now. I followed the steps and installed 3 packages. But the last step, which says to install stream engine client, I cannot follow it because I cannot find .deb file in the files that I downloaded from Tobii Core Software for Linux. I am actually seeing a stream_engine_linux_*.tar.gz file, which I managed to extract it, but there is no make file or configure script. What should I do here?
I am just trying to publish the eye position in ROS topic, I don’t even need calibration methods…
30/01/2019 at 18:14 #9290Grant [Tobii]
KeymasterHi @my5tery, the final part of the Stream Engine SDK process after installing the debian files is using the c++ libraries within the stream_engine_linux_3.0.4.6031.tar.gz file as included in the ZIP archive to create your first program.
Which IDE are you using for your programming? You will need to add the paths to the header and library files within your IDE to run your first C++ stream engine SDK application.
As a simple example, try compiling the following code after setting the paths:
#include <tobii/tobii.h> #include <tobii/tobii_streams.h> #include <stdio.h> #include <assert.h> void gaze_point_callback( tobii_gaze_point_t const* gaze_point, void* user_data ) { if( gaze_point->validity == TOBII_VALIDITY_VALID ) printf( "Gaze point: %f, %f\n", gaze_point->position_xy[ 0 ], gaze_point->position_xy[ 1 ] ); } static void url_receiver( char const* url, void* user_data ) { char* buffer = (char*)user_data; if( *buffer != '\0' ) return; // only keep first value if( strlen( url ) < 256 ) strcpy( buffer, url ); } int main() { tobii_api_t* api; tobii_error_t error = tobii_api_create( &api, NULL, NULL ); assert( error == TOBII_ERROR_NO_ERROR ); char url[ 256 ] = { 0 }; error = tobii_enumerate_local_device_urls( api, url_receiver, url ); assert( error == TOBII_ERROR_NO_ERROR && *url != '\0' ); tobii_device_t* device; error = tobii_device_create( api, url, &device ); assert( error == TOBII_ERROR_NO_ERROR ); error = tobii_gaze_point_subscribe( device, gaze_point_callback, 0 ); assert( error == TOBII_ERROR_NO_ERROR ); int is_running = 1000; // in this sample, exit after some iterations while( --is_running > 0 ) { error = tobii_wait_for_callbacks( NULL, 1, &device ); assert( error == TOBII_ERROR_NO_ERROR || error == TOBII_ERROR_TIMED_OUT ); error = tobii_device_process_callbacks( device ); assert( error == TOBII_ERROR_NO_ERROR ); } error = tobii_gaze_point_unsubscribe( device ); assert( error == TOBII_ERROR_NO_ERROR ); error = tobii_device_destroy( device ); assert( error == TOBII_ERROR_NO_ERROR ); error = tobii_api_destroy( api ); assert( error == TOBII_ERROR_NO_ERROR ); return 0; }
Please bear in mind you *will* need to calibrate otherwise the eye position data will not be reliable.
Try setting up your first program and let us know how you get on. Best Wishes.
31/01/2019 at 16:09 #9296Suhyung
ParticipantThank you for the support.
I am not using a specific IDE at the moment. I was using libraries and executing them on Command, so I can publish the data in nodes and visualize them in rviz (if you are familiar with ROS). But since there is no such library, I would have to create my own one.
The code that you have written is publishing the gaze point data right? I am not familiar with creating library, but is this code going to be .cpp file?
Sorry I wasn’t expecting that I would make the library, and I am learning now..03/02/2019 at 21:40 #9302Grant [Tobii]
KeymasterHi @my5tery, yes that’s right. The simple c++ code above is just to get the basic gaze co-ordinates and yes is a cpp file. I am afraid that the Stream Engine SDK is designed to work with an IDE so you will certainly need some kind of development environment to get started and thereafter hopefully can integrate with your RVIZ solution. Please let us know how you get on in this regard and we will try to help best we can.
Please bear in mind that as stated in the original Core SDK Stream Engine API homepage that the linux variant is still in early alpha and designed for advanced users so detailed support will be limited. Never the less, please try first compiling the above code and report back here on your progress. Best wishes.
06/02/2019 at 19:04 #9315Suhyung
ParticipantI have been trying to run the example code, however, it says that there is error at error = tobii_wait_for_callbacks( NULL, 1, &device );
Saying that we cannot change from ‘int’ to ‘tobii_device_t* const*’.But never mind of this problem. In this example code, I can only see that it is checking if everything is going fine, checking if there is any error. However, I cannot see anywhere where it is getting us the position of the gaze, except for the void gaze_point_callback.
I would just like to retrieve the x and y position so I can use them in my code. I have read the tobii_stream_engine_api.pdf, checking if there was any function of variable for that purpose, but I couldnt find it. Could you please lead me to the right way?
07/02/2019 at 15:34 #9323Grant [Tobii]
KeymasterHi @my5tery, as described on Page 25 of tobii_stream_engine_api.pdf the position_xy is an array of two floats, for the horizontal (x) and vertical (y) screen coordinate of the gaze point and is called in the code above at this junction:
void gaze_point_callback( tobii_gaze_point_t const* gaze_point, void* user_data ) { if( gaze_point->validity == TOBII_VALIDITY_VALID ) printf( "Gaze point: %f, %f\n", gaze_point->position_xy[ 0 ], gaze_point->position_xy[ 1 ] ); }
07/02/2019 at 16:55 #9324Suhyung
ParticipantDo you have any clue about the error that I am getting on testing the demo code?:
it says that there is error at error = tobii_wait_for_callbacks( NULL, 1, &device );
Saying that we cannot change from ‘int’ to ‘tobii_device_t* const*’Is it okay if I remove that “NULL” and just put tobii_wait_for_callbacks( 1, &device); ??
10/02/2019 at 22:32 #9335Grant [Tobii]
KeymasterHi @my5tery, could you please kindly clarify exactly which IDE and software versions you are working with and I will try to reproduce thanks.
11/02/2019 at 16:48 #9343Suhyung
ParticipantHi, I am using just a Visual Studio Code to modify the cpp file, and Ubuntu 16.04, with ROS kinetic.
I was getting error with error = tobii_wait_for_callbacks( NULL, 1, &device ); when I was trying to compile the file, so I just changed to error = tobii_wait_for_callbacks( 1, &device ); I’m not sure if it will work.And I could compile it, and now I am running the code, but I get stuck when I try to get the url. It looks like url stays as 0 when I run tobii_enumerate_local_device_urls, so I cannot keep going. It seems like it does not recognize the device. I checked with lsusb if the device was connected, and it was. So now, I don’t really know how to keep going with no errors in the code, but it can’t find the device..
13/02/2019 at 12:26 #9358Suhyung
ParticipantI have a fast question. How should I use the files in “bindings” folder? The .cs files. Are they essential to get the url for the device? Because I haven’t done anything with them, and seems like the pc can’t detect the device.
13/02/2019 at 13:16 #9359Suhyung
ParticipantOr maybe it is problem of tobiiusbservice.deb file? When I install it, it says that it is for the Tobii IS4 eye tracker, and I am using EYEX. Also, it doesn’t stay installed. Just after installing, it becomes removed, as well as for tobii_engine_linux.deb.
tobii_config.deb though, it stays installed and I can launch it, and it tells me to connect a tobii device if I launch it, but, even I connect my device, it won’t work since the usbdriver is not working(?).
So, I guess it is the problem of usb driver, not the code itself, since it compiles 100% and does not give me errors. Just I can’t recognize the device… - AuthorPosts
- You must be logged in to reply to this topic.