-
public class CommandSchedulerCommand scheduler.
The command scheduler registers all commands that need to be executed and ensures that they are executed accordingly with the command rules:
- A command can only be executing once. - A command only starts executing once its trigger conditions is evaluated to true. - A command runs periodically until it indicates its completion. - Multiple commands can be running at the same time.
Additionally:
- Persistent commands are repeatedly evaluated. - Ephemeral commands are only run once.
-
-
Constructor Summary
Constructors Constructor Description CommandScheduler(ILogger logger)Constructs a new instance of the command scheduler.
-
Method Summary
Modifier and Type Method Description voidrunPeriodically(Command command)Adds a recurring command to the scheduler. voidrunOnce(Command command)Adds a single run command to the scheduler. voidperiodic()Periodic execution of commands. -
-
Constructor Detail
-
CommandScheduler
CommandScheduler(ILogger logger)
Constructs a new instance of the command scheduler.
-
-
Method Detail
-
runPeriodically
void runPeriodically(Command command)
Adds a recurring command to the scheduler.
- Parameters:
command- a command which runs periodically as long as the trigger condition is true.
-
runOnce
void runOnce(Command command)
Adds a single run command to the scheduler.
- Parameters:
command- a command which runs only once once the trigger condition is true.
-
periodic
void periodic()
Periodic execution of commands.
This method needs to be called by the robot code on every loop.
-
-
-
-