Command Decorators
Command decorators take the base command and add additonal functionalities to it.
withTimeout()
Adds a timeout to the command. When the timeout expires the command will be interrupted and end.
| // Add a 10 second timeout
new command.withTimeout(10);
|
| // Add a 10 second timeout
command.WithTimeout(10.0_s);
|
withInterrupt()
Adds a condition that will interrupt the command.
| new command.withInterrupt(isLimitHit());
|
| command.WithInterrupt([&limit]{return isLimitHit();});
|
andThen()
Adds a method that is executed after the command ends.
| new command.andThen(() -> System.out.println("Command Finished"));
|
| command.AndThen([] {std::cout<< "Command Finished";});
|
beforeStarting()
Adds a method that is executed before the command starts.
| new command.beforeStarting(() -> System.out.println("Command Starting"));
|
| command.BeforeStarting([] {std::cout<< "Command Starting"});
|