Home › Forums › Software Development › [Solved] Delay problem of HandleEvent
Tagged: HandleEvent, sdk
- This topic has 7 replies, 3 voices, and was last updated 6 years, 4 months ago by Hyungmin.
- 19/10/2016 at 05:19 #5841
Hi. I’m using ‘Assembly Tobii EyeX Development kit’ and C/C++ SDK about it, because i want to use data like gaze point and eye positions.
So, i checked the sample code ‘MinimalGazeDataStream.c’.
Then i think that i should make additional code(something i want to do) in HandleEvent(*Which is callback function invoked when an event has been received from the EyeX Engine).
But if i make some additional code in HandleEvent function, getting gaze data stream is delayed.(printed gaze point data in console is not real time data)
Are there any solution about it? (for example, selectively get the data when i want to, received signal from the EyeX engine less frequently, or any other method)
Thanks24/10/2016 at 12:12 #5861Grant [Tobii]Keymaster
Certainly there should be no effect on data timing by inserting code in this function, indeed it’s intentional to do so!
If you could kindly place a snippet of your code, I should be able to see what the problem is.25/10/2016 at 07:25 #5862
Thanks for your reply,,,
I know why the delay happened.
I’m using ‘OpenCV’ library, and i add the function like ‘waitKey’ to display the image or to get ‘key input’ in ‘HandleEvent’.
So, delay happened. (function ‘waitKey(delaytime)’ waits for delaytime)
But, i still need to get ‘user key input’ because i need to save or use ‘gaze data’ for my experiments.
I have some new questions…
1) I want to bring the ‘gaze data’ to ‘main’ function, then use the ‘gaze data’ in ‘main’ function.
But, i don’t know how to do that. (not always need to bring data to main function, bring data when i want to)
(i don’t know how to get out ‘gaze data, eye position data, etc’ to ‘main function’ or outside of ‘HandleEvent’ function)
2) If i need ‘user key input’ in ‘HandleEvent’ without delay, what should i do that?
(for example, when i press ‘b’ key, save the ‘gaze data’ for a while in .txt file)
3) Sample code ‘MinimalGazeDataStream.c’ exit the process, when i press any key. (because of ‘_getch()’ i think)
But i want to change that when i press a specific key(like ‘space key’ or ‘a’) then the process is terminated.
How can i do that?
Thanks.26/10/2016 at 12:45 #5872Grant [Tobii]Keymaster
Thanks for the clarification. You state in your reply that you “need to save or use ‘gaze data’ for my experiments”.
Please bear in mind that is explicitly prohibited in the Tobii SDK licence agreement.
To that end, it is quite intentional that you cannot bring gaze data into the main function.
Unfortunately then, I cannot offer official advice on how to proceed as we are quite strict with regards to this policy.26/10/2016 at 14:27 #5873
I don’t understand why we cannot use gaze data for our application(like game)?
Don’t SDK provide that?(Isn’t it “development kit” literally?)
I just want to use gaze point data value for our application.
For that i need to bring out the gaze point data from ‘HandleEvent’
(or use the gaze point data in ‘HandleEvent’ function, if it’s possible to get ‘user key input’)
Isn’t it possible?27/10/2016 at 05:17 #5880
For more clarification, i think i should explain more details about what i want to do.
I have some points in 3-d coordinate, and i want to project that points to eye positions using Tobii eye tracker.
I just want to calculate projected points coordinate.I think it’s not an analytical use.
But for that, i need to get ‘user key input’ in real time without delay in function ‘HandleEvent’
and i need to get eye positions and gaze point data simultaneously.27/10/2016 at 16:15 #5883Jenny [Tobii]Participant
I think the point @grant-rogers is trying to make is that the Tobii Engine SDK license agreement does not allow for storing eye-gaze data on disk or storage media for later analysis. The eye-gaze data is free to be used for gaze interaction purposes in games and applications, using it real-time so to speak.
It seems your questions are mostly related to how to implement things in C. The minimal C samples are not really meant to be a basis to build an application on top of. They are supposed to show the different functions that are available in the API. I would assume most people use C++ to code against the C API and use bits and pieces from the sample code in their own application.
While we are happy to help you with questions about eye tracking data and the API itself, I would have to point you to online C and C++ programming resources to figure out how to program in general or how to use things like ‘_getch()’. Google and Stackoverflow are your friends for this 🙂
Here are some hints how to get data “from the HandleEvent function to the main function”, though:
The callbacks to HandleEvent come on a background thread, so you need to temporarily store the gaze point and eye position values in variables that are accessible from the main loop, and then read the values in the main loop when you get the user input. I guess the fast and easy way to do this is to store the values in global variables.
Happy coding!27/10/2016 at 16:59 #5884
I think that there is another method not using global variables.
But it’s really helpful and I’m very grateful to both of you.
- You must be logged in to reply to this topic.