Eyetracker |

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
pygaze._eyetracker.libtobiilegacy.TobiiController Class Reference

## Public Member Functions
| __init__ (self, disp)
| waitForFindEyeTracker (self)
| on_eyetracker_browser_event (self, event_type, event_name, eyetracker_info)
| destroy (self)
| activate (self, eyetracker)
| activation methods
| on_eyetracker_created (self, error, eyetracker, eyetracker_info)
| doCalibration (self, calibrationPoints)
| calibration methods
| on_calib_start (self, error, r)
| on_add_completed (self, error, r)
| on_calib_compute (self, error, r)
| on_calib_response (self, error, calib)
| on_calib_done (self, status, msg)
| startTracking (self)
| stopTracking (self)
| on_gazedata (self, error, gaze)
| getPupilSize (self, gaze)
| getCurrentPupilSize (self)
| getGazePosition (self, gaze)
| getCurrentGazePosition (self)
| setDataFile (self, filename)
| closeDataFile (self)
| recordEvent (self, event)
| flushData (self)

## Public Attributes
| disp = disp
| screen = Screen()
| kb = Keyboard(keylist=None, timeout=None)
| eyetracker = None
dict | eyetrackers = {}
list | gazeData = []
list | eventData = []
| datafile = None
| clock = tobii.eye_tracking_io.time.clock.Clock()
| mainloop_thread = tobii.eye_tracking_io.mainloop.MainloopThread()
| browser = tobii.eye_tracking_io.browsing.EyetrackerBrowser(self.mainloop_thread, lambda t, n, i: self.on_eyetracker_browser_event(t, n, i))
| syncmanager = tobii.eye_tracking_io.time.sync.SyncManager(self.clock,eyetracker_info,self.mainloop_thread)
| points = calibrationPoints
int | point_index = -1
dict | calin = {'colour':(0,0,0), 'pos':(int(self.disp.dispsize[0]/2),int(self.disp.dispsize[1]/2)), 'r':2}
dict | calout = {'colour':(128,255,128), 'pos':(int(self.disp.dispsize[0]/2),int(self.disp.dispsize[1]/2)), 'r':64}
dict | calresult = {'img':img}
dict | calresultmsg = {'text':"",'pos':(int(self.disp.dispsize[0]/2),int(self.disp.dispsize[1]/4))}
bool | initcalibration_completed = False
bool | add_point_completed = False
bool | computeCalibration_completed = False
bool | computeCalibration_succeeded = False
bool | getcalibration_completed = False
| calib = self.eyetracker.GetCalibration(lambda error, calib: self.on_calib_response(error, calib))
| calibration = None

## Detailed Description

    Class to handle communication to Tobii eye trackers, as well as some
        display operations

## Constructor & Destructor Documentation

## ◆ __init__()

pygaze._eyetracker.libtobiilegacy.TobiiController.__init__ | ( |  | self,
|  |  | disp )

    Initializes TobiiController instance

            arguments
            disp        --  a pygaze.display.Display instance

            keyword arguments
            None

## Member Function Documentation

## ◆ activate()

pygaze._eyetracker.libtobiilegacy.TobiiController.activate | ( |  | self,
|  |  | eyetracker )

activation methods

    Connects to specified eye tracker

            arguments
            eyetracker  --  key for the self.eyetracker dict under which the
                        eye tracker to which you want to connect is found

            keyword arguments
            None

            returns
            None        --  calls TobiiController.on_eyetracker_created, then
                        sets self.syncmanager

## ◆ closeDataFile()

pygaze._eyetracker.libtobiilegacy.TobiiController.closeDataFile | ( |  | self | ) |

    Closes the datafile after writing the last data to it

            arguments
            None

            keyword arguments
            None

            returns
            None        --  calls TobiiController.flushData, then closes
                        self.datafile and sets self.datafile to None

## ◆ destroy()

pygaze._eyetracker.libtobiilegacy.TobiiController.destroy | ( |  | self | ) |

    Removes eye tracker and stops all operations

            arguments
            None

            keyword arguments
            None

            returns
            None        --  sets self.eyetracker and self.browser to None;
                        stops browser and the
                        tobii.eye_tracking_io.mainloop.MainloopThread

## ◆ doCalibration()

pygaze._eyetracker.libtobiilegacy.TobiiController.doCalibration | ( |  | self,
|  |  | calibrationPoints )

