SR box problems with EyeLink
Hello,
I am currently running an experiment whereby I need to use a SR button box. There is no indication of the brand or model on the box itself; it is a single button box, that connects via USB to the computer. With the srbox plugin, things seem to work (responses are successfully collected). However:
1) I put the srbox plugin at the beginning of my experiment. For some reason, if I just click "run" the experiment, I get a blank display. I can manage to run successfully the experiment only if I click run, and then I immediately press the button of the button box. Only in this way the instructions and the task are shown. Why does this occur?
2) Participants are supposed to provide their response in a visual search by pressing the button box. During the visual search they have to keep fixation, that is, they have to select the stimulus by attending covertly to the display. I check that they are fixating properly while they are doing the visual search. The problem is that if I collect responses with the button box, the fixation check does not work - whereas when I collect the responses by means of normal keypresses on the keyboard, the fixation check works. I was wondering whether calling srbox.start() might somehow interfere with the eyetracker.sample() function. What could be the problem?
Many thanks in advance for your help!
Comments
Hi Sine,
These two problems might be related. Eyetracker and srbox should not interfere, obviously. It might be worthwhile to dig down the stack trace of sr box and check what things are done upon calling
srbox.start()
(either with the debugger, or modifying the source code + print statements). Perhaps, you can isolate the process that causes the interference. I don't have button box myself (and neither an eyetracker), so I can't really help you here. If you like, I can try to give you some guidance in trying to find the problem.Eduard
Hi @eduard ,
many thanks for your reply. So, I managed to solve the first problem (it was really a silly thing - to be able to access the device srbox from the inline Python script, you need to drag the srbox plugin at the beginning of the experiment, and I had forgotten to modify the Timeout from infinite to a finite number).
About my second question, I think you are right in saying that the problem might be linked to srbox.start(). I a while loop, where I wait for the button response and, while waiting, I check the fixation. It seems that the while loop does stop at the first iteration or simply there where I get srbox.get_button_press() - it does not even print core.getTime() a few lines below, which should set the timeout for the loop. Below you can see my loop. Perhaps there is something wrong with it and I cannot not see it (please, don't mind the ugliness of the code):
Many thanks for your help!
Ah, while copying the code I see that I wrote srbox.stop() both inside the loop and the other at the end of the function. I had actually written it only at the end of the function in the original code (and yet, it does not work)
Hi @ eduard, I realized what the problem was, and I am not sure there is an easy way out. The problem is that the function srbox.get_button_pressed() has a timeout argument. This means that it is not possible to get a timestamp value for the srbox and loop until a response is given. The function srbox.get_button_pressed() "freezes" the loop until a response is given, without allowing me to simultaneously check for the fixation.
Is there another version of the original function which does not have a timeout defined in it?
Hi,
Yes, exactly, that is indeed the problem. There is a solution, and it actually isn't very difficult. Basically the trick is to have a very small timeout set (a few milliseconds), so that the loop does not freeze, but keeps on running. Then, on every iteration the srbox checks whether a response was given, and process it whenever it happens. Would that work? (I use this procedure a lot with regular keyboard presses, so I am no 100% sure it works as well for the srbox)
Hi @eduard,
thanks! actually I had already tried this, but it means that the response can be given in an extremely narrow temporal window, and so it gets missed most of the times.
Since I need very high time precision (the effect I am looking for is of the order of 20ms), this would seriously impair my data collection :(
Ah okay, this might be an issue. WIth keyboard responses, keypresses are monitored and detected all the times and saved in a buffer that Opensesame can check periodically to find a response. That way, responses usually dont get lost, even if the resp window is only 2 ms or so. However, with the srbox, it seems like there is no such buffer, or the buffer is emptied every time a response is polled. I shall try to find that clearing (in case it happens) in the code tomorrow. If there simply is no buffer for keyboard presses, an alternative would be to monkey patch the sr polling function and add eyetracking functionality to it. I don't think this should be terribly complicated.
I'll try to have a look into it tomorrow. (but of course feel free to explore by yourself)
Eduard
Hi Sine,
Can you try to call the get_button_press function with the keyword
require_state_change
set toFalse
?That might work (if it doesn't break other things)