Esempio n. 1
0
    def __init__(self,*args,**kwargs):
        """
        EyeTracker class. This class is to be extended by each eye tracker specific implemetation
        of the pyEyeTrackerInterface.

        Please review the documentation page for the specific eye tracker model that you are using the
        pyEyeTrackerInterface with to get the appropriate module path for that eye tracker; for example,
        if you are using an interface that supports eye trackers developed by EyeTrackingCompanyET, you
        may initialize the eye tracker object for that manufacturer something similar too :

           eyeTracker = hub.eyetrackers.EyeTrackingCompanyET.EyeTracker(**kwargs)

        where hub is the instance of the ioHubClient class that has been created for your experiment.

        **kwargs are an optional set of named parameters.

        **If an instance of EyeTracker has already been created, trying to create a second will raise an exception. Either destroy the first instance and then create the new instance, or use the class method EyeTracker.getInstance() to access the existing instance of the eye tracker object.**
        """
        if EyeTracker._INSTANCE is not None:
            raise ioHub.devices.ioDeviceError(self.__class__.__name__,"EyeTracker object has already been created; only one instance can exist. Delete existing instance before recreating EyeTracker object.")
        
        # >>>> eye tracker config
        EyeTracker.eyeTrackerConfig=kwargs['dconfig']
        #print " #### EyeTracker Configuration #### "
        #print self.eyeTrackerConfig
        #print ''
        # <<<<
		
		## Load quicklink dll
        EyeTracker._DLL = windll.LoadLibrary("C:\\Program Files\\EyeTechDS\\QuickLink2_2.5.1.0\\bin\\QuickLink2.dll")
        ioHub.print2err("DLL: ",EyeTracker._DLL)
        
        # create Device level class setting dictionary and pass it Device constructor
        deviceSettings= dict(instance_code=self.eyeTrackerConfig['instance_code'],
            category_id=ioHub.devices.EventConstants.DEVICE_CATERGORIES['EYE_TRACKER'],
            type_id=ioHub.devices.EventConstants.DEVICE_TYPES['EYE_TRACKER_DEVICE'], device_class=self.eyeTrackerConfig['device_class'],
            user_label=self.eyeTrackerConfig['name'], os_device_code='OS_DEV_CODE_NOT_SET',
            max_event_buffer_length=self.eyeTrackerConfig['event_buffer_length'])
        Device.__init__(self,**deviceSettings)
        
        # set this instance as 'THE' instance of the eye tracker.
        EyeTracker._INSTANCE=self
        EyeTracker.DEVICE_START_TIME=0.0
        
        # >>>> eye tracker setting to config (if possible)
        runtimeSettings=self.eyeTrackerConfig['runtime_settings']
        
        # >>>> Display / Calibration related information to use for config if possible
        EyeTracker.displaySettings = self.eyeTrackerConfig['display_settings']


        ioHub.print2err("Start createFrameTest")
        testFrame=createFrameTest()
        ioHub.print2err(testFrame.PixelData[0:testFrame.Width*testFrame.Height])
        ioHub.print2err("End createFrameTest")

        ioHub.print2err("Done EyeTech Init")
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        deviceConfig = kwargs['dconfig']
        deviceSettings = {
            'instance_code':
            deviceConfig['instance_code'],
            'category_id':
            ioHub.devices.EventConstants.DEVICE_CATERGORIES[
                Joystick.categoryTypeString],
            'type_id':
            ioHub.devices.EventConstants.DEVICE_TYPES[
                Joystick.deviceTypeString],
            'device_class':
            deviceConfig['device_class'],
            'user_label':
            deviceConfig['name'],
            'os_device_code':
            'OS_DEV_CODE_NOT_SET',
            'max_event_buffer_length':
            deviceConfig['event_buffer_length']
        }
        Device.__init__(self, **deviceSettings)
        #ioHub.print2stderr("kwargs: "+str(kwargs))

        self._lastPollTime = None

        if Joystick._joystickGLFWInitialized is False:
            Joystick._joystickGLFWInitialized = True
            glfw.Init()

            for i in xrange(glfw.JOYSTICK_LAST):
                if glfw.GetJoystickParam(i, glfw.PRESENT):
                    Joystick._detectedJoysticks.append(i)

        if 'joystick_index' in kwargs['dconfig']:
            self._jid = kwargs['dconfig']['joystick_index']
            if not glfw.GetJoystickParam(self._jid, glfw.PRESENT):
                raise ioHub.devices.ioDeviceError(
                    self,
                    "Requested joystick ID is not present on the computer: %d"
                    % (deviceSettings['joystick_index']))
            jbuttons = glfw.GetJoystickButtons(self._jid)
            jpositions = glfw.GetJoystickPos(self._jid)
            self._joystickButtonStates = N.copy((jbuttons, jbuttons))
            self._joystickPositionStates = N.copy((jpositions, jpositions))

            #ioHub.print2stderr('Buttons:')
            #ioHub.print2stderr(str(self._jid)+' : '+str(self._joystickButtonStates.shape)+' : '+str(self._joystickButtonStates[0])+' : '+str(len(jbuttons)))

            #ioHub.print2stderr('Positions:')
            #ioHub.print2stderr(str(self._jid)+' : '+str(self._joystickPositionStates.shape)+' : '+str(self._joystickPositionStates[1])+' : '+str(len(jpositions)))
        else:
            raise ioHub.devices.ioDeviceError(
                self,
                "joystick_index must be supplied as an entry in the configuration for this device."
            )
