Skip to content

EyeXD/tobii-eye-tracker-proxy

Repository files navigation

Tobii Eye Tracker Proxy with Talon

This repository allows you to use Tobii Eye Tracker on macOS/Linux PC.

Prerequisites

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).

Installation

  1. Download and install Talon.

  2. Run the Talon app.

  3. 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
  4. 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
  5. Restart Talon

Usage

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()

Others

  • [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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •