13 / Autonomous Build
Simple Autonomous
Build an autonomous routine with timers and safe stops.
13 / Autonomous Build
Build an autonomous routine with timers and safe stops.
You will
This lesson is about sequencing decisions without a human driver. Autonomous code must know where it starts, what it is trying to accomplish, how each step ends, and what safe behavior happens when a step fails.
Each step should have one job: drive, turn, wait, move an arm, or stop. Small steps are easier to test and easier to fix at events.
A robot should never wait forever for a sensor or encoder. Even basic autonomous code should include timeouts and a final stop.
Teach autonomous as a progression from timed steps to encoder checks to state machines and actions. Each layer should preserve the same core habits: explicit state, telemetry for the active step, timeout or finish condition, and a final safe stop.
For this specific lesson, students should first restate the goal in robot terms, then identify the value or behavior they expect to observe, then run the smallest test that proves the idea. The lesson should feel like a guided lab: predict, run, observe, explain, and only then extend.
TimedAuto.java · Java
waitForStart();
runtime.reset();
while (opModeIsActive() && runtime.seconds() < 1.0) {
setDrivePower(0.25, 0.25);
telemetry.addLine("Step: drive forward");
telemetry.update();
}
setDrivePower(0, 0);
sleep(300);
runtime.reset();
while (opModeIsActive() && runtime.seconds() < 0.5) {
setDrivePower(0.2, -0.2);
}Autonomous failures are easier to diagnose when the robot reports why it moved on or stopped. Print the selected branch, active state, elapsed time, target, measurement, and stop reason. If those values are missing, the team is debugging a story with half the pages torn out.
Check your understanding
What should you check first when robot code does not behave as expected?
0 of 1 answered
References
Finished reading?
You'll move on to “Debugging with Telemetry” next.