66import com .ctre .phoenix6 .controls .VoltageOut ;
77import com .ctre .phoenix6 .hardware .TalonFX ;
88import com .ctre .phoenix6 .signals .NeutralModeValue ;
9- import com .revrobotics .CANSparkLowLevel .MotorType ;
10- import com .revrobotics .CANSparkMax ;
119import edu .wpi .first .wpilibj .DigitalInput ;
1210import frc .robot .Constants .IntakeConstants ;
1311import frc .robot .Constants .SensorConstants ;
1412
15- public class IntakeIOSparkMax implements IntakeIO {
13+ public class IntakeIOFalcon implements IntakeIO {
1614
17- private CANSparkMax leftIntake =
18- new CANSparkMax (IntakeConstants .leftIntakeMotorID , MotorType .kBrushless );
19- private CANSparkMax rightIntake =
20- new CANSparkMax (IntakeConstants .rightIntakeMotorID , MotorType .kBrushless );
15+ private TalonFX leftIntake = new TalonFX (IntakeConstants .leftIntakeMotorID );
2116
2217 private TalonFX belt = new TalonFX (IntakeConstants .indexTwoMotorID );
2318
2419 DigitalInput bannerSensor = new DigitalInput (SensorConstants .uptakeSensorPort );
2520
26- public IntakeIOSparkMax () {
27- leftIntake .setSmartCurrentLimit (50 );
28- rightIntake .setSmartCurrentLimit (50 );
29-
21+ public IntakeIOFalcon () {
3022 leftIntake .setInverted (true );
31- rightIntake .setInverted (true );
3223
3324 belt .setInverted (true );
3425
26+ TalonFXConfigurator leftConfig = leftIntake .getConfigurator ();
27+ leftConfig .apply (new MotorOutputConfigs ().withNeutralMode (NeutralModeValue .Coast ));
28+ leftConfig .apply (
29+ new CurrentLimitsConfigs ()
30+ .withStatorCurrentLimit (120 )
31+ .withStatorCurrentLimitEnable (true ));
32+
3533 TalonFXConfigurator beltConfig = belt .getConfigurator ();
3634 beltConfig .apply (new MotorOutputConfigs ().withNeutralMode (NeutralModeValue .Brake ));
3735 beltConfig .apply (
@@ -42,11 +40,8 @@ public IntakeIOSparkMax() {
4240
4341 @ Override
4442 public void updateInputs (IntakeIOInputs inputs ) {
45- inputs .leftIntakeVoltage = leftIntake .getAppliedOutput () * 12 ;
46- inputs .leftIntakeStatorCurrent = leftIntake .getOutputCurrent ();
47-
48- inputs .rightIntakeVoltage = rightIntake .getAppliedOutput () * 12 ;
49- inputs .rightIntakeStatorCurrent = rightIntake .getOutputCurrent ();
43+ inputs .leftIntakeVoltage = leftIntake .getMotorVoltage ().getValueAsDouble ();
44+ inputs .leftIntakeStatorCurrent = leftIntake .getStatorCurrent ().getValueAsDouble ();
5045
5146 inputs .beltVoltage = belt .getMotorVoltage ().getValueAsDouble ();
5247 inputs .beltStatorCurrent = belt .getStatorCurrent ().getValueAsDouble ();
@@ -57,8 +52,7 @@ public void updateInputs(IntakeIOInputs inputs) {
5752
5853 @ Override
5954 public void setIntakeVoltage (double volts ) {
60- leftIntake .set (volts / 12 );
61- rightIntake .set (volts / 12 );
55+ leftIntake .setControl (new VoltageOut (volts ));
6256 }
6357
6458 @ Override
0 commit comments