Software · Controls
Flip switches and step through loops to see how our state machines pick their state.
handleStateTransition picks the next stateupdateLogic runs that stateifPick what each cell does, then press Test. The button only asks for SHOOTING or IDLE.
Every cell starts as system_state_ = wanted, the default when you don't write a table: every request is honoured at once. isAtShootingSpeed() is true within 10 rad/s of 250 rad/s, and each ball slows the flywheel by 40 rad/s.
if)setWantedState(...). The wanted state is sticky: it stays until something asks for another.handleStateTransition. Write it as a table: switch on system_state_, then on wanted. A request with no arm is ignored.updateLogic has no if. It is a switch (system_state_) where each arm commands its mechanisms.On our robot, RobotContainer extends MwSuperStateMachine. Every loop it runs its own handleStateTransition and updateLogic first, then every subsystem's, so a subsystem sees the robot's request in the same loop. The 2026 robot's SHOOT is asked for but never entered: the table picks SHOOT_WAIT, SHOOT_FEED, SHOOT_FEED_BRAKED or SHOOT_PASS_INTAKE from whether the shooter is ready and the robot is moving.
State Machines, Subsystems (a subsystem's transition table) and the State Machines lesson.