|
WPILibC++
2020.3.2
|
A class used to bind command scheduling to events. More...
#include <Trigger.h>
Public Member Functions | |
| Trigger (std::function< bool()> isActive) | |
| Create a new trigger that is active when the given condition is true. More... | |
| Trigger () | |
| Create a new trigger that is never active (default constructor) - activity can be further determined by subclass code. | |
| Trigger (const Trigger &other) | |
| Trigger | WhenActive (Command *command, bool interruptible=true) |
| 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, bool interruptible=true) |
| 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, wpi::ArrayRef< Subsystem * > requirements={}) |
| Binds a runnable to execute when the trigger becomes active. More... | |
| Trigger | WhileActiveContinous (Command *command, bool interruptible=true) |
| Binds a command to be started repeatedly while the trigger is active, and cancelled 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, bool interruptible=true) |
| Binds a command to be started repeatedly while the trigger is active, and cancelled 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, wpi::ArrayRef< Subsystem * > requirements={}) |
| Binds a runnable to execute repeatedly while the trigger is active. More... | |
| Trigger | WhileActiveOnce (Command *command, bool interruptible=true) |
| Binds a command to be started when the trigger becomes active, and cancelled 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, bool interruptible=true) |
| Binds a command to be started when the trigger becomes active, and cancelled when it becomes inactive. More... | |
| Trigger | WhenInactive (Command *command, bool interruptible=true) |
| 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, bool interruptible=true) |
| 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, wpi::ArrayRef< Subsystem * > requirements={}) |
| Binds a runnable to execute when the trigger becomes inactive. More... | |
| Trigger | ToggleWhenActive (Command *command, bool interruptible=true) |
| Binds a command to start when the trigger becomes active, and be cancelled 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, bool interruptible=true) |
| Binds a command to start when the trigger becomes active, and be cancelled when it again becomes active. More... | |
| Trigger | CancelWhenActive (Command *command) |
| Binds a command to be cancelled when the trigger becomes active. More... | |
| Trigger | operator&& (Trigger rhs) |
| Composes two triggers with logical AND. More... | |
| Trigger | operator|| (Trigger rhs) |
| Composes two triggers with logical OR. More... | |
| Trigger | operator! () |
| Composes a trigger with logical NOT. More... | |
A class used to bind command scheduling to events.
The Trigger class is a base for all command-event-binding classes, and so the methods are named fairly abstractly; for purpose-specific wrappers, see Button.
|
inlineexplicit |
Create a new trigger that is active when the given condition is true.
| isActive | Whether the trigger is active. |
Binds a command to be cancelled when the trigger becomes active.
Takes a raw pointer, and so is non-owning; users are responsible for the lifespan and scheduling of the command.
| command | The command to bind. |
|
inline |
Composes a trigger with logical NOT.
Composes two triggers with logical AND.
Composes two triggers with logical OR.
Binds a command to start when the trigger becomes active, and be cancelled when it again becomes active.
Takes a raw pointer, and so is non-owning; users are responsible for the lifespan of the command.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
|
inline |
Binds a command to start when the trigger becomes active, and be cancelled when it again becomes active.
Transfers command ownership to the button scheduler, so the user does not have to worry about lifespan - rvalue refs will be moved, lvalue refs will be copied.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
Binds a command to start when the trigger becomes active.
Takes a raw pointer, and so is non-owning; users are responsible for the lifespan of the command.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
| Trigger frc2::Trigger::WhenActive | ( | std::function< void()> | toRun, |
| std::initializer_list< Subsystem * > | requirements | ||
| ) |
Binds a runnable to execute when the trigger becomes active.
| toRun | the runnable to execute. @paaram requirements the required subsystems. |
| Trigger frc2::Trigger::WhenActive | ( | std::function< void()> | toRun, |
| wpi::ArrayRef< Subsystem * > | requirements = {} |
||
| ) |
Binds a runnable to execute when the trigger becomes active.
| toRun | the runnable to execute. @paaram requirements the required subsystems. |
|
inline |
Binds a command to start when the trigger becomes active.
Transfers command ownership to the button scheduler, so the user does not have to worry about lifespan - rvalue refs will be moved, lvalue refs will be copied.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
Binds a command to start when the trigger becomes inactive.
Takes a raw pointer, and so is non-owning; users are responsible for the lifespan of the command.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
| Trigger frc2::Trigger::WhenInactive | ( | std::function< void()> | toRun, |
| std::initializer_list< Subsystem * > | requirements | ||
| ) |
Binds a runnable to execute when the trigger becomes inactive.
| toRun | the runnable to execute. |
| requirements | the required subsystems. |
| Trigger frc2::Trigger::WhenInactive | ( | std::function< void()> | toRun, |
| wpi::ArrayRef< Subsystem * > | requirements = {} |
||
| ) |
Binds a runnable to execute when the trigger becomes inactive.
| toRun | the runnable to execute. |
| requirements | the required subsystems. |
|
inline |
Binds a command to start when the trigger becomes inactive.
Transfers command ownership to the button scheduler, so the user does not have to worry about lifespan - rvalue refs will be moved, lvalue refs will be copied.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
Binds a command to be started repeatedly while the trigger is active, and cancelled when it becomes inactive.
Takes a raw pointer, and so is non-owning; users are responsible for the lifespan of the command.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
| Trigger frc2::Trigger::WhileActiveContinous | ( | std::function< void()> | toRun, |
| std::initializer_list< Subsystem * > | requirements | ||
| ) |
Binds a runnable to execute repeatedly while the trigger is active.
| toRun | the runnable to execute. |
| requirements | the required subsystems. |
| Trigger frc2::Trigger::WhileActiveContinous | ( | std::function< void()> | toRun, |
| wpi::ArrayRef< Subsystem * > | requirements = {} |
||
| ) |
Binds a runnable to execute repeatedly while the trigger is active.
| toRun | the runnable to execute. |
| requirements | the required subsystems. |
|
inline |
Binds a command to be started repeatedly while the trigger is active, and cancelled when it becomes inactive.
Transfers command ownership to the button scheduler, so the user does not have to worry about lifespan - rvalue refs will be moved, lvalue refs will be copied.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
Binds a command to be started when the trigger becomes active, and cancelled when it becomes inactive.
Takes a raw pointer, and so is non-owning; users are responsible for the lifespan of the command.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |
|
inline |
Binds a command to be started when the trigger becomes active, and cancelled when it becomes inactive.
Transfers command ownership to the button scheduler, so the user does not have to worry about lifespan - rvalue refs will be moved, lvalue refs will be copied.
| command | The command to bind. |
| interruptible | Whether the command should be interruptible. |