calibration methods

    Performs a calibration; displaying points and the calibration
            menu and keyboard input are handled by PyGaze routines, calibration
            is handled by Tobii routines

            arguments
            calibrationPoints   --  a list of (x,y) typles, specifying the
                            coordinates for the calibration points
                            (coordinates should be in PyGaze notation,
                            where (0,0) is the topleft and coordinates
                            are specified in pixels, e.g. (1024,768))

            keyword arguments
            None

            returns
            None or retval  --  returns None if no tracker is connected
                            returns retval when a tracker is connected;
                            retval can be one of three string values:
                                'accept'
                                'retry'
                                'abort'

## ◆ flushData()

pygaze._eyetracker.libtobiilegacy.TobiiController.flushData | ( |  | self | ) |

            arguments
            None

            keyword arguments
            None

            returns
            None

## ◆ getCurrentGazePosition()

pygaze._eyetracker.libtobiilegacy.TobiiController.getCurrentGazePosition | ( |  | self | ) |

    Provides the newest gaze position sample

            arguments
            None

            keyword arguments
            None

            returns
            gazepos --  a (Lx,Ly,Rx,Ry) tuple for the gaze positions
                        of both eyes or (None,None,None,None) if no new
                        sample is available

## ◆ getCurrentPupilSize()

pygaze._eyetracker.libtobiilegacy.TobiiController.getCurrentPupilSize | ( |  | self | ) |

    Provides the newest pupil size

            arguments
            None

            keyword argument
            None

            returns
            pupilsize   --  a (L,R) tuple for the pupil size in mm of both eyes
                        or (None,None) if no new size is available

## ◆ getGazePosition()

pygaze._eyetracker.libtobiilegacy.TobiiController.getGazePosition | ( |  | self,
|  |  | gaze )

    Extracts the gaze positions of both eyes from the Tobii gaze
            struct and recalculates them to PyGaze coordinates

            arguments
            gaze        --  Tobii gaze struct

            keyword arguments
            None

            returns
            gazepos --  a (Lx,Ly,Rx,Ry) tuple for the gaze positions
                        of both eyes

## ◆ getPupilSize()

pygaze._eyetracker.libtobiilegacy.TobiiController.getPupilSize | ( |  | self,
|  |  | gaze )

    Extracts the pupil size of both eyes from the Tobii gaze struct.

            arguments
            gaze        --  Tobii gaze struct

            keyword aguments
            None

            returns
            pupilsiez   --  a (L,R) tuple for the pupil size in mm of both eyes

## ◆ on_add_completed()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_add_completed | ( |  | self,
|  |  | error,
|  |  | r )

    Checks if there was an error on calling
            self.eyetracker.AddCalibrationPoint; method is called by
            TobiiController.doCalibration within a loop, until it sets
            self.add_point_completed to True

            arguments
            error       --  some error message from Tobii
            r       --  don't have a clue what this is supposed to be;
                        probably some output of Tobii's
                        AddCalibrationPoint; isn't used in the funtion

            keyword arguments
            None

            returns
            False       --  returns False if an error is passed and if no
                        error is passed, but does set
                        self.add_point_completed to True

## ◆ on_calib_compute()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_calib_compute | ( |  | self,
|  |  | error,
|  |  | r )

    Checks if there was an error on calling
            self.eyetracker.ComputeCalibration; method is called by
            TobiiController.doCalibration within a loop, until it sets
            self.computeCalibration_completed to True

            arguments
            error       --  some error message from Tobii
            r       --  don't have a clue what this is supposed to be;
                        probably some output of Tobii's
                        ComputeCalibration; isn't used in the funtion

            keyword arguments
            None

            returns
            False       --  returns False or throws an exception on an error;
                        sets self.computeCalibration_succeeded and
                        self.computeCalibration_completed to True

## ◆ on_calib_done()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_calib_done | ( |  | self,
|  |  | status,
|  |  | msg )

    What does this do? Does it get called by some Tobii function?
            There is no reference to this anywhere in the rest of the script...

            arguments
            status  --  I assume this is a Boolean, indicating whether
                        the calibration is succesful or not
            msg     --  Probably a string, explaining what went wrong in
                        the calibration

            keyword arguments
            None

            returns
            False       --  returns False in any case and sets
                        self.calibration to None

