*/
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;
}
// Set control with feedforward
motor.setControl(mmVoltageRequest
.withPosition(motorGoalRotations)
- .withFeedForward(velocityCompensation));
+ .withFeedForward(velocityCompensation)
+ .withEnableFOC(true));
}
if (!Constants.DISABLE_LOGGING) {
}
// 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);
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;
}
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;
}
// Sets motor control with feedforward
motor.setControl(mmVoltageRequest
.withPosition(motorGoalRotations)
- .withFeedForward(robotTurnCompensation));
+ .withFeedForward(robotTurnCompensation)
+ .withEnableFOC(true));
}
if (!Constants.DISABLE_LOGGING) {