Home › Forums › Software Development › Issue with python sdk find_all_eyetrackers() function
Tagged: bug
- This topic has 1 reply, 2 voices, and was last updated 2 weeks ago by Jonas Högström.
- AuthorPosts
- 13/09/2024 at 17:33 #26548Daniel Jimenez GilParticipant
Good morning, I wanted to report some strange behavior with the python sdk eyetracker detection function. I am using python 3.10 and windows 11.
In short, it seems that the find_all_eyetrackers() function is using some cached information and detecting an eye tracker even when none is connected. Even after clearing my %temp% folder and restarting my laptop the sdk is somehow still finding this fictitious eye tracker. When I connect the eye tracker to my laptop it finds both the newly connected eye tracker and the fake one, not always in the same order, making it difficult to work with. I have found a work around which I will share below, however I would definitely appreciate some input from other developers on what the best way to deal with this is.
For those who are experiencing a similar problem here is a workaround I have found:
def test_eyetracker(eyetracker) -> bool: print(f"testing eyetracker at {eyetracker.address}: ", end="") passed = False def callback(gaze_data): nonlocal passed passed = True eyetracker.unsubscribe_from(tr.EYETRACKER_GAZE_DATA) eyetracker.subscribe_to(tr.EYETRACKER_GAZE_DATA, callback) time.sleep(2) print("passed"*passed + "failed"*(1-passed)) return passed def find_and_get_eyetracker(): print("finding eyetrackers...") all_eyetrackers = tr.find_all_eyetrackers() if all_eyetrackers: for eyetracker in all_eyetrackers: if test_eyetracker(eyetracker): print(f"eyetracker found at {all_eyetrackers[0].address}") return eyetracker raise ConnectionError("No connected eyetrackers found. Please check the connection "+ "and/or install any missing drivers with Tobii Pro Eye Tracker Manager")
- This topic was modified 2 weeks, 5 days ago by Daniel Jimenez Gil.
19/09/2024 at 09:09 #26755Jonas HögströmParticipantIf you print out the model or serial number instead of the address for the trackers you find you will see more useful information about tracker the SDK detects. My guess is that you are using a computer with some preinstalled Tobii software for consumer use (Tobii Aware), and that this is the device you are detecting.
It should be easy to filter out the device you are really interested in by checking the value of the eye tracker model. This is faster and better compared to trying to subscribe/unsubscribe to gaze.
- AuthorPosts
- You must be logged in to reply to this topic.