## ◆ on_calib_response()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_calib_response | ( |  | self,
|  |  | error,
|  |  | calib )

    Checks if there was an error on calling
            self.eyetracker.GetCalibration; method is called by
            TobiiController.doCalibration within a loop, until it sets
            self.getcalibration_completed to True

            arguments
            error       --  some error message from Tobii
            r       --  don't have a clue what this is supposed to be;
                        probably some output of Tobii's
                        GetCalibration; isn't used in the funtion

            keyword arguments
            None

            returns
            False       --  returns False or throws an exception on an error;
                        sets self.getcalibration_completed to True

## ◆ on_calib_start()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_calib_start | ( |  | self,
|  |  | error,
|  |  | r )

    Checks if there was an error on calling
            self.eyetracker.StartCalibration; method is called by
            TobiiController.doCalibration within a loop, until it sets
            self.initcalibration_completed to True

            arguments
            error       --  some error message from Tobii
            r       --  don't have a clue what this is supposed to be;
                        probably some output of Tobii's StartCalibration;
                        isn't used in the funtion

            keyword arguments
            None

            returns
            False/None  --  returns False if an error is passed; returns
                        nothing if no error is passed, but does set
                        self.initcalibration_completed to True

## ◆ on_eyetracker_browser_event()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_eyetracker_browser_event | ( |  | self,
|  |  | event_type,
|  |  | event_name,
|  |  | eyetracker_info )

    Adds a new or updates an existing tracker to self.eyetrackers,
            if one is available

            arguments
            event_type      --  a tobii.eye_tracking_io.browsing.EyetrackerBrowser
                            event
            event_name      --  don't know what this is for; probably passed
                            by some underlying Tobii function, specifying
                            a device name; it's not used within this
                            function
            eyetracker_info --  a struct containing information on the eye
                            tracker (e.g. it's product_id)

            keyword arguments
            None

            returns
            False           --  returns False after adding a new tracker to
                            self.eyetrackers or after deleting it

## ◆ on_eyetracker_created()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_eyetracker_created | ( |  | self,
|  |  | error,
|  |  | eyetracker,
|  |  | eyetracker_info )

    Function is called by TobiiController.activate, to handle all
            operations after connecting to a tracker has been succesfull

            arguments
            error           --  some Tobii error message
            eyetracker      --  key for the self.eyetracker dict under which
                            the eye tracker that is currently connected
            eyetracker_info --  name of the eye tracker to which a
                            connection has been established

            keyword arguments
            None

            returns
            None or False   --  returns nothing and sets self.eyetracke on
                            connection success; returns False on failure

## ◆ on_gazedata()

pygaze._eyetracker.libtobiilegacy.TobiiController.on_gazedata | ( |  | self,
|  |  | error,
|  |  | gaze )

    Adds new data point to the data collection (self.gazeData)

            arguments
            error       --  some Tobii error message, isn't used in function
            gaze        --  Tobii gaze data struct

            keyword arguments
            None

            returns
            None        --  appends gaze to self.gazeData list

## ◆ recordEvent()

pygaze._eyetracker.libtobiilegacy.TobiiController.recordEvent | ( |  | self,
|  |  | event )

    Adds an event to the event data

            arguments
            event       --  a string containing an event description

            keyword arguments
            None

            returns
            None        --  appends a (timestamp,event) tuple to
                        self.eventData

## ◆ setDataFile()

pygaze._eyetracker.libtobiilegacy.TobiiController.setDataFile | ( |  | self,
|  |  | filename )

    Opens a new textfile and writes date, time and screen resolution
            to it

            arguments
            filename    --  a string containing the filename, including an
                        extension

            keyword arguments
            None

            returns
            None        --  sets self.datafile to an open textfile

## ◆ startTracking()

pygaze._eyetracker.libtobiilegacy.TobiiController.startTracking | ( |  | self | ) |

    Starts the collection of gaze data

            arguments
            None

            keyword arguments
            None

            returns
            None        --  resets both self.gazeData and self.eventData, then
                        sets TobiiTracker.on_gazedata as an event callback
                        for self.eyetracker.events.OnGazeDataReceived and
                        calls self.eyetracker.StartTracking()

## ◆ stopTracking()

pygaze._eyetracker.libtobiilegacy.TobiiController.stopTracking | ( |  | self | ) |

    Starts the collection of gaze data

            arguments
            None

            keyword arguments
            None

            returns
            None        --  calls self.eyetracker.StopTracking(), then unsets
                        TobiiTracker.on_gazedata as an event callback for
                        self.eyetracker.events.OnGazeDataReceived, and
                        calls TobiiTracker.flushData before resetting both
                        self.gazeData and self.eventData

