Leader follower systems in frc are a crucial part of larger mechanisms, and they’re also quite simple. Conceptually a leader follower system is one in which one motor decides what to do and the other simply follows, hence a leader and a follower motor. To implement this the leader must enable the status signal corresponding to its control output type (DutyCycle, MotorVoltage, TorqueCurrent). The update rate of the status signal determines the update rate of the follower’s output and should be no slower than 20 Hz. Some examples of subsystems that could be leader follower include elevators, shooters, roller floors and large linear extensions.
For more info about the kraken implementation of this system look below
You’ll need two sets of status signals for each motor but only one set of configs that you’ll apply to both motors.
The critical line is the control mode for the follower motor written below. This line instructs the follower to do the whole following shabang
followerTalon.setControl(Follower(Constants.Shooter.LEADER_MOTOR_ID, MotorAlignmentValue.Opposed))
PAY ATTENTION TO THE ALIGNMENT VALUE. In some mechanisms you’ll want them to be opposed meaning when one spins forward the other spins backwards. In other systems you’ll want them both to spin in the same direction. Double check what you write in code against whats in cad. This is important and a stupid mistake to make.
Aside from this and the shared configs everything else in this file should be the same as if you had two independent motors. The same is true for your IO implementation. It is also noteworthy that you can set follower control in phoenix tuner if you happen to be running a prototype or something of that nature.