]> git.taranathan.com Git - FRC2026.git/commitdiff
Revert "i added a second motor"
authoriefomit <timofei.stem@gmail.com>
Wed, 15 Apr 2026 01:08:00 +0000 (18:08 -0700)
committeriefomit <timofei.stem@gmail.com>
Wed, 15 Apr 2026 01:08:00 +0000 (18:08 -0700)
This reverts commit 99f8d53ce1ff28b2888bdb00d9514b46a48b6728.

src/main/java/frc/robot/subsystems/spindexer/Spindexer.java

index 4ba03c2a00d649204a8ea9f664042483b2083eb9..e9cb913d10c9ece92e084a7c97040ffd93f90231 100644 (file)
@@ -14,9 +14,7 @@ import frc.robot.constants.Constants;
 import frc.robot.constants.IdConstants;
 
 public class Spindexer extends SubsystemBase implements SpindexerIO {
-    private TalonFX motorOne = new TalonFX(IdConstants.SPINDEXER_ID, Constants.CANIVORE_SUB);
-    private TalonFX motorTwo = new TalonFX(67, Constants.CANIVORE_SUB);
-
+    private TalonFX motor = new TalonFX(IdConstants.SPINDEXER_ID, Constants.CANIVORE_SUB);
 
     private double power = 0.0;
     public int ballCount = 0;
@@ -37,8 +35,7 @@ public class Spindexer extends SubsystemBase implements SpindexerIO {
         limitConfig.StatorCurrentLimitEnable = true;
         limitConfig.SupplyCurrentLowerLimit = SpindexerConstants.currentLimit;
         limitConfig.SupplyCurrentLowerTime = 1.5;
-        motorOne.getConfigurator().apply(limitConfig);
-        motorTwo.getConfigurator().apply(limitConfig);
+        motor.getConfigurator().apply(limitConfig);
 
         if (!Constants.DISABLE_SMART_DASHBOARD) {
             SmartDashboard.putData("Spindexer Run Forward", new InstantCommand(() -> maxSpindexer()));
@@ -63,25 +60,24 @@ public class Spindexer extends SubsystemBase implements SpindexerIO {
         Logger.processInputs("Spindexer", inputs);
 
         if (resetPos == null) {
-            motorOne.setPosition(0.1 * gearRatio);
-            motorTwo.setPosition(0.1 * gearRatio);
-            resetPos = (motorOne.getPosition().getValueAsDouble() / gearRatio) % 1.0;
+            motor.setPosition(0.1 * gearRatio);
+            resetPos = (motor.getPosition().getValueAsDouble() / gearRatio) % 1.0;
             resetPID.reset();
         }
 
         if (state == SpindexerState.MAX) {
-            setMotors(SpindexerConstants.spindexerMaxPower);
+            motor.setControl(new DutyCycleOut(SpindexerConstants.spindexerMaxPower).withEnableFOC(true));
             reversing = false;
         } else if (state == SpindexerState.REVERSE) {
-            setMotors(SpindexerConstants.spindexerReversePower);
+            motor.setControl(new DutyCycleOut(SpindexerConstants.spindexerReversePower).withEnableFOC(true));
             reversing = true;
         } else if (state == SpindexerState.STOPPED) {
-            setMotors(0.0);
+            motor.setControl(new DutyCycleOut(0.0).withEnableFOC(true));
             reversing = false;
         } else if (state == SpindexerState.RESET && resetPos != null) {
-            setMotors(resetPID.calculate((motorOne.getPosition().getValueAsDouble() / gearRatio) % 1.0, resetPos));
+            motor.setControl(new DutyCycleOut(resetPID.calculate((motor.getPosition().getValueAsDouble() / gearRatio) % 1.0, resetPos)).withEnableFOC(true));
         } else {
-            setMotors(power);
+            motor.setControl(new DutyCycleOut(power).withEnableFOC(true));
             reversing = false;
         }
 
@@ -106,11 +102,6 @@ public class Spindexer extends SubsystemBase implements SpindexerIO {
         }
     }
 
-    public void setMotors(double value) {
-        motorOne.setControl(new DutyCycleOut(value).withEnableFOC(true));
-        motorTwo.setControl(new DutyCycleOut(value).withEnableFOC(true));
-    }
-
     public void maxSpindexer() {
         state = SpindexerState.MAX;
     }