## ◆ waitForFindEyeTracker()

pygaze._eyetracker.libtobiilegacy.TobiiController.waitForFindEyeTracker | ( |  | self | ) |

    Keeps running until an eyetracker is found

            arguments
            None

            keyword arguments
            None

            returns
            None        --  only returns when an entry has been made to the
                        self.eyetrackers dict

## Member Data Documentation

## ◆ add_point_completed

bool pygaze._eyetracker.libtobiilegacy.TobiiController.add_point_completed = False

## ◆ browser

pygaze._eyetracker.libtobiilegacy.TobiiController.browser = tobii.eye_tracking_io.browsing.EyetrackerBrowser(self.mainloop_thread, lambda t, n, i: self.on_eyetracker_browser_event(t, n, i))

## ◆ calib

pygaze._eyetracker.libtobiilegacy.TobiiController.calib = self.eyetracker.GetCalibration(lambda error, calib: self.on_calib_response(error, calib))

## ◆ calibration

pygaze._eyetracker.libtobiilegacy.TobiiController.calibration = None

## ◆ calin

dict pygaze._eyetracker.libtobiilegacy.TobiiController.calin = {'colour':(0,0,0), 'pos':(int(self.disp.dispsize[0]/2),int(self.disp.dispsize[1]/2)), 'r':2}

## ◆ calout

dict pygaze._eyetracker.libtobiilegacy.TobiiController.calout = {'colour':(128,255,128), 'pos':(int(self.disp.dispsize[0]/2),int(self.disp.dispsize[1]/2)), 'r':64}

## ◆ calresult

dict pygaze._eyetracker.libtobiilegacy.TobiiController.calresult = {'img':img}

## ◆ calresultmsg

dict pygaze._eyetracker.libtobiilegacy.TobiiController.calresultmsg = {'text':"",'pos':(int(self.disp.dispsize[0]/2),int(self.disp.dispsize[1]/4))}

## ◆ clock

pygaze._eyetracker.libtobiilegacy.TobiiController.clock = tobii.eye_tracking_io.time.clock.Clock()

## ◆ computeCalibration_completed

bool pygaze._eyetracker.libtobiilegacy.TobiiController.computeCalibration_completed = False

## ◆ computeCalibration_succeeded

bool pygaze._eyetracker.libtobiilegacy.TobiiController.computeCalibration_succeeded = False

## ◆ datafile

pygaze._eyetracker.libtobiilegacy.TobiiController.datafile = None

## ◆ disp

pygaze._eyetracker.libtobiilegacy.TobiiController.disp = disp

## ◆ eventData

list pygaze._eyetracker.libtobiilegacy.TobiiController.eventData = []

## ◆ eyetracker

pygaze._eyetracker.libtobiilegacy.TobiiController.eyetracker = None

## ◆ eyetrackers

dict pygaze._eyetracker.libtobiilegacy.TobiiController.eyetrackers = {}

## ◆ gazeData

pygaze._eyetracker.libtobiilegacy.TobiiController.gazeData = []

## ◆ getcalibration_completed

bool pygaze._eyetracker.libtobiilegacy.TobiiController.getcalibration_completed = False

## ◆ initcalibration_completed

bool pygaze._eyetracker.libtobiilegacy.TobiiController.initcalibration_completed = False

## ◆ kb

pygaze._eyetracker.libtobiilegacy.TobiiController.kb = Keyboard(keylist=None, timeout=None)

## ◆ mainloop_thread

pygaze._eyetracker.libtobiilegacy.TobiiController.mainloop_thread = tobii.eye_tracking_io.mainloop.MainloopThread()

## ◆ point_index

int pygaze._eyetracker.libtobiilegacy.TobiiController.point_index = -1

## ◆ points

pygaze._eyetracker.libtobiilegacy.TobiiController.points = calibrationPoints

## ◆ screen

pygaze._eyetracker.libtobiilegacy.TobiiController.screen = Screen()

## ◆ syncmanager

pygaze._eyetracker.libtobiilegacy.TobiiController.syncmanager = tobii.eye_tracking_io.time.sync.SyncManager(self.clock,eyetracker_info,self.mainloop_thread)

The documentation for this class was generated from the following file:

- C:/Users/lurax/eyetrackingTobii/pygaze/_eyetracker/libtobiilegacy.py