Home › Forums › Software Development › Gaze data callback function not triggering in Python
Tagged: eye tracker 5 python
- This topic has 4 replies, 2 voices, and was last updated 1 year, 2 months ago by Grant [Tobii].
- AuthorPosts
- 08/09/2023 at 06:16 #23584Nav DParticipant
Hello.
I just got my eye tracker 5 and i am trying to access the gaze data from the device. I have installed tobii_research package and i can detect the device without issues.
However, my gaze_data_callback function does not trigger after subscribing to EYETRACKER_GAZE_DATAThe print logs should fire from within gaze_data_callback(gaze_data) but the output that i get is :
========================================
Found 1 eye tracker(s).
Attempting to subscribe to gaze data of eye tracker: <tobiiresearch.implementation.EyeTracker.EyeTracker object at 0x0000019A58E1AB60>
Successfully subscribed to gaze data.
=======================================
Has anyone had this issue?Below is my code.
import tobii_research as tr
import timedef gaze_data_callback(gaze_data):
print(“Gaze data received.”)
left_eye_point = gaze_data[‘left_gaze_point_on_display_area’]
right_eye_point = gaze_data[‘right_gaze_point_on_display_area’]
print(f”Left eye gaze point: {left_eye_point}”)
print(f”Right eye gaze point: {right_eye_point}”)eyetrackers = tr.find_all_eyetrackers()
if not eyetrackers:
print(“No eye trackers found.”)
exit(1)print(f”Found {len(eyetrackers)} eye tracker(s).”)
my_eyetracker = eyetrackers[0]try:
print(f”Attempting to subscribe to gaze data of eye tracker: {my_eyetracker}”)
my_eyetracker.subscribe_to(tr.EYETRACKER_GAZE_DATA, gaze_data_callback)
print(“Successfully subscribed to gaze data.”)
except Exception as e:
print(f”Failed to subscribe to gaze data: {e}”)
exit(1)print(“Press Enter to exit…”)
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
passprint(“Unsubscribing from gaze data.”)
my_eyetracker.unsubscribe_from(tr.EYETRACKER_GAZE_DATA, gaze_data_callback)
print(“Done.”)08/09/2023 at 11:16 #23588Grant [Tobii]KeymasterHi, the tobii_research package SDK is only for Tobii Pro Eye Trackers. The Tobii Eye Tracker 5 only interfaces with the Stream Engine API for which you can make a request for access @ https://developer.tobii.com/software-downloads/
08/09/2023 at 11:51 #23593Nav DParticipantThanks for the reply.
So is there any Python wrapper for stream engine api ?
Or C++ is the only option if you want to work with Gaze data from eye tracker 5?08/09/2023 at 14:19 #23594Nav DParticipantAlso although i have already requested the stream engine api through your provided link, how long do i typically need to wait before i can access it ?
04/10/2023 at 15:07 #23641Grant [Tobii]KeymasterHi Nav, please send me a PM with the email you used to register interest and I will check it for you.
- AuthorPosts
- You must be logged in to reply to this topic.