Package com.cdarobotics.cdalib.tasks
Class RepeatTask
java.lang.Object
com.cdarobotics.cdalib.tasks.Task
com.cdarobotics.cdalib.tasks.RepeatTask
Repeatedly runs a freshly built task: each time the current task finishes, a new one is built from
the supplier and started immediately.
Warning: this task has no termination condition of its own — run() always
returns false. To stop it, compose it with a bounding task via Task.raceWith(Task...)
or Task.withDeadline(Task).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinit()Called once before the firstTask.run().booleanrun()When the current inner task finishes, builds and starts a new one.toString()Methods inherited from class com.cdarobotics.cdalib.tasks.Task
alongWith, andThen, raceWith, withDeadline
-
Constructor Details
-
RepeatTask
- Parameters:
taskSupplier- builds a fresh task each time the previous one finishes.
-
-
Method Details
-
init
public void init()Description copied from class:TaskCalled once before the firstTask.run(). Set up state and issue starting commands here. -
run
public boolean run()When the current inner task finishes, builds and starts a new one. -
toString
-