Write a Full Command-Based TeleOp
Capstone TeleOp that composes drive, mechanisms, and safety.
Capstone TeleOp that composes drive, mechanisms, and safety.
In this lesson, you will:
A full TeleOp should be boring to read. The main loop updates gamepad snapshots, runs the scheduler, handles drive, schedules mechanism commands, updates subsystems, and reports only useful telemetry.
The robot is now a set of capabilities rather than scattered motor writes. Drive code owns movement, subsystems own mechanisms, commands request behavior, and safe state coordinates recovery.
Start from the working robot-centric or field-centric drive. Add command scheduler, then one mechanism command, then safe state, then driver telemetry. Do not add every mechanism at once.
MainTeleOp.javaJava
public void run() {
previous.copy(current);
current.copy(gamepad2);
CommandScheduler.getInstance().run();
driveWithGamepad(gamepad1);
if (current.a && !previous.a) scheduler.schedule(new ArmToScore());
robot.periodic();
telemetry.addData("state", robot.summary());
telemetry.update();
}If commands fight, inspect subsystem ownership. If the loop becomes unreadable, extract helpers. If telemetry is noisy, separate programmer telemetry from driver telemetry.
Build a TeleOp skeleton for your current robot with drive, one mechanism, safe state, loop rate, and command scheduling.
Check your understanding before moving on.
0 of 2 answered