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.

1
2
// Add a 10 second timeout
new command.withTimeout(10);
1
2
// Add a 10 second timeout
command.WithTimeout(10.0_s);

withInterrupt()

Adds a condition that will interrupt the command.

1
new command.withInterrupt(isLimitHit());
1
command.WithInterrupt([&limit]{return isLimitHit();});

andThen()

Adds a method that is executed after the command ends.

1
new command.andThen(() -> System.out.println("Command Finished"));
1
command.AndThen([] {std::cout<< "Command Finished";});

beforeStarting()

Adds a method that is executed before the command starts.

1
new command.beforeStarting(() -> System.out.println("Command Starting"));
1
command.BeforeStarting([] {std::cout<< "Command Starting"});