SigmundAI Copilot allows you to build and debug experiments with help from artificial intelligence. Install the Sigmund extension (public beta) and try it out now!
Joystick and gamepad
Joysticks and gamepads are supported through the joystick plugin.
instance joystick
If you insert the joystick plugin at the start of your experiment, a
joystick object automatically becomes part of the experiment object
and can be used within an inline_script item as joystick
.
flush()
Clears all pending input, not limited to the joystick.
Returns
- True if joyinput was pending (i.e., if there was something to flush) and False otherwise.
get_joyaxes(timeout=None)
Waits for joystick axes movement.
Parameters
- timeout: A timeout value in milliseconds or
None
to use default timeout.
Returns
- A
(position, timestamp)
tuple.position
isNone
if a timeout occurs. Otherwise,position
is an(x, y, z)
tuple.
get_joyballs(timeout=None)
Waits for joystick trackball movement.
Parameters
- timeout: A timeout value in milliseconds or
None
to use default timeout.
Returns
- A
(position, timestamp)
tuple. The position isNone
if a timeout occurs.
get_joybutton(joybuttonlist=None, timeout=None)
Collects joystick button input.
Parameters
- joybuttonlist: A list of buttons that are accepted or
None
to default joybuttonlist. - timeout: A timeout value in milliseconds or
None
to use default timeout.
Returns
- A (joybutton, timestamp) tuple. The joybutton is
None
if a timeout occurs.
get_joyhats(timeout=None)
Waits for joystick hat movement.
Parameters
- timeout: A timeout value in milliseconds or
None
to use default timeout.
Returns
- A
(position, timestamp)
tuple.position
isNone
if a timeout occurs. Otherwise,position
is an(x, y)
tuple.
get_joyinput(joybuttonlist=None, timeout=None)
Waits for any joystick input (buttons, axes, hats or balls).
Parameters
- joybuttonlist: A list of buttons that are accepted or
None
to default joybuttonlist. - timeout: A timeout value in milliseconds or
None
to use default timeout.
Returns
- A (event, value, timestamp) tuple. The value is
None
if a timeout occurs.event
is one ofNone
, 'joybuttonpress', 'joyballmotion', 'joyaxismotion', or 'joyhatmotion'
input_options()
Generates a list with the number of available buttons, axes, balls and hats.
Returns
- A list with number of inputs as: [buttons, axes, balls, hats].
set_joybuttonlist(joybuttonlist=None)
Sets a list of accepted buttons.
Parameters
- joybuttonlist: A list of buttons that are accepted or
None
to accept all buttons.
set_timeout(timeout=None)
Sets a timeout.
Parameters
- timeout: A timeout value in milliseconds or
None
for no timeout.