For the complete documentation index, see llms.txt. This page is also available as Markdown.

Your First Swerve Robot

This tutorial takes a team from a bare WPILib project to a driving swerve robot using YAGSL. Follow the five steps in order — each one builds on the last, and by the end your robot will be driving under field-relative control with a tuned configuration.

Prerequisites

  • A WPILib Command-Based Robot (Java) project (new or existing).

  • Your swerve modules are physically assembled and wired (motors, absolute encoders, gyroscope all on the robot).

  • You know how to deploy code to your robot and open a driver dashboard (Shuffleboard, Elastic, or AdvantageScope).

If your swerve drive uses only Falcon500/Kraken/TalonFXS, Pigeon2.0, and CANCoder from CTRE, you can also consider the Tuner X Swerve Drive Generator as an alternative. YAGSL supports a much wider range of hardware and mixes vendors freely.

The five steps

  1. Gather your robot information — collect the CAN IDs, gear ratios, and module locations you'll need before you touch any software.

  2. Install YAGSL — add the YAGSL vendordep and any hardware vendordeps your robot needs.

  3. Generate your configuration — use config.yagsl.com to turn your robot information into a config directory.

  4. Verify and calibrate your hardware — confirm every motor, encoder, and gyro reports direction correctly, and capture absolute encoder offsets.

  5. Deploy and drive — wire up SwerveParser in a subsystem, bind your controller, and take your robot for its first drive.

Once you're driving, see the How-to Guides section for tuning PIDF gains, diagnosing drift, and other tasks you'll come back to as you keep developing.

Last updated

Was this helpful?