Will the follower control mode built into the CTRE Talon SRX library make the motors have the same speed, even if one is slower due to wear? If not, is there some built-in way of making two motors go the exact same speed (it will affect the spin on the ball of our shooter and change our trajectory significantly) using encoders maybe? Or would I need to write a control loop myself for this?
Talon srx controller following mode won’t make sure the motors are spinning at the same speed, you need a control loop for that. However, the talon srx’s can run control loops on the motor controller itself, so you won’t have to program it from scratch., but you still have to tune it.
Generally, the best way to have two motors spinning at the same speed is to mechanically connect them. If you can’t do that for some reason, your best option is probably to run a velocity control loop on both Talons with the same setpoint.
Usually when you are using the follower mode, there are two conditions. Either
- you don’t need accurate control of the motors or
- you have them in the same gearbox with encoder, outputting to a single point.
if your option is 2, you want to have pid on your main motor while having the second one to follow the main motor.
If you have 2 separate motor and want to make them run at the same speed, you will need separate encoder and pid for the two motors.
The follower mode simply has the following controller have the same throttle setting as the leader. As noted above, if they’re not mechanically linked but you want them the same speed, you will need something to tell you which is going faster and preferably by how much. The obvious solution is to put encoders (or some other way to measure speed) on each system.
Yeah, I didn’t know if there was some built in method where I could give it an encoder object to work with.
You don’t need to write your own control loop, but you definitely will require sensors. At a minimum you need an encoder from each gear box (or mechanism) plugged directly into the Talon.
Then, in the case of the shooter, you can setup a Velocity PID control loop running on the talons as the primary, and try to use an Auxiliary PID loop that is running against the difference between the two sensors to try and balance them out.