Home Forums Software Development Tobii Pro Fusion with python, cannot print gaze data


Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #23192

    I want to measure the user’s gaze position and puppil diameter. I followed the tobii-sdk documentation which helps create a very basic program that prints gaze data from my Pro Fusion tracker. However, when I run the code the gaze data does not print.

    My code is directly off: http://developer.tobiipro.com/python/python-step-by-step-guide.html
    Also I am using the Tobii Pro Fusion eye tracker, with python 3.8.

    I don’t know why this code doesn’t work.
    Thank you so much in advance.

    Jonas Högström

    Have you installed the runtime service for ProFusion using EyeTracker manager?
    Have you done the initial device setup of your tracker with EyeTrackerManager (primarily screen config, but also user calibration)?
    What happens if you enable the gaze visualization in ETM?

    Do you get any error messages when running your code?


    Yes, I have installed the runtime service and confirmed that it is running on task manager.
    I have also done the initial device setup.
    When I enable the gaze visualization in ETM, gaze position is displayed without any problems.

    I get no error massages and gaze data.
    But the following code returns an error “‘left_pd’ is not defined”

    import tobii_research as tr
    found_eyetrackers = []
    while len(found_eyetrackers) == 0:
        found_eyetrackers = tr.find_all_eyetrackers()
    my_eyetracker = found_eyetrackers[0]
    def gaze_data_callback(gaze_data):
        left_pd = gaze_data['left_pupil_diameter']
        right_pd = gaze_data['right_pupil_diameter']
            tr.EYETRACKER_GAZE_DATA, gaze_data_callback, as_dictionary=False)
    pd = (left_pd + right_pd)/2

    I wondered if you could help me.

    Jonas Högström

    the variable left_pd will not have a value until the first gaze sample has arrived, and that typically takes a second or so. try doing your logic in the callback instead of directly after you subscribe.

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