The 2026 Spectrum codebase lives underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/spectrum3847/2026-Spectrum/llms.txt
Use this file to discover all available pages before exploring further.
src/main/java/frc/ and is split into three top-level packages, each with a distinct responsibility. Season-specific robot code lives in frc.robot, reusable library code that carries over year-to-year lives in frc.spectrumLib, and 2026 game-specific field geometry and targeting logic lives in frc.rebuilt. Understanding this separation is the fastest way to orient yourself in the codebase and know where to make a change.
Directory tree
The full source tree is reproduced below in simplified form:Top-level packages
frc.robot — season robot code
frc.robot — season robot code
frc.robot contains everything specific to the 2026 competition robot: subsystem implementations, hardware configuration classes, gamepad bindings, autonomous routines, and the top-level Robot.java entry point.The package is structured around one directory per subsystem or concern. Each subsystem directory follows the three-file pattern described in the next section. Cross-subsystem coordination — deciding which subsystem states are active together — lives in Coordinator.java, while RobotStates.java defines the top-level Trigger conditions that drive those coordinator calls.The configs/ directory holds four robot-specific configuration classes (FM2026, XM2026, PM2026, AM2026). At startup, Robot.java reads the RoboRIO’s unique ID and loads the matching config, so the same codebase can run on the full competition robot, the practice bot, and dev rigs without code changes.frc.spectrumLib — reusable library
frc.spectrumLib — reusable library
frc.spectrumLib is Spectrum’s year-to-year library — code that is not specific to any single game and is carried forward each season. It provides the Mechanism base class (wrapping CTRE TalonFX/Kraken motor configuration, Motion Magic, and control modes), the SpectrumSubsystem base class, gamepad abstraction, LED management, simulation helpers, and utility classes such as CachedDouble (which caps sensor reads to once per periodic loop to reduce CANbus traffic).When contributing new robot code, prefer extending the classes in spectrumLib rather than duplicating logic. Changes to spectrumLib may affect multiple subsystems — review carefully before modifying.frc.rebuilt — 2026 game helpers
frc.rebuilt — 2026 game helpers
frc.rebuilt contains logic tied to the 2026 FRC game REBUILT: field geometry constants (Field.java, Zones.java), AprilTag properties for the 2026 layout (TagProperties.java), shot calculation (ShotCalculator.java), and target factory implementations used by the vision and launcher subsystems.This package exists so that game-specific math and constants are isolated from both the reusable library code and the general robot wiring. It has no WPILib subsystem or command infrastructure — it is purely data and calculation.Subsystem folder pattern
Every mechanism-based subsystem infrc.robot follows a consistent three-file pattern. The swerve/ subsystem is the most complete example, while simpler subsystems like launcher/ and fuelIntake/ show the minimal form.
- Main class
- Config class
- States class
The main class (e.g.,
Launcher.java, Swerve.java, Vision.java) extends SpectrumSubsystem or the game-appropriate base class. It:- Declares and initializes hardware (motors, sensors, cameras)
- Exposes public command factory methods (e.g.,
runVelocity(),holdAngle()) - Creates
Triggerfactories from sensor readings (e.g.,atTargetVelocity()) - Calls
periodic()to update telemetry and simulation state
The
vision/ subsystem splits into Vision.java (sensor reads and pose
estimation) and VisionSystem.java (command logic and trigger bindings),
with VisionStates.java for trigger wiring — a slight extension of the
standard pattern to handle the complexity of fusing multiple cameras.Gradle build configuration
The project uses GradleRIO (edu.wpi.first.GradleRIO 2026.2.1) as its base build plugin, which handles RoboRIO deployment, simulation tasks, and vendor dependency resolution. Three additional plugins are applied on top:
Spotless
Runs automatically before every
compileJava. Enforces Google AOSP Java formatting (googleJavaFormat 1.15.0), removes unused imports, trims trailing whitespace, and formats Gradle and XML files. You do not need to run a formatter manually.SpotBugs
Static analysis that catches common Java bugs — using
= instead of == in conditionals, null dereferences, and similar issues. Reports are written to build/reports/spotbugs.html. Failures block the build by default.Lombok
Annotation processor (
io.freefair.lombok 9.1.0) that generates boilerplate getter/setter methods at compile time. Reduces repetitive accessor code across config and data classes.VERSION_17 in build.gradle:
gradle.properties:
Autonomous paths (src/main/deploy/pathplanner/)
PathPlanner path and auto files live under src/main/deploy/pathplanner/ and are deployed to the RoboRIO alongside the robot code at the path /home/lvuser/deploy/pathplanner/.
SendableChooser wired up in auton/. Event markers in PathPlanner trigger named commands registered in the NamedCommands map during robot initialization.
Vendor dependencies (vendordeps/)
Third-party library JSON files live in vendordeps/ at the project root. WPILib VSCode reads these to resolve the correct Maven artifacts. The 2026 robot depends on:
- CTRE Phoenix 6 — TalonFX motor controllers and swerve drive library
- PathPlanner — autonomous path following
- PhotonLib — vision simulation and camera interface
vendordeps/ automatically.
Next steps
Robot architecture
Learn how subsystems, the
Mechanism base class, robot states, and triggers connect at runtime.Development guide
Code style rules, commit conventions, and best practices for contributing to the codebase.
