Package com.crossbotics.ftchelper.auto
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 TypeMethodDescriptionbooleanisActive()True while the step should keep going (the OpMode runs, and the time for this part is not up).voidloop()One loop: updates every mechanism, shows telemetry, and lets the robot breathe.default voidAdds a note to this step's line in the end-of-autonomous report, e.g.doubleSeconds left in autonomous.The telemetry (add your own lines; the routine sends them).voidwaitFor(double seconds) Loops for this many seconds (mechanisms keep working).booleanwaitUntil(BooleanSupplier done, double timeoutSec) Loops untildoneis 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
Loops untildoneis 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::isAtTargettimeoutSec- most seconds to wait- Returns:
- true if
donebecame 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
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
-