CompTunerConstants and AlphaTunerConstants are generated by Phoenix 6 Tuner X and define swerve module geometry, PID gains, and maximum speeds for each physical robot. The correct file is selected at runtime by Subsystems.java based on RobotType.TYPE.
These files are generated from a
tuner-swerve-project.json that is checked into the repository. To regenerate them — for example after re-running sysid or changing hardware — open that JSON in Tuner X’s Swerve Project Generator and export the updated Java files. Do not manually edit the class bodies unless you know exactly which downstream code consumes each constant.Key constants at a glance
PID and feedforward gains
Steer gains (Slot 0)
Drive gains (Slot 0)
Both steer and drive use
ClosedLoopOutputType.Voltage.
Module positions
Competition bot
Module positions are measured from the robot center in inches, then converted to aDistance at compile time.
Alpha bot
createDrivetrain() factory method
Each tuner constants class exposes a static factory that constructs the CommandSwerveDrivetrain with all four module constants pre-populated. Subsystems.java calls the appropriate factory depending on robot type:
Wheel radius characterization
WheelRadiusCharacterization is a utility Command that spins the robot in place while measuring gyro rotation and wheel encoder deltas, then calculates the effective wheel radius:
DataLogManager at command end. To run it, hold Y on the launcherTuningController (port assigned in Controls.java):
LocationX/LocationY values in CompTunerConstants:
kWheelRadius in the appropriate tuner constants file with the measured value, then redeploy.