RobotCore
Robot Core Documentation
|
Public Member Functions | |
Button () | |
Button (BooleanSupplier isPressed) | |
Button | whenPressed (final Command command, boolean interruptible) |
Button | whenPressed (final Command command) |
Button | whenPressed (final Runnable toRun, Subsystem... requirements) |
Button | whileHeld (final Command command, boolean interruptible) |
Button | whileHeld (final Command command) |
Button | whileHeld (final Runnable toRun, Subsystem... requirements) |
Button | whenHeld (final Command command, boolean interruptible) |
Button | whenHeld (final Command command) |
Button | whenReleased (final Command command, boolean interruptible) |
Button | whenReleased (final Command command) |
Button | whenReleased (final Runnable toRun, Subsystem... requirements) |
Button | toggleWhenPressed (final Command command, boolean interruptible) |
Button | toggleWhenPressed (final Command command) |
Button | cancelWhenPressed (final Command command) |
Public Member Functions inherited from edu.wpi.first.wpilibj2.command.button.Trigger | |
Trigger (BooleanSupplier isActive) | |
Trigger () | |
boolean | get () |
Trigger | whenActive (final Command command, boolean interruptible) |
Trigger | whenActive (final Command command) |
Trigger | whenActive (final Runnable toRun, Subsystem... requirements) |
Trigger | whileActiveContinuous (final Command command, boolean interruptible) |
Trigger | whileActiveContinuous (final Command command) |
Trigger | whileActiveContinuous (final Runnable toRun, Subsystem... requirements) |
Trigger | whileActiveOnce (final Command command, boolean interruptible) |
Trigger | whileActiveOnce (final Command command) |
Trigger | whenInactive (final Command command, boolean interruptible) |
Trigger | whenInactive (final Command command) |
Trigger | whenInactive (final Runnable toRun, Subsystem... requirements) |
Trigger | toggleWhenActive (final Command command, boolean interruptible) |
Trigger | toggleWhenActive (final Command command) |
Trigger | cancelWhenActive (final Command command) |
Trigger | and (Trigger trigger) |
Trigger | or (Trigger trigger) |
Trigger | negate () |
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.
edu.wpi.first.wpilibj2.command.button.Button.Button | ( | ) |
Default constructor; creates a button that is never pressed (unless Button#get() is overridden).
edu.wpi.first.wpilibj2.command.button.Button.Button | ( | BooleanSupplier | isPressed | ) |
Creates a new button with the given condition determining whether it is pressed.
isPressed | returns whether or not the trigger should be active |
Cancels the command when the button is pressed.
command | the command to start |
Toggles the command whenever the button is pressed (on then off then on). The command is set to be interruptible.
command | the command to start |
Button edu.wpi.first.wpilibj2.command.button.Button.toggleWhenPressed | ( | final Command | command, |
boolean | interruptible | ||
) |
Toggles the command whenever the button is pressed (on then off then on).
command | the command to start |
interruptible | whether the command is interruptible |
Starts the given command when the button is first pressed, and cancels it when it is released, but does not start it again if it ends or is otherwise interrupted. The command is set to be interruptible.
command | the command to start |
Button edu.wpi.first.wpilibj2.command.button.Button.whenHeld | ( | final Command | command, |
boolean | interruptible | ||
) |
Starts the given command when the button is first pressed, and cancels it when it is released, but does not start it again if it ends or is otherwise interrupted.
command | the command to start |
interruptible | whether the command is interruptible |
Starts the given command whenever the button is newly pressed. The command is set to be interruptible.
command | the command to start |
Button edu.wpi.first.wpilibj2.command.button.Button.whenPressed | ( | final Command | command, |
boolean | interruptible | ||
) |
Starts the given command whenever the button is newly pressed.
command | the command to start |
interruptible | whether the command is interruptible |
Button edu.wpi.first.wpilibj2.command.button.Button.whenPressed | ( | final Runnable | toRun, |
Subsystem... | requirements | ||
) |
Runs the given runnable whenever the button is newly pressed.
toRun | the runnable to run |
requirements | the required subsystems |
Starts the command when the button is released. The command is set to be interruptible.
command | the command to start |
Button edu.wpi.first.wpilibj2.command.button.Button.whenReleased | ( | final Command | command, |
boolean | interruptible | ||
) |
Starts the command when the button is released.
command | the command to start |
interruptible | whether the command is interruptible |
Button edu.wpi.first.wpilibj2.command.button.Button.whenReleased | ( | final Runnable | toRun, |
Subsystem... | requirements | ||
) |
Runs the given runnable when the button is released.
toRun | the runnable to run |
requirements | the required subsystems |
Constantly starts the given command while the button is held.
Command#schedule(boolean) will be called repeatedly while the button is held, and will be canceled when the button is released. The command is set to be interruptible.
command | the command to start |
Button edu.wpi.first.wpilibj2.command.button.Button.whileHeld | ( | final Command | command, |
boolean | interruptible | ||
) |
Constantly starts the given command while the button is held.
Command#schedule(boolean) will be called repeatedly while the button is held, and will be canceled when the button is released.
command | the command to start |
interruptible | whether the command is interruptible |
Button edu.wpi.first.wpilibj2.command.button.Button.whileHeld | ( | final Runnable | toRun, |
Subsystem... | requirements | ||
) |
Constantly runs the given runnable while the button is held.
toRun | the runnable to run |
requirements | the required subsystems |