From 179913194ced5901aefe33e3c78868662bf0120e Mon Sep 17 00:00:00 2001 From: OnDYCLaptop Date: Mon, 6 Jul 2026 22:52:36 +0800 Subject: [PATCH] =?UTF-8?q?tunerconstants=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frc/robot/generated/TunerConstants.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/generated/TunerConstants.java b/src/main/java/frc/robot/generated/TunerConstants.java index f608015..9ed4726 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(100).withKI(0).withKD(0.5) + .withKP(70).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.1).withKI(0).withKD(0) - .withKS(0).withKV(0.124); + .withKP(0.01).withKI(0).withKD(0) + .withKS(0.05).withKV(0.117); // The closed-loop output type to use for the steer motors; // This affects the PID/FF gains for the steer motors @@ -73,7 +73,16 @@ 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 = null; + private static final Pigeon2Configuration pigeonConfigs = + new Pigeon2Configuration() + .withGyroTrim( + new GyroTrimConfigs() + .withGyroScalarZ(-5.0) + ) + .withPigeon2Features( + new Pigeon2FeaturesConfigs() + .withEnableCompass(false) + ); // CAN bus that the devices are located on; // All swerve devices must share the same CAN bus @@ -99,7 +108,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.035); + private static final MomentOfInertia kDriveInertia = KilogramSquareMeters.of(0.01); // Simulated voltage necessary to overcome friction private static final Voltage kSteerFrictionVoltage = Volts.of(0.2); private static final Voltage kDriveFrictionVoltage = Volts.of(0.2);