mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Add until() as alias for withInterrupt() (#3981)
This is a clearer description for the functionality. Will deprecate withInterrupt next year.
This commit is contained in:
@@ -111,6 +111,17 @@ class Command {
|
||||
*/
|
||||
virtual ParallelRaceGroup WithTimeout(units::second_t duration) &&;
|
||||
|
||||
/**
|
||||
* Decorates this command with an interrupt condition. If the specified
|
||||
* condition becomes true before the command finishes normally, the command
|
||||
* will be interrupted and un-scheduled. Note that this only applies to the
|
||||
* command returned by this method; the calling command is not itself changed.
|
||||
*
|
||||
* @param condition the interrupt condition
|
||||
* @return the command with the interrupt condition added
|
||||
*/
|
||||
virtual ParallelRaceGroup Until(std::function<bool()> condition) &&;
|
||||
|
||||
/**
|
||||
* Decorates this command with an interrupt condition. If the specified
|
||||
* condition becomes true before the command finishes normally, the command
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace frc2 {
|
||||
/**
|
||||
* A command that starts a notifier to run the given runnable periodically in a
|
||||
* separate thread. Has no end condition as-is; either subclass it or use
|
||||
* Command::WithTimeout(double) or Command::WithInterrupt(BooleanSupplier) to
|
||||
* Command::WithTimeout(double) or Command::Until(BooleanSupplier) to
|
||||
* give it one.
|
||||
*
|
||||
* <p>WARNING: Do not use this class unless you are confident in your ability to
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace frc2 {
|
||||
/**
|
||||
* A command that runs a Runnable continuously. Has no end condition as-is;
|
||||
* either subclass it or use Command.WithTimeout() or
|
||||
* Command.WithInterrupt() to give it one. If you only wish
|
||||
* Command.Until() to give it one. If you only wish
|
||||
* to execute a Runnable once, use InstantCommand.
|
||||
*
|
||||
* This class is provided by the NewCommands VendorDep
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace frc2 {
|
||||
* A command that runs a given runnable when it is initialized, and another
|
||||
* runnable when it ends. Useful for running and then stopping a motor, or
|
||||
* extending and then retracting a solenoid. Has no end condition as-is; either
|
||||
* subclass it or use Command.WithTimeout() or Command.WithInterrupt() to give
|
||||
* subclass it or use Command.WithTimeout() or Command.Until() to give
|
||||
* it one.
|
||||
*
|
||||
* This class is provided by the NewCommands VendorDep
|
||||
|
||||
Reference in New Issue
Block a user