This page collects practical advice from Spectrum’s 2026 season development experience — patterns that improve code quality, reduce bugs, and make the codebase easier to work on as a team.Documentation 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.
DoubleSupplier vs double
For most command factories and trigger factories in theMechanism class, prefer DoubleSupplier arguments over raw double values.
Prefer DoubleSupplier for dynamic values
DoubleSupplier means the command picks up live changes from NetworkTables (via TuneValue) or sensor readings without needing to be rescheduled. This is especially useful during tuning on hardware.
CachedDouble for CANbus efficiency
Any sensor value read over the CAN bus (motor position, velocity, current) should be cached once per periodic loop rather than called multiple times per cycle.java
Mechanism base class in SpectrumLib already does this for you — getPosition(), getVelocityRPM(), getVoltage(), and getStatorCurrent() all return CachedDouble values updated in Mechanism.periodic(). You only need to add your own CachedDouble for custom sensors outside the motor controller.
Method chaining with Triggers and Commands
WPILib’sTrigger and Command APIs are designed for fluent method chaining. Embrace this — it’s more readable than intermediate variables for simple binding.
java
Java workspace cleanup
If VS Code shows red errors that don’t match actual code problems (common after switching branches or pulling large changes):Coordinate systems
FRC uses a specific field coordinate system that affects swerve drive, vision, and autonomous path planning:- X axis: Positive toward the opposing alliance wall
- Y axis: Positive to the left when facing the opposing wall
- Rotation: Counter-clockwise positive (following right-hand rule)
2026 season code goals
Spectrum’s development priorities for 2026, which shape how the codebase is structured:Sim-first development
Develop and validate all code in WPILib simulation before touching hardware. Robot time is reserved for tuning and final verification.
Trigger-based states
Replace large
CommandGroup sequences with Trigger-driven states. Fewer nested command groups means easier debugging and more flexible behavior.Multi-robot support
One codebase runs on FM, XM, PM, and AM robots via the
Rio.id config system. No robot-specific forks.Improved logging
DogLog and AdvantageScope for structured data capture, replay, and analysis across all test sessions.
