This repository allows you to use Tobii Eye Tracker on macOS/Linux PC.
You should first set up the Tobii Eye Tracker with a Windows driver such as Tobii Experience to fit the physical size of your display (Note: If you do not have a Windows PC, you may be able to use a virtual machine such as VirtualBox).
- Your macOS/Linux PC
- Talon
- Tobii Eye Tracker
-
Download and install Talon.
-
Run the Talon app.
-
Check the Talon Home directory (Talon has a menu in your system tray near the clock, you can use
Scripting
-> Open~/.talon
as a shortcut open Talon Home):> ls ~/.talon
-
Clone this repository to
~/.talon/user
:> git clone https://github.com/Eye-Interaction-Design/tobii-eye-tracker-proxy.talon ~/.talon/user/tobii-eye-tracker-proxy
-
Restart Talon
The rpyc module is required.
# examples/client.py
import rpyc
import socket
import json
import threading
import time
conn = rpyc.connect_by_service("TALONEYETRACKERPROXY")
eye_trackers = conn.root.eye_trackers
print("Current eye trackers:", eye_trackers)
# -> Current eye trackers: {'IS5FF-100213541234': <user.tobii-eye-tracker-proxy.tobii_eye_tracker.TobiiEyeTracker object at 0x12106b790>}
eye_tracker_serial = list(eye_trackers.keys())[0]
udp_port = 12345
conn.root.subscribe_gaze_udp(eye_tracker_serial, "localhost", udp_port)
def udp_receiver():
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('localhost', udp_port))
while True:
try:
data, addr = sock.recvfrom(1024)
gaze_data = json.loads(data.decode())
print(f"Gaze: {gaze_data}")
# -> Gaze: {'timestamp': ..., 'left_eye': ...}
except Exception as e:
print(f"UDP receive error: {e}")
threading.Thread(target=udp_receiver, daemon=True).start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
conn.close()
- [Calibration] Go to
Eye Tracking
->Calibrate
in the menu - [Debug] Go to
Scripting
->View Log
in the menu for debug output - [ON/OFF] Press
Ctrl + 1
/Ctrl + 2
to start/stop proxy