Subsystem Lifecycle
Read, decide, write, reset for each mechanism.
Read, decide, write, reset for each mechanism.
In this lesson, you will:
A subsystem is the owner of a mechanism. It stores state, reads sensors, calculates targets or outputs, writes hardware, and knows how to reset safely.
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 OpMode should not know arm servo math or lift PID internals. It should ask the subsystem for robot-level behavior such as goToIntake or goToScore.
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 subsystem with fields for state and target. Add read, periodic, write, and reset. Call them in the same order every loop.
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.
WSubsystem.javaJava
public abstract class WSubsystem {
public abstract void read();
public abstract void periodic();
public abstract void write();
public abstract void reset();
}If a motor is written in multiple places, ownership is broken. If telemetry shows stale readings, read may be happening too late. If reset is dangerous, the subsystem lacks a safe default.
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 Subsystem Lifecycle?
0 of 1 answered
Mark this lesson complete — “Enums and Finite State Machines” is up next.