Esempio n. 3
0
    def __init__(self,*args,**kwargs):
        deviceConfig=kwargs['dconfig']
        deviceSettings={'instance_code':deviceConfig['instance_code'],
                        'category_id':ioHub.devices.EventConstants.DEVICE_CATERGORIES[Joystick.categoryTypeString],
                        'type_id':ioHub.devices.EventConstants.DEVICE_TYPES[Joystick.deviceTypeString],
                        'device_class':deviceConfig['device_class'],
                        'user_label':deviceConfig['name'],
                        'os_device_code':'OS_DEV_CODE_NOT_SET',
                        'max_event_buffer_length':deviceConfig['event_buffer_length']
                        }
        Device.__init__(self,**deviceSettings)
        #ioHub.print2stderr("kwargs: "+str(kwargs))

        self._lastPollTime=None

        if Joystick._joystickGLFWInitialized is False:
            Joystick._joystickGLFWInitialized=True
            glfw.Init()

            for i in xrange(glfw.JOYSTICK_LAST):
                if glfw.GetJoystickParam(i,glfw.PRESENT):
                    Joystick._detectedJoysticks.append(i)

        if 'joystick_index' in kwargs['dconfig']:
            self._jid=kwargs['dconfig']['joystick_index']
            if not glfw.GetJoystickParam(self._jid,glfw.PRESENT):
                raise ioHub.devices.ioDeviceError(self,"Requested joystick ID is not present on the computer: %d"%(deviceSettings['joystick_index']))
            jbuttons=glfw.GetJoystickButtons(self._jid)
            jpositions= glfw.GetJoystickPos(self._jid)
            self._joystickButtonStates=N.copy((jbuttons,jbuttons))
            self._joystickPositionStates=N.copy((jpositions,jpositions))

            #ioHub.print2stderr('Buttons:')
            #ioHub.print2stderr(str(self._jid)+' : '+str(self._joystickButtonStates.shape)+' : '+str(self._joystickButtonStates[0])+' : '+str(len(jbuttons)))

            #ioHub.print2stderr('Positions:')
            #ioHub.print2stderr(str(self._jid)+' : '+str(self._joystickPositionStates.shape)+' : '+str(self._joystickPositionStates[1])+' : '+str(len(jpositions)))
        else:
            raise ioHub.devices.ioDeviceError(self,"joystick_index must be supplied as an entry in the configuration for this device.")
