THE PROBLEM IS MY CODE FOR THE TASK NOT ACTUALLY IOHUB-EYETRACKING!
Hello,
I am trying to set up the eyetracker using the ioHub and psychopy. Everything was working apparently last week but today stopped and I am getting a weird message
I am using simple example code to make it work first and then I can apply to my experiment:
from __future__ import print_function
from psychopy import visual, core, event, monitors
from psychopy.iohub.client import launchHubServer
iohub_tracker_class_path = 'eyetracker.hw.sr_research.eyelink.EyeTracker'
eyetracker_config = dict()
eyetracker_config['name'] = 'tracker'
#eyetracker_config['default_native_data_file_name'] = 'elisatest_data'
eyetracker_config['model_name'] = 'EYELINK 1000 DESKTOP'
#eyetracker_config['simulation_mode'] = True
eyetracker_config['runtime_settings'] = dict(sampling_rate=1000,
track_eyes='RIGHT_EYE')
# Since no experiment or session code is given, no iohub hdf5 file
# will be saved, but device events are still available at runtime.
io = launchHubServer(**{iohub_tracker_class_path: eyetracker_config})
# Get some iohub devices for future access.
keyboard = io.devices.keyboard
display = io.devices.display
tracker = io.devices.tracker
# run eyetracker calibration
r = tracker.runSetupProcedure()
meuMonitor = monitors.Monitor('testMonitor')
win = visual.Window(meuMonitor.getSizePix(), monitor=meuMonitor,units='deg',fullscr=True,color=(-1, -1, -1))
mouse = event.Mouse(visible=False, win=win)
fixpoint = visual.Circle(win, fillColor=(1, 1, 1), units='deg', radius=0.1, pos=(0, 0))
# Cria o pixel no canto esquerdo da tela para quando o estimulo aparecer (pista,ancora,alvo)
#picel = visual.ImageStim(win, units='pix', size=10,pos=(-1279,719), color='#800000')
grat1 = visual.GratingStim(win, tex='sqr', units='deg', pos=(11.5, -3.5), size=5,
sf=(1/0.53,0), phase = 0.50, color=(1.0, 1.0, 1.0), contrast=1.0, opacity=1.0)
grat2 = visual.GratingStim(win, tex='sqr', units='deg', pos=(-11.5, -3.5), size=5,
sf=(1/0.59,0), phase = 1, color=(1.0, 1.0, 1.0), contrast=1.0, opacity=1.0)
grat3 = visual.GratingStim(win, tex='sqr', units='deg', pos=(11.5, -3.5), size=5,
sf=(1/0.50,0), phase = 1, color=(1.0, 1.0, 1.0), contrast=1.0, opacity=0.5, ori=90)
CueR = visual.Rect(win, fillColor=(1,1,1),width=1, height=1, pos=(0, 1)) #cue to indicate right
CueL = visual.Polygon(win, edges=3, radius=0.5, fillColor=(1,1,1), pos=(0, 1)) #cue to indicate left
CueCh = visual.Circle(win, fillColor=(1, 1, 1), radius=0.5, pos=(0, 1)) #cue to indicate choice
alvoDict = {
'1': grat1,
'2': grat2,
'3': grat3,
'4': CueCh,
'5': CueL,
'6': CueR
}
TRIALS = 2
t = 0
frameN = 0
press = False
while frameN <=250 and not press and t<TRIALS:
io.clearEvents()
tracker.setRecordingState(True)
#for frameN in range(250):#for exactly 200 frames
if 5<=frameN<250:#present fixation for a subset of frames
fixpoint.draw()
#picel.draw()
if frameN == 50 or frameN == 150:
mouse.clickReset()
tracker.sendMessage('StimON', time_offset=None)
if 50<=frameN<100:#present stim for a different subset
alvoDict['4'].draw()
#if 80<=frameN<100 or 280<=frameN<300:
#alvoDict['6'].draw()
botoes,tresp1 = mouse.getPressed(getTime = True)
if botoes != [0, 0, 0]:
press = True
#print(tresp1)
if 150<=frameN<200:#present stim for a different subset
#print (tracker.getLastGazePosition())
alvoDict['2'].draw()
botoes,tresp2 = mouse.getPressed(getTime = True)
if botoes != [0, 0, 0]:
press = True
#print(tresp2[0])
win.flip()#flip the screen every frame
frameN+=1
tracker.setRecordingState(False)
t+=1
win.close()
tracker.setConnectionState(False)
io.quit()
core.quit()
And I am getting this message:
EYELINK Error during _setEyesToTrack:
<type âexceptions.RuntimeErrorâ>
RuntimeError(âNot available in EyeLink CL mode.â,)
[â File âC:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.
01-py2.7.egg\psychopy\iohub\devices\eyetracker\hw\sr_research\eyelink\ey
etracker.pyâ, line 1185, in _setEyesToTrack\n self._eyelink.sendCommand(âcurr
ent_camera = %sâ%(track_eyes))\nâ]
ioHub Server Process Completed With Code: 0