Gamepad issue
Hi,
I'm currently trying to use a Logitech Gamepad (USB) in order to collect reaction times for a simple lexical decision task.
I tried to use the joystick plugin implemented in opensesame. Unfortunately, it seems that the plugin crashes the software at the beginning of the experiment, without any specific error message (cf. 1finished.png), like if the experiment was performed normally. Here is some screenshots of my issue + what i'm trying to do.
Have you an alternative and simple way just to collect button press and reaction time using joystick/gamepad? Maybe a simple script.
In fact, I just want that the "Hello. Keypress, please..." disapear as soon as the button is pressed.
I know that there is many threads, but I don't program in python at all. Hence, the documentation available on the website ( http://osdoc.cogsci.nl/3.1/manual/response/joystick/ ) wasn't helpfull for me.
I'm sorry for this beginner issue.
I tried to use this script instead of the joystick module (entirely inspired from this topic: http://forum.cogsci.nl/index.php?p=/discussion/59/solved-gamepad-or-joystick-as-input-device/p1 ):
import pygame
from pygame.locals import *
pygame.init()
gamepad = pygame.joystick.Joystick(0)
gamepad.init()
joystick_count=pygame.joystick.get_count()
button = None
while button == None:
for event in pygame.event.get():
if event.type == JOYBUTTONDOWN:
button = event.button
Unfortunately, opensesame stop directly after the first cycle, with no error message
Thank you,
Benjamin
Comments
Hi Benjamin,
It looks like a hard crash occurs when you try to initialize the joystick, both when using the plugin and when doing this through a script. This kind of crash is usually the result from a problem in the underlying libraries, Pygame in this case. OpenSesame cannot distinguish between this kind of hard crash (which doesn't give a Python error because Python itself crashes) and no crash at all, which is why it looks like the experiment finished succesfully--even though it clearly didn't.
There is, unfortunately, very little that you can do about this kind of crash. Your best bet is probably to try a version of OpenSesame (like 3.1.2) that comes with a different version of Python and Pygame, and hope that the crash goes away.
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Installing the 3.1.2 version totally fixed this issue... Thank you very much, and sorry for the spam, I should have checked for update in the first place before asking for help
Cool new interface by the way.