Vizard 8 » Reference » Input Devices » Other devices » SMI iViewHMD
8.1

SMI iViewHMD

This smi module adds support for the iViewHMD eye tracking upgrade for the Oculus Rift by SensoMotoric Instruments (SMI).

 

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

Getting Started

In order to use the smi module you must first install version 1.3 of the iViewNG HMD SDK from SMI. Once installed, run the example application provided by the installer to verify functionality of the eye tracker.

Initialization

The following code will import the smi module and connect to the iViewHMD system:

import smi
iview = smi.iViewHMD()

Users will need to calibrate the eye tracking system when wearing the HMD. The calibration can be performed using the following code:

iview.calibrate()

This will run the calibration using the default settings. A calibration point will move to various positions and wait for the user to look at the point and press spacebar. Once the HMD is calibrated for the user, you can use the following code to access the latest gaze matrix of the user:

# Get gaze matrix in local HMD coordinate system
gazeMat = iview.getLastGazeMatrix()

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

iViewHMD

The smi.iViewHMD object contains the following methods:

Method

Description

<iview>.getLastGazeMatrix(eye=viz.BOTH_EYE)

Returns the last computed gaze matrix in the HMD coordinate system.

 

eye: The eye to retrieve the gaze matrix from (viz.LEFT_EYE or viz.RIGHT_EYE). viz.BOTH_EYE will return the average of both eyes.

<iview>.getLastSample()

Returns the latest sample.

<iview>.calibrate(

type = smi.CALIBRATION_3_POINT

, accept = smi.CALIBRATION_ACCEPT_KEY

, acceptKey = ' '

, clientVisualization = True)

Run a calibration.

 

type: Type of calibration to run. One of the following:

  • smi.CALIBRATION_1_POINT
  • smi.CALIBRATION_3_POINT
  • smi.CALIBRATION_5_POINT
  • smi.CALIBRATION_9_POINT

accept: Flags indicating how a calibration point will be accepted. The flag can be any combination of the following values:

  • smi.CALIBRATION_ACCEPT_KEY - Use specified accept key to accept point.
  • smi.CALIBRATION_ACCEPT_FIXATION - Automatically accept point based on fixation detection.

Calibration points can also be accepted programmatically using the <iview>.acceptCalibrationPoint() method.

 

acceptKey: If accepting key presses, then a key or list of keys that will be used to accept the calibration point.

 

clientVisualization: If True, calibration visualization is manually performed within Vizard graphics window. Otherwise, a separate calibration window is launched by the iViewHMD API.

<iview>.isCalibrating() Returns whether calibration is currently running.
<iview>.cancelCalibration() Cancel the currently running calibration method.
<iview>.acceptCalibrationPoint() Accept the current calibration point.
<iview>.resetCalibration() Reset the current calibration.
<iview>.loadCalibration(name='')

Load a previously saved calibration.

 

name: Name of calibration to load

<iview>.saveCalibration(name='')

Save current calibration.

 

name: Name of calibration to save

<iview>.getAvailableCalibrations() Get list of avaliable calibrations.
<iview>.validate() Display a 4x4 validation grid with gaze overlay, press ESC to exit the window.

<iview>.setEyeImageVisible(mode

, leftEyePos=[10,10]

, rightEyePos=[400,10])

Set whether to display eye images in separate windows.

 

mode: True to display eye images, False to hide them, and viz.TOGGLE to toggle visibility.

 

leftEyePos: Position of window displaying left eye.

 

rightEyePos: Position of window displaying right eye.

<iview>.getEyeImageVisible() Returns whether eye images are visible.
<iview>.startDetectingNewFixation() Starts a new fixation detection.
<iview>.checkForNewFixation() Returns whether a fixation has been found.
<iview>.getServerTime() Get the server time in nanoseconds since start.