AutoLogic manages a dynamic chooser that filters available autos by the selected start position and builds the chosen routine at match start using AutoBuilder.buildAuto().
Initialization flow
The autonomous system must be initialized in a strict order before match start. The steps below reflect the actual call sequence executed inRobot.java.
1
Configure the drivebase with AutoBuilderConfig
AutoBuilderConfig.buildAuto(drivebase, unitTest) calls AutoBuilder.configure(...) with the robot’s pose supplier, odometry reset method, chassis speeds supplier, and a PPHolonomicDriveController (translation PID 5.0 / 0.0 / 0.0, rotation PID 5.0 / 0.0 / 0.0). When unitTest is false, the robot config is chosen as alpha or comp based on RobotType; passing true forces the sim config (used in unit tests only).2
Inject subsystems into AutoLogic
AutoLogic.init(subsystems) stores the Subsystems reference used by registerCommands() to access the launcher, indexer, drivebase, and other subsystems. This must be called before initCommandsAndPaths().3
Register named commands and initialize paths
AutoLogic.initCommandsAndPaths(testMode) first calls registerCommands() (unless in test mode) to register the launch, intake, and climb named commands with PathPlanner, then calls initPaths() to build the list of AutoPath objects and populate namesToAuto.4
Publish SmartDashboard choosers
AutoLogic.initSmartDashBoard() puts the three choosers onto the SmartDashboard and wires onChange callbacks so that the available-autos list refreshes whenever the operator changes the start position or game-object count.initSmartDashBoard() calls requirePathsInitialized() internally and will throw an IllegalStateException if initCommandsAndPaths() has not been called first.5
Schedule the selected auto in autonomousInit()
When autonomous mode starts,
AutoLogic.getSelectedAuto() returns a command that waits for the configured delay (read from the Autos/Auto Delay NetworkTables entry) and then runs the selected PathPlanner auto by name.SmartDashboard choosers
Three choosers are published to the SmartDashboard duringinitSmartDashBoard().
An additional
Auto Key string ("RB=Right Bump, LB=Left Bump, LT=Left Trench, RT=Right Trench") is published as a reference legend.
StartPosition enum
EachStartPosition value carries a display title and a Pose2d that auto starting poses are matched against (within ±0.05 m in X/Y and ±5° in heading).
MISC is the default selection. Any auto whose starting pose does not match one of the three physical positions is assigned to MISC.
Auto delay
The operator can set a pre-auto wait time (in seconds) via theAutos/Auto Delay NetworkTables entry. The entry is initialised to 0.0 in initSmartDashBoard(). getSelectedAuto() reads this value at schedule time:
getSelectedAuto()
AutoLogic.getSelectedAuto() is the primary entry point for autonomous mode. It resolves the selected auto name from DynamicSendableChooser, falls back to the "Default" path if nothing is selected, prepends the configured delay, and returns the composed command.
filterAutos(numGameObjects)
filterAutos(int numGameObjects) clears the availableAutos chooser and repopulates it with only those paths whose startPosition matches the currently-selected StartPosition. The "Default" path is always the chooser default regardless of filter state.
Simulation pose reset
AutoLogic.getSelectedAutoStartingPose() returns the Pose2d of the currently-selected auto, or Pose2d.kZero if no valid starting pose is available. This is used in simulation to reset the robot’s odometry to the correct position before the auto runs.
Every public method in
AutoLogic that depends on the path list calls requirePathsInitialized() as its first statement. If initCommandsAndPaths() has not been called, an IllegalStateException is thrown with a descriptive message.