The shooter subsystem is much simpler than the drive system of a swerve drive motor. Basically you have one motor which spins and shoots the ball. You will need to control the speed of this motor via a PID loop.
Here are the pin ids you will need to configure the motor and it’s encoder:
1 2 3 4 5 |
private static final int k_PWMPin = Device.M3_2_PWM; private static final int k_DIRPin = Device.M3_2_DIR; private static final int k_EncIntPin = Device.Q4_INT; private static final int k_EncDirPin = Device.Q4_DIR; private static final int k_I2CAddr = 5; |
In tuned my shooter at 90% full speed and here is my result:
And my final PID values were:
1 2 3 4 5 |
public static final double k_maxSpeed = 1600; public static final double k_f = 1.0 / k_maxSpeed; public static final double k_p = 0.002; public static final double k_i = 0.0005; public static final double k_iZone = 50; |
You should create a SpinupCommand which you can use to start the spinner in preparation for shooting.