Package com.cdarobotics.cdalib.tasks
Class TaskMaster
java.lang.Object
com.cdarobotics.cdalib.tasks.TaskMaster
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
ConstructorsConstructorDescriptionCreates a task master that starts idle.TaskMaster(Task task) Creates a task master that begins by running the given task. -
Method Summary
-
Constructor Details
-
TaskMaster
public TaskMaster()Creates a task master that starts idle. -
TaskMaster
Creates a task master that begins by running the given task.
-
-
Method Details
-
addTask
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 (aNullTask) 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
- Returns:
- the currently active task (
NullTaskwhen idle).
-