The superstructure coordinates all subsystems so the robot behaves as one coherent machine. Think of it as the conductor of an orchestra, scheduling and sequencing actions across subsystems.
What is the Superstructure?
The superstructure is a top‑level state machine that:
- Owns high‑level intent like “intake coral” or “score algae”.
- Translates intent into concrete per‑subsystem requests.
- Arbitrates conflicts, enforces ordering, and ensures safety interlocks.
- Provides a single interface to the rest of the codebase (teleop, auto, and planners).
Why this pattern works:
- Decouples high‑level goals from low‑level hardware control.
- Makes autonomous routines easier to script as sequences of requests.
- Centralizes safety checks and timing.
Requests Pattern
Each subsystem exposes a sealed Request interface owned by the superstructure package. Superstructure sets each subsystem’s currentRequest based on operator input or an autonomous planner.
Design rules:
- Exactly one request channel per subsystem.
- Requests should be declarative (what you want), not imperative (how to do it).
- Prefer immutable data in requests. Any mutable fields should be rare and documented.