Skip to content

WPILib 2026 Java Swerve Template

This project is a working robot-code foundation, not a bag of examples. The drivetrain, odometry, simulation, replay behavior, and logging pattern are meant to be trusted infrastructure. Your job when starting a robot from this template is to configure the seams that belong to your robot, then build mechanisms and commands around the stable APIs.

I write robot code this way because it keeps us honest under event pressure. When the drive base is treated as infrastructure, we can tune it, test it, log it, and diagnose it the same way every season. When every mechanism talks through a small subsystem API instead of vendor objects, the code remains understandable enough for new students and predictable enough for advanced controls work.

What this template includes

  • CTRE TalonFX/Pigeon2 swerve based on the AdvantageKit TalonFX swerve template.
  • High-rate Phoenix odometry, module IO, simulation IO, replay-safe no-op IO, SysId, and structured AdvantageKit logging.
  • PhotonVision AprilTag localization with accepted/rejected pose logging and simulation support.
  • BLine JSON autonomous routines loaded from deploy files.
  • PathPlanner runtime pathfinding for teleop navigation only.
  • A small Drive API that commands use instead of touching modules or vendor devices.
  • Neutral yearly configuration seams for field targets, navigation goals, autos, and mechanism event commands.

What not to rewrite

Do not rewrite these pieces as part of normal robot bring-up:

  • Drive
  • Module
  • Phoenix odometry thread
  • TalonFX/Pigeon module IO
  • drivetrain simulation
  • replay-safe no-op IO
  • AdvantageKit input logging pattern

If those files need changes, treat that as drivetrain infrastructure work. Review it carefully, test it in sim and logs, and avoid mixing it with mechanism feature work.

Normal bring-up path

  1. Install WPILib 2026 and vendor libraries.
  2. Set the team number.
  3. Generate or copy CTRE Tuner X swerve constants.
  4. Calibrate module offsets with AdvantageScope.
  5. Confirm wheel radius, module directions, current limits, and physical dimensions.
  6. Configure PhotonVision camera names and transforms.
  7. Run unit tests, desktop sim, and replay checks.
  8. Test on blocks before driving on carpet.
  9. Add mechanisms through subsystem APIs and IO layers.
  10. Add BLine autos and PathPlanner teleop goals only after the drive base behaves correctly.

Where to go next