]> git.taranathan.com Git - FRC2026.git/commitdiff
sure
authoriefomit <timofei.stem@gmail.com>
Fri, 27 Mar 2026 22:01:13 +0000 (15:01 -0700)
committeriefomit <timofei.stem@gmail.com>
Fri, 27 Mar 2026 22:01:13 +0000 (15:01 -0700)
src/main/java/frc/robot/constants/swerve/DriveConstants.java
src/main/java/frc/robot/subsystems/drivetrain/Module.java

index dc2d172d95632c3cbd3bd8031d65ff5b440a4f18..b3d335d6cbb78513d032f61b40433d2c97f01f98 100644 (file)
@@ -189,6 +189,9 @@ public class DriveConstants {
         // It will limit it to time given (in seconds) to go from zero to full throttle.
         // A small open loop ramp (0.25) helps with tread wear, tipping, etc
         public static final double OPEN_LOOP_RAMP = 0.1;
+
+        // limits maximum rate of change for motor
+        public static final double CLOSE_LOOP_RAMP = 0.0;
     
         public static final double WHEEL_CIRCUMFERENCE = 2*Math.PI*WHEEL_RADIUS;
     
index e62c922d65f4c4049d07f27e9f7c0bdb93bc2844..d30e47e71b5c899b301e02e179ac455e6d1a1acc 100644 (file)
@@ -252,7 +252,7 @@ public class Module implements ModuleIO{
             double velocity = desiredState.speedMetersPerSecond/DriveConstants.WHEEL_RADIUS/2/Math.PI*DriveConstants.DRIVE_GEAR_RATIO;
             Logger.recordOutput("desired vel" + moduleConstants.ordinal(), velocity);
             
-            double feedforward = desiredState.speedMetersPerSecond * moduleConstants.getDriveV();
+            double feedforward = velocity * moduleConstants.getDriveV();
             driveMotor.setControl(
                 velocityRequest
                     .withVelocity(velocity)
@@ -366,7 +366,7 @@ public class Module implements ModuleIO{
         driveMotor.getConfigurator().apply(config);
         driveMotor.getConfigurator().apply(new MotorOutputConfigs().withInverted(DriveConstants.INVERT_DRIVE_MOTOR));
         driveMotor.getConfigurator().apply(new OpenLoopRampsConfigs().withDutyCycleOpenLoopRampPeriod(DriveConstants.OPEN_LOOP_RAMP));
-        driveMotor.getConfigurator().apply(new ClosedLoopRampsConfigs().withDutyCycleClosedLoopRampPeriod(0.0));
+        driveMotor.getConfigurator().apply(new ClosedLoopRampsConfigs().withDutyCycleClosedLoopRampPeriod(DriveConstants.CLOSE_LOOP_RAMP));
         driveMotor.setNeutralMode(DriveConstants.DRIVE_NEUTRAL_MODE);
         
     }