Package com.cdarobotics.cdalib.tasks
Class DeferredTask
java.lang.Object
com.cdarobotics.cdalib.tasks.Task
com.cdarobotics.cdalib.tasks.DeferredTask
A task that defers building its inner task until init() is called at runtime.
Use this when the task depends on state that isn't known at construction time
(e.g., obelisk pattern from AprilTag detection).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinit()Called once before the firstTask.run().booleanrun()Called every loop afterTask.init().toString()Methods inherited from class com.cdarobotics.cdalib.tasks.Task
alongWith, andThen, raceWith, withDeadline
-
Constructor Details
-
DeferredTask
- Parameters:
taskSupplier- builds the inner task lazily, wheninit()is first called.
-
-
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()Description copied from class:TaskCalled every loop afterTask.init(). -
toString
-