Plan and Test a Vision-Selected Autonomous
Prove branch selection and fallback behavior with simulated vision results before connecting robot motion.
Prove branch selection and fallback behavior with simulated vision results before connecting robot motion.
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.
The robot should decide before it moves. If vision is uncertain, it should run a conservative default rather than crash or freeze.
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.
Branch selection before motionJava
AutoBranch selected;
switch (visionResult) {
case LEFT:
selected = AutoBranch.LEFT;
break;
case RIGHT:
selected = AutoBranch.RIGHT;
break;
case CENTER:
case UNKNOWN:
default:
selected = AutoBranch.CENTER_SAFE;
break;
}
telemetry.addData("vision result", visionResult);
telemetry.addData("selected branch", selected);
telemetry.addData("fallback", visionResult == PropPosition.UNKNOWN);
telemetry.update();
// Foundations checkpoint: prove selection before connecting motion.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.
Create a branch table for LEFT, CENTER, RIGHT, and UNKNOWN. Feed each fake result into a selector, log the chosen branch and fallback reason, and review the plan before connecting any drive or mechanism output.
Check your understanding before moving on.
0 of 2 answered