WPILibC++ 2023.4.3
frc2::JoystickButton Class Reference

A class used to bind command scheduling to joystick button presses. More...

#include <frc2/command/button/JoystickButton.h>

Inheritance diagram for frc2::JoystickButton:

## Public Member Functions

WPI_IGNORE_DEPRECATED JoystickButton (frc::GenericHID *joystick, int buttonNumber)
Creates a JoystickButton that commands can be bound to. More...

Public Member Functions inherited from frc2::Trigger
Trigger (std::function< bool()> condition)
Creates a new trigger based on the given condition. More...

Trigger (frc::EventLoop *loop, std::function< bool()> condition)
Creates a new trigger based on the given condition. More...

Trigger ()
Create a new trigger that is always false. More...

Trigger (const Trigger &other)

Trigger OnTrue (Command *command)
Starts the given command whenever the condition changes from false to true. More...

Trigger OnTrue (CommandPtr &&command)
Starts the given command whenever the condition changes from false to true. More...

Trigger OnFalse (Command *command)
Starts the given command whenever the condition changes from true to false. More...

Trigger OnFalse (CommandPtr &&command)
Starts the given command whenever the condition changes from true to false. More...

Trigger WhileTrue (Command *command)
Starts the given command when the condition changes to true and cancels it when the condition changes to false. More...

Trigger WhileTrue (CommandPtr &&command)
Starts the given command when the condition changes to true and cancels it when the condition changes to false. More...

Trigger WhileFalse (Command *command)
Starts the given command when the condition changes to false and cancels it when the condition changes to true. More...

Trigger WhileFalse (CommandPtr &&command)
Starts the given command when the condition changes to false and cancels it when the condition changes to true. More...

Trigger ToggleOnTrue (Command *command)
Toggles a command when the condition changes from false to true. More...

Trigger ToggleOnTrue (CommandPtr &&command)
Toggles a command when the condition changes from false to true. More...

Trigger ToggleOnFalse (Command *command)
Toggles a command when the condition changes from true to the low state. More...

Trigger ToggleOnFalse (CommandPtr &&command)
Toggles a command when the condition changes from true to false. More...

Trigger WhenActive (Command *command)
Binds a command to start when the trigger becomes active. More...

template<class T , typename = std::enable_if_t<std::is_base_of_v< Command, std::remove_reference_t<T>>>>
Trigger WhenActive (T &&command)
Binds a command to start when the trigger becomes active. More...

Trigger WhenActive (std::function< void()> toRun, std::initializer_list< Subsystem * > requirements)
Binds a runnable to execute when the trigger becomes active. More...

Trigger WhenActive (std::function< void()> toRun, std::span< Subsystem *const > requirements={})
Binds a runnable to execute when the trigger becomes active. More...

Trigger WhileActiveContinous (Command *command)
Binds a command to be started repeatedly while the trigger is active, and canceled when it becomes inactive. More...

template<class T , typename = std::enable_if_t<std::is_base_of_v< Command, std::remove_reference_t<T>>>>
Trigger WhileActiveContinous (T &&command)
Binds a command to be started repeatedly while the trigger is active, and canceled when it becomes inactive. More...

Trigger WhileActiveContinous (std::function< void()> toRun, std::initializer_list< Subsystem * > requirements)
Binds a runnable to execute repeatedly while the trigger is active. More...

Trigger WhileActiveContinous (std::function< void()> toRun, std::span< Subsystem *const > requirements={})
Binds a runnable to execute repeatedly while the trigger is active. More...

Trigger WhileActiveOnce (Command *command)
Binds a command to be started when the trigger becomes active, and canceled when it becomes inactive. More...

template<class T , typename = std::enable_if_t<std::is_base_of_v< Command, std::remove_reference_t<T>>>>
Trigger WhileActiveOnce (T &&command)
Binds a command to be started when the trigger becomes active, and canceled when it becomes inactive. More...

Trigger WhenInactive (Command *command)
Binds a command to start when the trigger becomes inactive. More...

template<class T , typename = std::enable_if_t<std::is_base_of_v< Command, std::remove_reference_t<T>>>>
Trigger WhenInactive (T &&command)
Binds a command to start when the trigger becomes inactive. More...

Trigger WhenInactive (std::function< void()> toRun, std::initializer_list< Subsystem * > requirements)
Binds a runnable to execute when the trigger becomes inactive. More...

Trigger WhenInactive (std::function< void()> toRun, std::span< Subsystem *const > requirements={})
Binds a runnable to execute when the trigger becomes inactive. More...

Trigger ToggleWhenActive (Command *command)
Binds a command to start when the trigger becomes active, and be canceled when it again becomes active. More...

template<class T , typename = std::enable_if_t<std::is_base_of_v< Command, std::remove_reference_t<T>>>>
Trigger ToggleWhenActive (T &&command)
Binds a command to start when the trigger becomes active, and be canceled when it again becomes active. More...

Trigger CancelWhenActive (Command *command)
Binds a command to be canceled when the trigger becomes active. More...

Trigger operator&& (std::function< bool()> rhs)
Composes two triggers with logical AND. More...

Trigger operator&& (Trigger rhs)
Composes two triggers with logical AND. More...

Trigger operator|| (std::function< bool()> rhs)
Composes two triggers with logical OR. More...

Trigger operator|| (Trigger rhs)
Composes two triggers with logical OR. More...

Trigger operator! ()
Composes a trigger with logical NOT. More...

Trigger Debounce (units::second_t debounceTime, frc::Debouncer::DebounceType type=frc::Debouncer::DebounceType::kRising)
Creates a new debounced trigger from this trigger - it will become active when this trigger has been active for longer than the specified period. More...

## Detailed Description

A class used to bind command scheduling to joystick button presses.

Can be composed with other buttons with the operators in Trigger.

This class is provided by the NewCommands VendorDep

Trigger

## ◆ JoystickButton()

 WPI_IGNORE_DEPRECATED frc2::JoystickButton::JoystickButton ( frc::GenericHID * joystick, int buttonNumber )
inlineexplicit

Creates a JoystickButton that commands can be bound to.

Parameters
 joystick The joystick on which the button is located. buttonNumber The number of the button on the joystick.

The documentation for this class was generated from the following file: