Class TaskMaster

java.lang.Object
com.cdarobotics.cdalib.tasks.TaskMaster

public class TaskMaster extends Object
Drives a single active Task to completion, one loop at a time. Call addTask(Task) to queue work and update() every loop; when idle it holds a NullTask.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a task master that starts idle.
    Creates a task master that begins by running the given task.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTask(Task task)
    Queues a task: if idle it starts immediately, otherwise it runs after the current task finishes.
    boolean
     
     
    void
    Advances the active task by one step, initializing it on the first call and returning to idle (a NullTask) once it finishes.

    Methods inherited from class java.lang.Object

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

    • TaskMaster

      public TaskMaster()
      Creates a task master that starts idle.
    • TaskMaster

      public TaskMaster(Task task)
      Creates a task master that begins by running the given task.
  • Method Details

    • addTask

      public void addTask(Task task)
      Queues a task: if idle it starts immediately, otherwise it runs after the current task finishes.
    • update

      public void update()
      Advances the active task by one step, initializing it on the first call and returning to idle (a NullTask) once it finishes. Call once per loop.
    • getStatus

      public boolean getStatus()
      Returns:
      the result of the most recent update() — whether the active task finished.
    • getTask

      public Task getTask()
      Returns:
      the currently active task (NullTask when idle).