Home › Forums › Software Development › Tobii Pro Fusion with python, cannot print gaze data
Tagged: Python
- This topic has 3 replies, 2 voices, and was last updated 1 year, 4 months ago by Jonas Högström.
- AuthorPosts
- 08/05/2023 at 06:15 #23192daisukeParticipant
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.08/05/2023 at 14:49 #23195Jonas HögströmParticipantHave 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?
09/05/2023 at 05:17 #23196daisukeParticipantYes, 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'] my_eyetracker.subscribe_to( tr.EYETRACKER_GAZE_DATA, gaze_data_callback, as_dictionary=False) pd = (left_pd + right_pd)/2
I wondered if you could help me.
16/05/2023 at 14:56 #23238Jonas HögströmParticipantthe 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.
- AuthorPosts
- You must be logged in to reply to this topic.