WestlakeLEARN
FTC · Java

FIRST Tech Challenge

FTC · Java

  • Subsystem Lifecycle
  • Enums and Finite State Machines

Subsystem Lifecycle

Read, decide, write, reset for each mechanism.

Module 6: Robot ArchitectureIntermediate

In this lesson, you will:

  1. 01Separate read, periodic, write, and reset.
  2. 02Give each mechanism an owner.
  3. 03Expose simple public methods.

Concept narrative

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.

Robot mental model

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.

Implementation walkthrough

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();
}

Common mistakes and debugging

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.

Practice

Convert one current mechanism into a lifecycle subsystem and remove raw mechanism writes from the OpMode.

Checkpoint

  • Mechanism writes live in one subsystem.
  • Reset is safe.
  • The OpMode loop is shorter.

Reflection check

Check your understanding before moving on.

What is the most important habit in Subsystem Lifecycle?

0 of 1 answered

References

FIRST FTC DocsOfficial SDK, Robot Controller, and programming reference.Game Manual 0FTC community reference for programming, controls, and robot design.

Finished reading?

Mark this lesson complete — “Enums and Finite State Machines” is up next.

Write a Full Command-Based TeleOpEnums and Finite State Machines