Class BasicTask

java.lang.Object
com.cdarobotics.cdalib.tasks.Task
com.cdarobotics.cdalib.tasks.BasicTask

public class BasicTask extends Task
A task built from lambdas: init runs once, then run is polled each loop and returns true when the task is finished.
  • Constructor Details

    • BasicTask

      public BasicTask(Runnable init, BooleanSupplier run)
      Parameters:
      init - runs once when the task starts
      run - polled each loop; return true when the task is finished
  • Method Details

    • init

      public void init()
      Description copied from class: Task
      Called once before the first Task.run(). Set up state and issue starting commands here.
      Specified by:
      init in class Task
    • run

      public boolean run()
      Description copied from class: Task
      Called every loop after Task.init().
      Specified by:
      run in class Task
      Returns:
      true when the task is finished, false to keep running.
    • toString

      @NonNull public String toString()
      Specified by:
      toString in class Task