diff --git a/java/SwerveWithPathPlanner/src/main/java/frc/robot/generated/TunerConstants.java b/java/SwerveWithPathPlanner/src/main/java/frc/robot/generated/TunerConstants.java index 35adc83a..67454ec8 100644 --- a/java/SwerveWithPathPlanner/src/main/java/frc/robot/generated/TunerConstants.java +++ b/java/SwerveWithPathPlanner/src/main/java/frc/robot/generated/TunerConstants.java @@ -10,18 +10,26 @@ import frc.robot.CommandSwerveDrivetrain; public class TunerConstants { - // Both sets of gains need to be tuned to your individual robot - // The steer motor uses MotionMagicVoltage control + // Both sets of gains need to be tuned to your individual robot. + + // The steer motor uses any SwerveModule.SteerRequestType control request with the + // output type specified by SwerveModuleConstants.SteerMotorClosedLoopOutput private static final Slot0Configs steerGains = new Slot0Configs() .withKP(100).withKI(0).withKD(0.05) .withKS(0).withKV(1.5).withKA(0); - // When using closed-loop control, the drive motor uses: - // - VelocityVoltage, if DrivetrainConstants.SupportsPro is false (default) - // - VelocityTorqueCurrentFOC, if DrivetrainConstants.SupportsPro is true + // When using closed-loop control, the drive motor uses the control + // output type specified by SwerveModuleConstants.DriveMotorClosedLoopOutput private static final Slot0Configs driveGains = new Slot0Configs() .withKP(3).withKI(0).withKD(0) .withKS(0).withKV(0).withKA(0); + // The closed-loop output type to use for the steer motors; + // This affects the PID/FF gains for the steer motors + private static final ClosedLoopOutputType steerClosedLoopOutput = ClosedLoopOutputType.Voltage; + // The closed-loop output type to use for the drive motors; + // This affects the PID/FF gains for the drive motors + private static final ClosedLoopOutputType driveClosedLoopOutput = ClosedLoopOutputType.Voltage; + // The stator current at which the wheels start to slip; // This needs to be tuned to your individual robot private static final double kSlipCurrentA = 300.0; @@ -61,6 +69,8 @@ public class TunerConstants { .withSlipCurrent(kSlipCurrentA) .withSteerMotorGains(steerGains) .withDriveMotorGains(driveGains) + .withSteerMotorClosedLoopOutput(steerClosedLoopOutput) + .withDriveMotorClosedLoopOutput(driveClosedLoopOutput) .withSpeedAt12VoltsMps(kSpeedAt12VoltsMps) .withSteerInertia(kSteerInertia) .withDriveInertia(kDriveInertia)