Home Forums Software Development Gaze data callback function not triggering in Python

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23584
    Nav D
    Participant

    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_DATA

    The 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 time

    def 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:
    pass

    print(“Unsubscribing from gaze data.”)
    my_eyetracker.unsubscribe_from(tr.EYETRACKER_GAZE_DATA, gaze_data_callback)
    print(“Done.”)

    #23588
    Grant [Tobii]
    Keymaster

    Hi, 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/

    #23593
    Nav D
    Participant

    Thanks 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?

    #23594
    Nav D
    Participant

    Also 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 ?

    #23641
    Grant [Tobii]
    Keymaster

    Hi Nav, please send me a PM with the email you used to register interest and I will check it for you.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.