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
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.
The following code will import the smi module and connect to the iViewHMD system:
Users will need to calibrate the eye tracking system when wearing the HMD. The calibration can be performed using the following code:
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:
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:
accept: Flags indicating how a calibration point will be accepted. The flag can be any combination of the following values:
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. |