mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Add requirements param to more Command APIs (#2059)
Assorted improvements to the ergonomics of declaring requirements in the new command framework. C++ requirements list parameters have been defaulted to an empty list, some missing C++ requirements list parameters have been added, and both C++ and Java have been given requirements list params in various InstantCommand wrapper methods (#2049), whose value is forwarded to the command.
This commit is contained in:
@@ -65,8 +65,10 @@ class Button : public Trigger {
|
||||
* Binds a runnable to execute when the button is pressed.
|
||||
*
|
||||
* @param toRun the runnable to execute.
|
||||
* @param requirements the required subsystems.
|
||||
*/
|
||||
Button WhenPressed(std::function<void()> toRun);
|
||||
Button WhenPressed(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements = {});
|
||||
|
||||
/**
|
||||
* Binds a command to be started repeatedly while the button is pressed, and
|
||||
@@ -100,8 +102,10 @@ class Button : public Trigger {
|
||||
* Binds a runnable to execute repeatedly while the button is pressed.
|
||||
*
|
||||
* @param toRun the runnable to execute.
|
||||
* @param requirements the required subsystems.
|
||||
*/
|
||||
Button WhileHeld(std::function<void()> toRun);
|
||||
Button WhileHeld(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements = {});
|
||||
|
||||
/**
|
||||
* Binds a command to be started when the button is pressed, and cancelled
|
||||
@@ -163,8 +167,10 @@ class Button : public Trigger {
|
||||
* Binds a runnable to execute when the button is released.
|
||||
*
|
||||
* @param toRun the runnable to execute.
|
||||
* @param requirements the required subsystems.
|
||||
*/
|
||||
Button WhenReleased(std::function<void()> toRun);
|
||||
Button WhenReleased(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements = {});
|
||||
|
||||
/**
|
||||
* Binds a command to start when the button is pressed, and be cancelled when
|
||||
|
||||
@@ -96,8 +96,10 @@ class Trigger {
|
||||
* Binds a runnable to execute when the trigger becomes active.
|
||||
*
|
||||
* @param toRun the runnable to execute.
|
||||
* @paaram requirements the required subsystems.
|
||||
*/
|
||||
Trigger WhenActive(std::function<void()> toRun);
|
||||
Trigger WhenActive(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements = {});
|
||||
|
||||
/**
|
||||
* Binds a command to be started repeatedly while the trigger is active, and
|
||||
@@ -145,8 +147,10 @@ class Trigger {
|
||||
* Binds a runnable to execute repeatedly while the trigger is active.
|
||||
*
|
||||
* @param toRun the runnable to execute.
|
||||
* @param requirements the required subsystems.
|
||||
*/
|
||||
Trigger WhileActiveContinous(std::function<void()> toRun);
|
||||
Trigger WhileActiveContinous(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements = {});
|
||||
|
||||
/**
|
||||
* Binds a command to be started when the trigger becomes active, and
|
||||
@@ -234,8 +238,10 @@ class Trigger {
|
||||
* Binds a runnable to execute when the trigger becomes inactive.
|
||||
*
|
||||
* @param toRun the runnable to execute.
|
||||
* @param requirements the required subsystems.
|
||||
*/
|
||||
Trigger WhenInactive(std::function<void()> toRun);
|
||||
Trigger WhenInactive(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements = {});
|
||||
|
||||
/**
|
||||
* Binds a command to start when the trigger becomes active, and be cancelled
|
||||
|
||||
Reference in New Issue
Block a user