Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit 9ccdf18

Browse files
authored
secondary intake motor (#72)
* Second intake motor * spotless
1 parent 1fb3ecb commit 9ccdf18

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/main/java/frc/robot/subsystems/intake/IntakeConstants.java

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
public final class IntakeConstants {
1515
/* CAN */
1616
public static final int kIntakeMotorID = 33;
17+
public static final int kSecondaryIntakeMotorID = 999;
1718

1819
public static final double kPassthroughIntakeVoltage = -8;
1920
public static final double kIntakeIntakeVoltage = 12;

src/main/java/frc/robot/subsystems/intake/IntakeIOTalonFX.java

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import com.ctre.phoenix6.BaseStatusSignal;
1111
import com.ctre.phoenix6.StatusSignal;
12+
import com.ctre.phoenix6.controls.Follower;
1213
import com.ctre.phoenix6.controls.MotionMagicVelocityVoltage;
1314
import com.ctre.phoenix6.controls.NeutralOut;
1415
import com.ctre.phoenix6.controls.VelocityVoltage;
@@ -25,6 +26,9 @@ public class IntakeIOTalonFX implements IntakeIO {
2526
new MotionMagicVelocityVoltage(0).withSlot(0);
2627
private final VoltageOut intakeVoltageReq = new VoltageOut(0);
2728

29+
private final TalonFX secondaryIntakeMotor = new TalonFX(IntakeConstants.kSecondaryIntakeMotorID);
30+
final Follower secondaryIntakeFollowReq = new Follower(intakeMotor.getDeviceID(), false);
31+
2832
private final StatusSignal<Double> intakeMotorVoltage = intakeMotor.getMotorVoltage();
2933
private final StatusSignal<Double> intakeMotorVelocity = intakeMotor.getVelocity();
3034
private final StatusSignal<Double> intakeMotorStatorCurrent = intakeMotor.getStatorCurrent();
@@ -56,6 +60,11 @@ public IntakeIOTalonFX() {
5660
PhoenixUtil.checkErrorAndRetry(() -> intakeMotor.getConfigurator().refresh(motorConfig));
5761
TalonUtil.applyAndCheckConfiguration(intakeMotor, motorConfig);
5862

63+
var secondaryMotorConfig = IntakeConstants.intakeMotorConfig; // Same as intake motor.
64+
PhoenixUtil.checkErrorAndRetry(
65+
() -> secondaryIntakeMotor.getConfigurator().refresh(secondaryMotorConfig));
66+
TalonUtil.applyAndCheckConfiguration(secondaryIntakeMotor, secondaryMotorConfig);
67+
5968
var passthroughConfig = IntakeConstants.passthroughMotorConfig;
6069
PhoenixUtil.checkErrorAndRetry(
6170
() -> passthroughMotor.getConfigurator().refresh(passthroughConfig));
@@ -77,6 +86,7 @@ public IntakeIOTalonFX() {
7786
passthroughMotorReferenceSlope);
7887
intakeMotor.optimizeBusUtilization();
7988
passthroughMotor.optimizeBusUtilization();
89+
secondaryIntakeMotor.setControl(secondaryIntakeFollowReq);
8090
}
8191

8292
@Override

0 commit comments

Comments
 (0)