05 / From Timed Steps to Actions
Actions and Sequencing
Use reusable action-style tasks to prepare for Road Runner 1.0 autonomous.
05 / From Timed Steps to Actions
Use reusable action-style tasks to prepare for Road Runner 1.0 autonomous.
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.
Road Runner 1.0 leans heavily on actions: small tasks that keep running until they report completion. This matches command-based thinking and makes autonomous routines easier to compose.
Once mechanisms expose actions, an autonomous routine can drive, move an arm, wait, and deposit without duplicating mechanism details in every auto file.
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.
MechanismAction.java · Java
public Action closeClawAction() {
return packet -> {
clawServo.setPosition(CLOSED);
packet.put("claw", "closed");
return false;
};
}
public Action waitForLiftAction(int target) {
return packet -> {
lift.setTargetPosition(target);
packet.put("lift error", target - lift.getCurrentPosition());
return Math.abs(target - lift.getCurrentPosition()) > 25;
};
}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
In Road Runner action style, what does returning false mean?
0 of 1 answered
References
Finished reading?
You'll move on to “PID Basics” next.