Command-Based OpModes
Small reusable behaviors scheduled over time.
Small reusable behaviors scheduled over time.
In this lesson, you will:
Commands request subsystem behavior. They are small units of robot action that can be triggered by TeleOp or composed into autonomous routines.
The scheduler is the heartbeat. Commands can only progress if run is called repeatedly, and commands should finish quickly enough to let other robot work continue.
Start with InstantCommand-style state changes, then add a sequential group, then a command that waits for a condition. Reuse one command in both TeleOp and auto.
CommandSnippet.javaJava
CommandScheduler.getInstance().run();
if (pressedScore) {
scheduler.schedule(new SequentialCommandGroup(
new ArmToScore(),
new OpenClaw()
));
}If a command never finishes, inspect the finish condition. If parallel commands starve each other, remove blocking sleeps. If two commands fight, check subsystem ownership.
Make a claw command and an arm command, then combine them into a score sequence.
Check your understanding before moving on.
0 of 2 answered