Esempio n. 4
0
    def __init__(self, *args, **kwargs):
        """
        EyeTracker class. This class is to be extended by each eye tracker specific implemetation
        of the pyEyeTrackerInterface.

        Please review the documentation page for the specific eye tracker model that you are using the
        pyEyeTrackerInterface with to get the appropriate module path for that eye tracker; for example,
        if you are using an interface that supports eye trackers developed by EyeTrackingCompanyET, you
        may initialize the eye tracker object for that manufacturer something similar too :

           eyeTracker = hub.eyetrackers.EyeTrackingCompanyET.EyeTracker(**kwargs)

        where hub is the instance of the ioHubClient class that has been created for your experiment.

        **kwargs are an optional set of named parameters.

        **If an instance of EyeTracker has already been created, trying to create a second will raise an exception. Either destroy the first instance and then create the new instance, or use the class method EyeTracker.getInstance() to access the existing instance of the eye tracker object.**
        """
        if EyeTracker._INSTANCE is not None:
            raise ioHub.devices.ioDeviceError(
                self.__class__.__name__,
                "EyeTracker object has already been created; only one instance can exist. Delete existing instance before recreating EyeTracker object."
            )

        # >>>> eye tracker config
        EyeTracker.eyeTrackerConfig = kwargs['dconfig']
        #print " #### EyeTracker Configuration #### "
        #print self.eyeTrackerConfig
        #print ''
        # <<<<

        ## Load quicklink dll
        EyeTracker._DLL = windll.LoadLibrary(
            "C:\\Program Files\\EyeTechDS\\QuickLink2_2.5.1.0\\bin\\QuickLink2.dll"
        )
        ioHub.print2err("DLL: ", EyeTracker._DLL)

        # create Device level class setting dictionary and pass it Device constructor
        deviceSettings = dict(
            instance_code=self.eyeTrackerConfig['instance_code'],
            category_id=ioHub.devices.EventConstants.
            DEVICE_CATERGORIES['EYE_TRACKER'],
            type_id=ioHub.devices.EventConstants.
            DEVICE_TYPES['EYE_TRACKER_DEVICE'],
            device_class=self.eyeTrackerConfig['device_class'],
            user_label=self.eyeTrackerConfig['name'],
            os_device_code='OS_DEV_CODE_NOT_SET',
            max_event_buffer_length=self.
            eyeTrackerConfig['event_buffer_length'])
        Device.__init__(self, **deviceSettings)

        # set this instance as 'THE' instance of the eye tracker.
        EyeTracker._INSTANCE = self
        EyeTracker.DEVICE_START_TIME = 0.0

        # >>>> eye tracker setting to config (if possible)
        runtimeSettings = self.eyeTrackerConfig['runtime_settings']

        # >>>> Display / Calibration related information to use for config if possible
        EyeTracker.displaySettings = self.eyeTrackerConfig['display_settings']

        ioHub.print2err("Start createFrameTest")
        testFrame = createFrameTest()
        ioHub.print2err(testFrame.PixelData[0:testFrame.Width *
                                            testFrame.Height])
        ioHub.print2err("End createFrameTest")

        ioHub.print2err("Done EyeTech Init")
Esempio n. 5
0
    def __init__(self, *args, **kwargs):
        """
        EyeTracker class. This class is to be extended by each eye tracker specific implemetation
        of the pyEyeTrackerInterface.

        Please review the documentation page for the specific eye tracker model that you are using the
        pyEyeTrackerInterface with to get the appropriate module path for that eye tracker; for example,
        if you are using an interface that supports eye trackers developed by EyeTrackingCompanyET, you
        may initialize the eye tracker object for that manufacturer something similar too :

           eyeTracker = hub.eyetrackers.EyeTrackingCompanyET.EyeTracker(**kwargs)

        where hub is the instance of the ioHubClient class that has been created for your experiment.

        **kwargs are an optional set of named parameters.

        **If an instance of EyeTracker has already been created, trying to create a second will raise an exception. Either destroy the first instance and then create the new instance, or use the class method EyeTracker.getInstance() to access the existing instance of the eye tracker object.**
        """
        if EyeTracker._INSTANCE is not None:
            raise ioHub.devices.ioDeviceError(
                self.__class__.__name__,
                "EyeTracker object has already been created; only one instance can exist. Delete existing instance before recreating EyeTracker object.",
            )

        # >>>> eye tracker config
        EyeTracker.eyeTrackerConfig = kwargs["dconfig"]
        # print " #### EyeTracker Configuration #### "
        # print self.eyeTrackerConfig
        # print ''
        # <<<<

        # create Device level class setting dictionary and pass it Device constructor
        deviceSettings = dict(
            instance_code=self.eyeTrackerConfig["instance_code"],
            category_id=ioHub.devices.EventConstants.DEVICE_CATERGORIES["EYE_TRACKER"],
            type_id=ioHub.devices.EventConstants.DEVICE_TYPES["EYE_TRACKER_DEVICE"],
            device_class=self.eyeTrackerConfig["device_class"],
            user_label=self.eyeTrackerConfig["name"],
            os_device_code="OS_DEV_CODE_NOT_SET",
            max_event_buffer_length=self.eyeTrackerConfig["event_buffer_length"],
        )
        Device.__init__(self, **deviceSettings)

        # set this instance as 'THE' instance of the eye tracker.
        EyeTracker._INSTANCE = self

        EyeTracker.DEVICE_START_TIME = 0.0

        # >>>> eye tracker setting to config (if possible)
        #
        # Current settings, example from possible values.
        #
        # 'sampling_rate': 60.0,
        # 'vog_settings': {
        #                  'pupil_illumination': 'dark',
        #                  'pupil_center_algorithm': 'centroid',
        #                  'tracking_mode': 'pupil-cr'
        #                 }
        # 'default_calibration': '9P'
        # 'track_eyes': 'BINOC'
        # 'runtime_filtering': {
        #                       'ANY': 0
        #                      }
        runtimeSettings = self.eyeTrackerConfig["runtime_settings"]

        # print ''
        # print " #### EyeTracker Runtime Settings #### "
        # print runtimeSettings
        # print ''
        # <<<<

        # >>>> Display / Calibration related information to use for config if possible
        #
        # Current settings, example from possible values.
        #
        EyeTracker.displaySettings = self.eyeTrackerConfig["display_settings"]
