Setting joystick axes motion as allowed response on joystick plugin
Hey y'all!
In my experiment, participants are to indicate if they have seen a stimulus by moving a joystick to the left or right. If a movement to the left stands for yes (or no) will be randomized.
I'm using the joystick plugin. If I get it right, I need to define both correct responses and allowed responses in order to receive information about accuracy and correctness of participant's answers in the data output.
My problem is that I don't know how to define x-axis movement as the allowed response in the joystick block.
I have used "joystick.get_joyinput(joybuttonlist=None, timeout=None)" to find out how the axis are handled. I got the following output: (u'joyaxismotion', [-3.0517578125e-05, -3.0517578125e-05, -3.0517578125e-05], 2203741). I know that the first three numbers stand for the x, y, and z axis and the last number for a time stamp.
I have tried to write "u'joyaxismotion' ", "joyaxismotion", "u'joyaxismotion[0]' ", and so on into the allowed response field and I always get the following error: "The variable (e.g.) 'joyaxesmotion' does not exist. Tip: Use the variable inspector (Ctrl+I) to see all variables". I get this error message even if I did create this variable.
Anyway, I'm having a tough time with this problem and I can't figure out how to solve it on my own. So I'd really appreciate it if you have some ideas and input how to handle it!
Love your work!
Comments
Hi,
I have literally no idea about Joysticks or that plugin, but the error you describe usually occurs if you forget the
[]
in Opensesame items (see here) . So maybe try something like:[joyaxismotion]
?Sorry for not being a better help here.
Eduard
Hi Eduard!
First and foremost - Thanks for your reply :-)
I've tried to put [ ] around the variables I used for the "allowed response" field in the joystick plugin. It didn't work...I begin to wonder if you can set joystick motions as allowed responses at all with the plugin?
Okay. Then I don't know myself. Maybe you can access the joystick in an
inline_script
? Similarly to how you can access for example keyboards. Then you can implement anif statement
that makes sure only a certain response is triggering the continuation of the script. Again, this is just guessing on my end. I don't know whether these variables are available and what they would look like.sorry,
Eduard
Hey!
In the end, I'm going to use the joystick plugin only to initialize the joystick. To get my problem fixed I now use:
running = True
I feel like it's a bit inconvenient and could definitely be more elegant. Also, I'm passing on accuracy outputs and reaction time information from the plug in...but hey, it works! I'm getting the joystick movement and if it was the correct movement for the stimulus occurrence.
I'm running in other difficulties now - I'll open another discussion for that though. Thanks a lot for your support Ed!