Actions and Sequencing
Prepare autonomous code for Road Runner action composition.
Prepare autonomous code for Road Runner action composition.
In this lesson, you will:
Actions are reusable autonomous behaviors that continue until they report completion. This model aligns with Road Runner 1.0 and command-based robot thinking.
This lesson should be read as a robotics lesson first and a programming lesson second. The code matters because it lets the team create repeatable behavior under match pressure. Students should slow down long enough to name the inputs, outputs, assumptions, and safety limits before they touch the robot.
An action is a cooperative task. It must do a small amount of work each time run is called, report telemetry, and finish when its condition is satisfied.
A good mental model gives the team a shared language. When a driver, builder, and programmer can point to the same behavior and use the same words, debugging gets calmer and code review becomes useful instead of personal.
Create one instant servo action and one encoder-wait action. Then compose them sequentially. Keep run calls short; do not hide sleeps inside custom actions.
Keep the implementation staged. First create the smallest version that compiles. Then add telemetry that proves it is running. Then connect one hardware device or one decision. Finally, repeat the test from a cold init so the team knows it was not a lucky hot reload.
MechanismAction.javaJava
public Action liftTo(int target) {
return packet -> {
lift.setTargetPosition(target);
int error = target - lift.getCurrentPosition();
packet.put("lift error", error);
return Math.abs(error) > 25;
};
}Returning false too soon starts the next action early; returning true forever stalls auto. Long blocking calls starve parallel actions.
Use the five-value debugging habit: input, state, target, measurement, output. If one of those values is missing, add it before rewriting logic. The goal is to make the robot tell the truth about what it thinks is happening.
Check your understanding before moving on.
What is the most important habit in Actions and Sequencing?
0 of 1 answered
Mark this lesson complete — “Build a Vision-Selected Autonomous” is up next.