diff --git a/src/main/java/frc/robot/generated/TunerConstants.java b/src/main/java/frc/robot/generated/TunerConstants.java index dcb6c54..f608015 100644 --- a/src/main/java/frc/robot/generated/TunerConstants.java +++ b/src/main/java/frc/robot/generated/TunerConstants.java @@ -24,14 +24,14 @@ public class TunerConstants { // 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(70).withKI(0).withKD(0.5) + .withKP(100).withKI(0).withKD(0.5) .withKS(0.1).withKV(1.59).withKA(0) .withStaticFeedforwardSign(StaticFeedforwardSignValue.UseClosedLoopSign); // 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(0.01).withKI(0).withKD(0) - .withKS(0.05).withKV(0.117); + .withKP(0.1).withKI(0).withKD(0) + .withKS(0).withKV(0.124); // The closed-loop output type to use for the steer motors; // This affects the PID/FF gains for the steer motors @@ -42,7 +42,7 @@ public class TunerConstants { // The type of motor used for the drive motor private static final DriveMotorArrangement kDriveMotorType = DriveMotorArrangement.TalonFX_Integrated; - // The type of motor used for the drive motor + // The type of motor used for the steer motor private static final SteerMotorArrangement kSteerMotorType = SteerMotorArrangement.TalonFX_Integrated; // The remote sensor feedback type to use for the steer motors; @@ -55,7 +55,14 @@ public class TunerConstants { // Initial configs for the drive and steer motors and the azimuth encoder; these cannot be null. // Some configs will be overwritten; check the `with*InitialConfigs()` API documentation. - private static final TalonFXConfiguration driveInitialConfigs = new TalonFXConfiguration(); + private static final TalonFXConfiguration driveInitialConfigs = new TalonFXConfiguration() + .withCurrentLimits( + new CurrentLimitsConfigs() + // Default supply current limit is 70 A, but it can be lowered to avoid brownouts. + // Supply current limits can be larger than the breaker current rating. + .withSupplyCurrentLimit(Amps.of(70)) + .withSupplyCurrentLimitEnable(true) + ); private static final TalonFXConfiguration steerInitialConfigs = new TalonFXConfiguration() .withCurrentLimits( new CurrentLimitsConfigs() @@ -66,23 +73,14 @@ public class TunerConstants { ); private static final CANcoderConfiguration encoderInitialConfigs = new CANcoderConfiguration(); // Configs for the Pigeon 2; leave this null to skip applying Pigeon 2 configs - private static final Pigeon2Configuration pigeonConfigs = - new Pigeon2Configuration() - .withGyroTrim( - new GyroTrimConfigs() - .withGyroScalarZ(-5.0) - ) - .withPigeon2Features( - new Pigeon2FeaturesConfigs() - .withEnableCompass(false) - ); - + private static final Pigeon2Configuration pigeonConfigs = null; // CAN bus that the devices are located on; // All swerve devices must share the same CAN bus public static final CANBus kCANBus = new CANBus("", "./logs/example.hoot"); - // Theoretical free speed (m/s) at 12 V applied output; + // Measured robot speed (m/s) at 12 V applied output; + // This is NOT the desired max robot speed - see MaxSpeed in RobotContainer instead; // This needs to be tuned to your individual robot public static final LinearVelocity kSpeedAt12Volts = MetersPerSecond.of(4.73); @@ -101,7 +99,7 @@ public class TunerConstants { // These are only used for simulation private static final MomentOfInertia kSteerInertia = KilogramSquareMeters.of(0.01); - private static final MomentOfInertia kDriveInertia = KilogramSquareMeters.of(0.01); + private static final MomentOfInertia kDriveInertia = KilogramSquareMeters.of(0.035); // Simulated voltage necessary to overcome friction private static final Voltage kSteerFrictionVoltage = Volts.of(0.2); private static final Voltage kDriveFrictionVoltage = Volts.of(0.2); @@ -136,10 +134,10 @@ public class TunerConstants { // Front Left - private static final int kFrontLeftDriveMotorId = 11; - private static final int kFrontLeftSteerMotorId = 12; - private static final int kFrontLeftEncoderId = 13; - private static final Angle kFrontLeftEncoderOffset = Rotations.of(-0.412841796875); + private static final int kFrontLeftDriveMotorId = 1; + private static final int kFrontLeftSteerMotorId = 2; + private static final int kFrontLeftEncoderId = 3; + private static final Angle kFrontLeftEncoderOffset = Rotations.of(-0.18115234375); private static final boolean kFrontLeftSteerMotorInverted = false; private static final boolean kFrontLeftEncoderInverted = false; @@ -147,10 +145,10 @@ public class TunerConstants { private static final Distance kFrontLeftYPos = Inches.of(11.375); // Front Right - private static final int kFrontRightDriveMotorId = 21; - private static final int kFrontRightSteerMotorId = 22; - private static final int kFrontRightEncoderId = 23; - private static final Angle kFrontRightEncoderOffset = Rotations.of(-0.012939453125); + private static final int kFrontRightDriveMotorId = 11; + private static final int kFrontRightSteerMotorId = 12; + private static final int kFrontRightEncoderId = 13; + private static final Angle kFrontRightEncoderOffset = Rotations.of(-0.16162109375); private static final boolean kFrontRightSteerMotorInverted = false; private static final boolean kFrontRightEncoderInverted = false; @@ -158,10 +156,10 @@ public class TunerConstants { private static final Distance kFrontRightYPos = Inches.of(-11.375); // Back Left - private static final int kBackLeftDriveMotorId = 1; - private static final int kBackLeftSteerMotorId = 2; - private static final int kBackLeftEncoderId = 3; - private static final Angle kBackLeftEncoderOffset = Rotations.of(0.07275390625); + private static final int kBackLeftDriveMotorId = 21; + private static final int kBackLeftSteerMotorId = 22; + private static final int kBackLeftEncoderId = 23; + private static final Angle kBackLeftEncoderOffset = Rotations.of(-0.017822265625); private static final boolean kBackLeftSteerMotorInverted = false; private static final boolean kBackLeftEncoderInverted = false; @@ -172,7 +170,7 @@ public class TunerConstants { private static final int kBackRightDriveMotorId = 31; private static final int kBackRightSteerMotorId = 32; private static final int kBackRightEncoderId = 33; - private static final Angle kBackRightEncoderOffset = Rotations.of(-0.4892578125); + private static final Angle kBackRightEncoderOffset = Rotations.of(-0.490234375); private static final boolean kBackRightSteerMotorInverted = false; private static final boolean kBackRightEncoderInverted = false; @@ -203,7 +201,7 @@ public class TunerConstants { /** * Creates a CommandSwerveDrivetrain instance. - * This should only be called once in your robot program,. + * This should only be called once in your robot program. */ public static CommandSwerveDrivetrain createDrivetrain() { return new CommandSwerveDrivetrain(