MS XBox 360 Controller and OpenSesame 27.1
Hello,
this is mainly just a report and more like a personal note by myself which may be useful for others.
From OpenSesame 27.1 onwards the Joystick-Plugin is included by default and as far as I have tested it in our lab (Win 7 Pro 64bit) it works with the MS XBox 360-USB controller (with the official XBox 360 driver installed, not just the generic Win 7 driver).
We tested all buttons and could figure out what is working and what does not work (yet) and which button matches which number to fill in as response in the joystick item of OpenSesame. As this is quite tedious, I want to document it here (in case somebody else uses the same controller or I need to look it up again ;-))
So here is the result:
Diagram from wikimedia commons, CC BY-SA 3.0 by alphatron
Button: Number in OpenSesame (tested with expyriment backend)
Face Button A (green): 1
Face Button B (red): 2
Face Button X (blue): 3
Face Button Y (yellow): 4
Left Bumper: 5
Right Bumper: 6
Trigger Left: not functional
Trigger Right: not functional
D-Pad: not functional
Start: 8
Back: 7
Left Stick: 9 (click only, axes not functional)
Right Stick: 10 (click only, axes not functional)
As I have not used the joystick plugin so far, I do not know if axes really receive a number or one has to write something like "up;down" in the response field. If somebody knows more about this or finds it out please post a comment.
Also, I did not manage to get a python inline script running, obviously, something is missing in the documentation (which module do I need to import?). This could be helpful to test more quickly what numeric codes are available. If somebody has a working example at hand and is willing to share this, wow, that would be great.
Cheers,
Johannes
Comments
Hi Johannes,
Nice to see someone is using that plugin and figuring out what to do with it!
The joystick plugin uses PyGame to communicate with joysticks and controllers. There are custom Python functions, useable in inline_script, defined in libjoystick.py. With these functions, you can use the axes, hats and balls (get_joyballs: best function name I've ever written). So it is possible to create an inline_script to use the axes.
The joystick item, however, simply checks for buttonpresses. Axis, hat and ball movement is not read out (mostly because I found it difficult to determine what should be returned: a movement direction, movement speed, axis state etc?). Therefore, using the joystick item within OpenSesame will never allow you to use any other input than buttonpresses.
If you (or anybody else) have some ideas on aforementioned problem with returnvalues, than please do let me know!
Cheers!
Edwin
P.S. I have some working inline_code at home. Will post it when I get there (probably sometime this weekend)
It just dawned on me that I have an example online already (d'oh!). See here: https://github.com/esdalmaijer/joystick/blob/master/joystick/joystick_demonstration.opensesame
You'll be glad to hear that your plug-in is also being used by a PhD student here in Marseille. She takes a laptop + gamepad to schools to test kids on-site. It works really well.
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Johannes,
If you want to test out things further, use the following code in an inline_script (be sure to add a joystick item sometime before you use the inline_script):
It displays any new input you give: type and input value (example: "joybuttonpress" and "4", or "joyaxismotion" and "[0 0 -1]" if you have three axes).
Good luck with the testing!