Interface AutoContext


public interface AutoContext
What a running AutoStep can use. AutoRoutine gives it to every step.

An interface is a list of methods without their insides: AutoRoutine fills them in. Your step only sees these few methods, so it cannot, for example, add new steps while running. Docs: docs/modules/auto.md. Why we wait this way and never sleep(): docs/guides/non-blocking.md

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    True while the step should keep going (the OpMode runs, and the time for this part is not up).
    void
    One loop: updates every mechanism, shows telemetry, and lets the robot breathe.
    default void
    note(String text)
    Adds a note to this step's line in the end-of-autonomous report, e.g.
    double
    Seconds left in autonomous.
    The telemetry (add your own lines; the routine sends them).
    void
    waitFor(double seconds)
    Loops for this many seconds (mechanisms keep working).
    boolean
    waitUntil(BooleanSupplier done, double timeoutSec)
    Loops until done is true, the time runs out, or the routine stops.
  • Method Details

    • isActive

      boolean isActive()
      True while the step should keep going (the OpMode runs, and the time for this part is not up).
    • loop

      void loop()
      One loop: updates every mechanism, shows telemetry, and lets the robot breathe. Call it inside any waiting loop you write.
    • waitUntil

      boolean waitUntil(BooleanSupplier done, double timeoutSec)
      Loops until done is true, the time runs out, or the routine stops. BLOCKS (on purpose, autonomous only), but keeps every mechanism updating while it waits.
      Parameters:
      done - the condition, e.g. lift::isAtTarget
      timeoutSec - most seconds to wait
      Returns:
      true if done became true, false if it timed out or stopped
    • waitFor

      void waitFor(double seconds)
      Loops for this many seconds (mechanisms keep working). Use this instead of sleep(). BLOCKS.
    • secondsLeft

      double secondsLeft()
      Seconds left in autonomous.
    • telemetry

      RobotTelemetry telemetry()
      The telemetry (add your own lines; the routine sends them).
    • note

      default void note(String text)
      Adds a note to this step's line in the end-of-autonomous report, e.g. "timed out", instead of "done". Default: nothing (a context that keeps no report).
      Parameters:
      text - a few words