Skip to main content

Module 1 · Software Architecture & Loop Optimization

Control code doesn't run on its own. It runs inside an OpMode, inside a loop, on a Control Hub with a limited time budget and imperfect sensors. This module deals with that before the math gets heavier, and it answers two questions:

  1. Where does each piece of robot behavior live in the code?
  2. What changes when control math runs once per loop on real hardware?

Lessons​

  1. State Machines: give one subsystem an explicit set of modes and legal transitions, and sequence it without blocking.
  2. Command-Based Programming: build reusable commands that a scheduler runs, interrupts, and combines across the whole robot.
  3. From Math to a Loop: turn derivatives and integrals into per-loop Java, convert encoder ticks to real units, measure loop time, and keep hub traffic under control.
Why this comes before control theory

When good control math fails at competition, the equation is rarely the problem. More often it was dropped into one giant OpMode where nobody could say what the loop time was, which units a number was in, or which code owned a motor. Getting the structure right first makes everything after it easier to deploy.