Build a Vision-Selected Autonomous
Select and run autonomous branches using vision.
Select and run autonomous branches using vision.
In this lesson, you will:
A full autonomous routine is orchestration: vision selects a plan, drive actions move the robot, mechanism actions score, and fallback behavior prevents uncertainty from becoming chaos.
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.
The robot should decide before it moves. If vision is uncertain, it should run a conservative default rather than crash or freeze.
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 three branch actions, sample vision before start, choose a branch with switch, then run branch plus scoring and parking actions. Test branch selection with fake values before using the camera.
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.
SelectedAuto.javaJava
PropPosition result = processor.getPosition();
Action path = switch (result) {
case LEFT -> leftPath;
case RIGHT -> rightPath;
default -> centerPath;
};
Actions.runBlocking(new SequentialAction(closeClaw(), path, score(), park()));If the robot chooses the wrong path, isolate vision result first. If the path is correct but movement fails, isolate drive/localization. If mechanism timing fails, inspect action completion.
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 Build a Vision-Selected Autonomous?
0 of 1 answered
Mark this lesson complete — “P Control Basics” is up next.