Package 

Class CommandScheduler


  • 
    public class CommandScheduler
    
                        

    Command 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.

    • Method Summary

      Modifier and Type Method Description
      void runPeriodically(Command command) Adds a recurring command to the scheduler.
      void runOnce(Command command) Adds a single run command to the scheduler.
      void runOnce(Function<DynamicCommandBuilder, DynamicCommand> dynamicBuilder) Adds a single run dynamic command to the scheduler.
      void periodic() Periodic execution of commands.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandScheduler

        CommandScheduler(ITelemetryLogger 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.
      • runOnce

         void runOnce(Function<DynamicCommandBuilder, DynamicCommand> dynamicBuilder)

        Adds a single run dynamic command to the scheduler.

        Parameters:
        dynamicBuilder - 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.