Esempio n. 6
0
 def __init__(self, env, parent, radius=10):
     self.radius = radius
     kp=np.array([[-radius, 0], [radius, 0]])
     Device.__init__(self, env, parent, kp=kp, color=(0, 1, 0, 0.5), filled=True)
Esempio n. 7
0
 def __init__(self,*args,**kwargs):   
     Device.__init__(self,*args,**kwargs['dconfig'])
     self._position=0,0
     self._lastPosition=0,0
     self._display_index=None
Esempio n. 8
0
    def __init__(self, *args, **kwargs):
        """
        EyeTracker class. This class is to be extended by each eye tracker specific implemetation
        of the pyEyeTrackerInterface.

        Please review the documentation page for the specific eye tracker model that you are using the
        pyEyeTrackerInterface with to get the appropriate module path for that eye tracker; for example,
        if you are using an interface that supports eye trackers developed by EyeTrackingCompanyET, you
        may initialize the eye tracker object for that manufacturer something similar too :

           eyeTracker = hub.eyetrackers.EyeTrackingCompanyET.EyeTracker(**kwargs)

        where hub is the instance of the ioHubClient class that has been created for your experiment.

        **kwargs are an optional set of named parameters.

        **If an instance of EyeTracker has already been created, trying to create a second will raise an exception. Either destroy the first instance and then create the new instance, or use the class method EyeTracker.getInstance() to access the existing instance of the eye tracker object.**
        """
        if EyeTracker._INSTANCE is not None:
            raise ioHub.devices.ioDeviceError(
                self.__class__.__name__,
                "EyeTracker object has already been created; only one instance can exist. Delete existing instance before recreating EyeTracker object."
            )

        # >>>> eye tracker config
        EyeTracker.eyeTrackerConfig = kwargs['dconfig']
        #print " #### EyeTracker Configuration #### "
        #print self.eyeTrackerConfig
        #print ''
        # <<<<

        # create Device level class setting dictionary and pass it Device constructor
        deviceSettings = dict(
            instance_code=self.eyeTrackerConfig['instance_code'],
            category_id=ioHub.devices.EventConstants.
            DEVICE_CATERGORIES['EYE_TRACKER'],
            type_id=ioHub.devices.EventConstants.
            DEVICE_TYPES['EYE_TRACKER_DEVICE'],
            device_class=self.eyeTrackerConfig['device_class'],
            user_label=self.eyeTrackerConfig['name'],
            os_device_code='OS_DEV_CODE_NOT_SET',
            max_event_buffer_length=self.
            eyeTrackerConfig['event_buffer_length'])
        Device.__init__(self, **deviceSettings)

        # set this instance as 'THE' instance of the eye tracker.
        EyeTracker._INSTANCE = self

        EyeTracker.DEVICE_START_TIME = 0.0

        # >>>> eye tracker setting to config (if possible)
        #
        # Current settings, example from possible values.
        #
        # 'sampling_rate': 60.0,
        # 'vog_settings': {
        #                  'pupil_illumination': 'dark',
        #                  'pupil_center_algorithm': 'centroid',
        #                  'tracking_mode': 'pupil-cr'
        #                 }
        # 'default_calibration': '9P'
        # 'track_eyes': 'BINOC'
        # 'runtime_filtering': {
        #                       'ANY': 0
        #                      }
        runtimeSettings = self.eyeTrackerConfig['runtime_settings']

        #print ''
        #print " #### EyeTracker Runtime Settings #### "
        #print runtimeSettings
        #print ''
        # <<<<

        # >>>> Display / Calibration related information to use for config if possible
        #
        # Current settings, example from possible values.
        #
        EyeTracker.displaySettings = self.eyeTrackerConfig['display_settings']