allow user to start and escape experiments with keyboard and vr controllers #288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes allow for some simple built-in functionality for using the oculus/quest VR controllers for kicking off experiments or exiting them early.
I've also changed the behavior of the keyboard for exiting an experiment, it now requires pressing the escape key instead of any key to exit. This helps to prevent accidental exits, but I can change it back if wanted(maybe it's going to make it harder for users to exit on purpose?).
The
__clear_user_input()
and__user_input()
methods are used internally by the BaseExperiment class for clearing the input buffer and detecting input respectively for both keyboard and vr controllers.The
get_vr_input()
andget_vr_input()
methods are used internally too, but can also be used by the child Experiment classes for simple VR input, either via a xbox or touch controller button and trigger.Any feedback on how to improve the code change will be appreciated, I've just aimed to get it working in the most basic way I could, it should hopefully give experiment writers a good starting point on how to use the controllers.