Vizard 8 » Reference » Input Devices » Other devices » Tobii
8.0

Tobii

This plug-in provides support for Tobii HMD eye tracking devices.

 

A full sample script can be found at \examples\devices\tobiiViveExample.py

Initialization

The Tobii plug-in is implemented as a Vizard extension. In order to use the plug-in you must first install the eye tracker drivers and software provided by Tobii.

 

The Tobii extension object has the following methods/constants:

Method

Description

<tobii>.addEyeTracker()

Returns the first detected Tobii eye tracker.

<tobii>.getEyeTrackerList() Returns a list of all detected Tobii eye trackers.

<tobii>.CALIBRATE_3_POINT

<tobii>.CALIBRATE_5_POINT

<tobii>.CALIBRATE_9_POINT

Modes for performing user eye calibration.

The Tobii Eye Tracker provides both position and orientation data that represent the gaze origin/direction relative to the HMD coordinate frame. By default, the combined gaze values from both eyes is returned. To get the gaze values for each eye, pass the viz.LEFT_EYE or viz.RIGHT_EYE flag to the corresponding sensor function. The eye tracker object has the following methods in addition to the standard extension sensor methods:

Method

Description

<tracker>.calibrate(mode=CALIBRATE_5_POINT)

Start calibration procedure. Can use one of the calibration modes in table above.

<tracker>.cancelCalibration()

Cancel calibration if currently in progress.

<tracker>.getAddress()

Return the address of the eye tracker.

<tracker>.getSerialNumber() Return the serial number of the eye tracker.
<tracker>.getModel() Return the model name of the eye tracker.
<tracker>.getFirmwareVersion() Return the firmware version of the eye tracker.
<tracker>.getPupilDiameter(eye=viz.BOTH_EYE) Get the pupil diameter (in mm) of the specified eye. Specifying viz.BOTH_EYE will average the value from each eye.

Example

The following example shows how to connect to the Tobii eye tracker:

# Create the Tobii extension
tobii = viz.add('tobii.dle')

# Connect to Tobii eye tracker
eyeTracker = tobii.addEyeTracker()

The next example shows how to get the gaze vector and perform an intersection test to determine where the user is looking:

# Get gaze matrix in local HMD coordinate system
gazeMat = eyeTracker.getMatrix()

# Transform gaze matrix into world coordinate system using main view
gazeMat.postMult(viz.MainView.getMatrix())

# Intersect world gaze vector with scene
line = gazeMat.getLineForward(1000)
info = viz.intersect(line.begin, line.end)
if info.valid:
    print('User is looking at', info.point)