]> git.taranathan.com Git - FRC2026.git/commitdiff
enable foc on all motors
authoriefomit <timofei.stem@gmail.com>
Tue, 7 Apr 2026 01:48:10 +0000 (18:48 -0700)
committeriefomit <timofei.stem@gmail.com>
Tue, 7 Apr 2026 01:48:10 +0000 (18:48 -0700)
src/main/java/frc/robot/subsystems/Intake/Intake.java
src/main/java/frc/robot/subsystems/hood/Hood.java
src/main/java/frc/robot/subsystems/shooter/Shooter.java
src/main/java/frc/robot/subsystems/spindexer/Spindexer.java
src/main/java/frc/robot/subsystems/turret/Turret.java

index b0eea6670cce58b34b3e789e3b6d3485a76b23ac..d373bb90612707014a3c430c98e1972dcd494699 100644 (file)
@@ -255,8 +255,8 @@ public class Intake extends SubsystemBase implements IntakeIO{
      */
     public void setPosition(double setpoint) {
         double motorRotations = -inchesToRotations(setpoint);
-        rightMotor.setControl(voltageRequest.withPosition(motorRotations));
-        leftMotor.setControl(voltageRequest.withPosition(motorRotations));
+        rightMotor.setControl(voltageRequest.withPosition(motorRotations).withEnableFOC(true));
+        leftMotor.setControl(voltageRequest.withPosition(motorRotations).withEnableFOC(true));
 
         setpointInches = setpoint;
     }
index 102d949df903ab18244f8927fd507e6502b533eb..e0b8bdda4a58be8771689becd0f32936a2f5d904 100644 (file)
@@ -150,7 +150,8 @@ public class Hood extends SubsystemBase implements HoodIO {
                        // Set control with feedforward
                        motor.setControl(mmVoltageRequest
                        .withPosition(motorGoalRotations)
-                       .withFeedForward(velocityCompensation));
+                       .withFeedForward(velocityCompensation)
+                       .withEnableFOC(true));
                }
 
         if (!Constants.DISABLE_LOGGING) {
index fcec2992a63819d83494b318f6d225e59c3b9787..af8cfac5e7b45f1f6135b7ffcabdb436cb04eb63 100644 (file)
@@ -93,8 +93,8 @@ public class Shooter extends SubsystemBase implements ShooterIO {
         }
 
         // Sets the motor control to target velocity
-        shooterMotorLeft.setControl(voltageRequest.withVelocity(targetVelocityRPS));
-        shooterMotorRight.setControl(voltageRequest.withVelocity(targetVelocityRPS));   
+        shooterMotorLeft.setControl(voltageRequest.withVelocity(targetVelocityRPS).withEnableFOC(true));
+        shooterMotorRight.setControl(voltageRequest.withVelocity(targetVelocityRPS).withEnableFOC(true));   
         
         if (!Constants.DISABLE_LOGGING) {
             Logger.recordOutput("Shooter/realVelocity", shooterMotorLeft.getVelocity().getValueAsDouble() * ShooterConstants.SHOOTER_LAUNCH_DIAMETER);
index 4cba8edf1c58b69a2284da2aa40a02241ac0ee1b..36724a735dc689758f13b3aaa604c0101aa18a38 100644 (file)
@@ -1,6 +1,7 @@
 package frc.robot.subsystems.spindexer;
 
 import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
+import com.ctre.phoenix6.controls.DutyCycleOut;
 import com.ctre.phoenix6.hardware.TalonFX;
 
 import org.littletonrobotics.junction.Logger;
@@ -62,18 +63,18 @@ public class Spindexer extends SubsystemBase implements SpindexerIO {
         }
 
         if (state == SpindexerState.MAX) {
-            motor.set(SpindexerConstants.spindexerMaxPower);
+            motor.setControl(new DutyCycleOut(SpindexerConstants.spindexerMaxPower).withEnableFOC(true));
             reversing = false;
         } else if (state == SpindexerState.REVERSE) {
-            motor.set(SpindexerConstants.spindexerReversePower);
+            motor.setControl(new DutyCycleOut(SpindexerConstants.spindexerReversePower).withEnableFOC(true));
             reversing = true;
         } else if (state == SpindexerState.STOPPED) {
-            motor.set(0.0);
+            motor.setControl(new DutyCycleOut(0.0).withEnableFOC(true));
             reversing = false;
         } else if (state == SpindexerState.RESET && resetPos != null) {
-            motor.set(resetPID.calculate((motor.getPosition().getValueAsDouble() / gearRatio) % 1.0, resetPos));
+            motor.setControl(new DutyCycleOut(resetPID.calculate((motor.getPosition().getValueAsDouble() / gearRatio) % 1.0, resetPos)).withEnableFOC(true));
         } else {
-            motor.set(power);
+            motor.setControl(new DutyCycleOut(power).withEnableFOC(true));
             reversing = false;
         }
 
index 626a8ed96d0975213d5734f326816ff2675e9755..3c7d47a281ec1421340b974e4fcb4d395ba39e24 100644 (file)
@@ -216,7 +216,8 @@ public class Turret extends SubsystemBase implements TurretIO{
                        // Sets motor control with feedforward
                        motor.setControl(mmVoltageRequest
                        .withPosition(motorGoalRotations)
-                       .withFeedForward(robotTurnCompensation));
+                       .withFeedForward(robotTurnCompensation)
+                       .withEnableFOC(true));
                }
 
         if (!Constants.DISABLE_LOGGING) {