Follower Mode
The Thrifty Nova supports follower mode, allowing one motor controller to mirror the behavior of another. This is useful for mechanisms that need multiple synchronized motors, like a drive train or elevator.
Basic Usage
To make a motor follow another:
// Create two motor controllers
ThriftyNova leader = new ThriftyNova(1); // CAN ID 1
ThriftyNova follower = new ThriftyNova(2); // CAN ID 2
// Make motor 2 follow motor 1
follower.follow(1); // Pass the CAN ID of the leader
Configuration Example
Followers can be configured like any other motor. Here's a typical setup for a drive train:
ThriftyNova leftLeader = new ThriftyNova(1)
.setBrakeMode(true)
.setMaxOutput(1.0);
ThriftyNova leftFollower = new ThriftyNova(2)
.setBrakeMode(true) // Match leader's brake mode
.setMaxOutput(1.0) // Match leader's max output
.setInverted(false) // Match leader's inversion
.follow(leftLeader.getDeviceID()); // Follow left leader
Important Notes
The follower will mirror whatever control mode the leader is using (percent output, position, velocity)
Follower updates depend on the fault status frame rate - slower rates mean slower follower updates
A motor can only follow one leader at a time
If you call other control methods (like
setPercent()
) on a follower, it will stop following
Error Handling
Like other configurations, you can check if setting up follower mode failed:
if (motor.hasError(Error.SET_FOLLOWER_ID)) {
System.out.println("Failed to set up follower mode!");
}
Last updated
Was this helpful?