]> git.taranathan.com Git - FRC2027.git/commitdiff
few more fixes
authoriefomit <108955303+iefomit@users.noreply.github.com>
Mon, 24 Aug 2026 04:35:27 +0000 (21:35 -0700)
committeriefomit <108955303+iefomit@users.noreply.github.com>
Mon, 24 Aug 2026 04:35:27 +0000 (21:35 -0700)
src/main/java/frc/robot/subsystems/drivetrain/Module.java
src/main/java/frc/robot/util/DynamicSlewRateLimiter.java
src/main/java/frc/robot/util/MotorFactory.java

index 634fd2d3f0766610fab1e8022408ac7106c633dc..9caf1d64aa23ab59b0a729522a9002579daf2e6d 100644 (file)
@@ -371,7 +371,7 @@ public class Module implements ModuleIO {
     angleMotor
         .getConfigurator()
         .apply(new MotorOutputConfigs().withInverted(DriveConstants.INVERT_STEER_MOTOR));
-    angleMotor.setNeutralMode(DriveConstants.STEER_NEUTRAL_MODE);
+    angleMotor.configNeutralMode(DriveConstants.STEER_NEUTRAL_MODE);
     angleMotor.setPosition(0);
 
     // optimize bus utilization for angle motor
@@ -475,7 +475,7 @@ public class Module implements ModuleIO {
         .apply(
             new ClosedLoopRampsConfigs()
                 .withDutyCycleClosedLoopRampPeriod(DriveConstants.CLOSE_LOOP_RAMP));
-    driveMotor.setNeutralMode(DriveConstants.DRIVE_NEUTRAL_MODE);
+    driveMotor.configNeutralMode(DriveConstants.DRIVE_NEUTRAL_MODE);
 
     // optimize bus utilization for drive motor
     driveMotor.optimizeBusUtilization();
index 0d1b0ae51689b6848cbb31b1147fd36aee8cfe75..886e6f14019f34cafd2fdef75b6f6e363c4dbed0 100644 (file)
@@ -77,15 +77,15 @@ public class DynamicSlewRateLimiter {
     prevTime = currentTime;
 
     double change =
-        MathUtil.clamp(
-            input - prevVal, negativeRateLimit * elapsedTime, positiveRateLimit * elapsedTime);
+        Math.max(
+            negativeRateLimit * elapsedTime, Math.min(positiveRateLimit * elapsedTime, input - prevVal));
 
     if (continuous) {
       change =
-          MathUtil.clamp(
-              MathUtil.inputModulus(input - prevVal, lowerContinuousLimit, upperContinuousLimit),
-              negativeRateLimit * elapsedTime,
-              positiveRateLimit * elapsedTime);
+          Math.max(
+              negativeRateLimit * elapsedTime, 
+              Math.min(positiveRateLimit * elapsedTime,
+              MathUtil.inputModulus(input - prevVal, lowerContinuousLimit, upperContinuousLimit)));
 
       prevVal += change;
 
index 89c7a770c578e62f6f491332d02731e02aada8eb..3a179b4078f41d24d47459695f56d43422347b5c 100644 (file)
@@ -113,7 +113,7 @@ public class MotorFactory {
     config.Voltage = new VoltageConfigs().withPeakForwardVoltage(Constants.ROBOT_VOLTAGE);
 
     talon.getConfigurator().apply(config);
-    talon.setNeutralMode(NeutralModeValue.Brake);
+    talon.configNeutralMode(NeutralModeValue.Brake);
 
     return talon;
   }