Button¶
- class commands1.buttons.Button¶
Bases:
commands1._impl._commands_v1.button.Trigger
This class provides an easy way to link commands to OI inputs.
It is very easy to link a button to a command. For instance, you could link the trigger button of a joystick to a “score” command.
This class represents a subclass of Trigger that is specifically aimed at buttons on an operator interface as a common use case of the more generalized Trigger objects. This is a simple wrapper around Trigger with the method names renamed to fit the Button object use.
This class is provided by the OldCommands VendorDep
- cancelWhenPressed(command: commands1._impl._commands_v1.command.Command) → None¶
Cancels the specificed command when the button is pressed.
- Parameters
command – The command to be canceled
- toggleWhenPressed(command: commands1._impl._commands_v1.command.Command) → None¶
Toggle the specified command when the button is pressed.
- Parameters
command – The command to be toggled
- whenPressed(command: commands1._impl._commands_v1.command.Command) → None¶
Specifies the command to run when a button is first pressed.
- Parameters
command – The pointer to the command to run
- whenReleased(command: commands1._impl._commands_v1.command.Command) → None¶
Specifies the command to run when the button is released.
The command will be scheduled a single time.
- Parameters
command – The pointer to the command to run
- whileHeld(command: commands1._impl._commands_v1.command.Command) → None¶
Specifies the command to be scheduled while the button is pressed.
The command will be scheduled repeatedly while the button is pressed and will be canceled when the button is released.
- Parameters
command – The pointer to the command to run