9
9
10
10
import com .ctre .phoenix6 .BaseStatusSignal ;
11
11
import com .ctre .phoenix6 .StatusSignal ;
12
+ import com .ctre .phoenix6 .controls .Follower ;
12
13
import com .ctre .phoenix6 .controls .MotionMagicVelocityVoltage ;
13
14
import com .ctre .phoenix6 .controls .NeutralOut ;
14
15
import com .ctre .phoenix6 .controls .VelocityVoltage ;
@@ -25,6 +26,9 @@ public class IntakeIOTalonFX implements IntakeIO {
25
26
new MotionMagicVelocityVoltage (0 ).withSlot (0 );
26
27
private final VoltageOut intakeVoltageReq = new VoltageOut (0 );
27
28
29
+ private final TalonFX secondaryIntakeMotor = new TalonFX (IntakeConstants .kSecondaryIntakeMotorID );
30
+ final Follower secondaryIntakeFollowReq = new Follower (intakeMotor .getDeviceID (), false );
31
+
28
32
private final StatusSignal <Double > intakeMotorVoltage = intakeMotor .getMotorVoltage ();
29
33
private final StatusSignal <Double > intakeMotorVelocity = intakeMotor .getVelocity ();
30
34
private final StatusSignal <Double > intakeMotorStatorCurrent = intakeMotor .getStatorCurrent ();
@@ -56,6 +60,11 @@ public IntakeIOTalonFX() {
56
60
PhoenixUtil .checkErrorAndRetry (() -> intakeMotor .getConfigurator ().refresh (motorConfig ));
57
61
TalonUtil .applyAndCheckConfiguration (intakeMotor , motorConfig );
58
62
63
+ var secondaryMotorConfig = IntakeConstants .intakeMotorConfig ; // Same as intake motor.
64
+ PhoenixUtil .checkErrorAndRetry (
65
+ () -> secondaryIntakeMotor .getConfigurator ().refresh (secondaryMotorConfig ));
66
+ TalonUtil .applyAndCheckConfiguration (secondaryIntakeMotor , secondaryMotorConfig );
67
+
59
68
var passthroughConfig = IntakeConstants .passthroughMotorConfig ;
60
69
PhoenixUtil .checkErrorAndRetry (
61
70
() -> passthroughMotor .getConfigurator ().refresh (passthroughConfig ));
@@ -77,6 +86,7 @@ public IntakeIOTalonFX() {
77
86
passthroughMotorReferenceSlope );
78
87
intakeMotor .optimizeBusUtilization ();
79
88
passthroughMotor .optimizeBusUtilization ();
89
+ secondaryIntakeMotor .setControl (secondaryIntakeFollowReq );
80
90
}
81
91
82
92
@ Override
0 commit comments