Closed Loop Control with Followers

Team 3468 is planning to use a left/right flywheel launcher for our lemons. We’d like to use encoders on these flywheels so we can use Closed Loop Control and set a velocity (and track it for consistently) instead of just using percent voltage output.

One question we had, and couldn’t find a straight answer to in the docs, was would this work if we had one of the motor controllers (say the right) be a follower of the left? If this would work, to what degree? Would the follower be able to use its own encoder independently to get to the specified velocity, or just follow the output from the master. Would it function differently between the Spark Max and the TalonSRX? Also, not that we planned to try this particular configuration, but what if you wanted a VictorSPX as the follower? I’d assume it would just track the output from the Talon if this would work at all.

Anyway, if anyone has tried this, or just knows more about the matter, your input would be much appreciated!

My understanding (albeit a bit naive) of how the follower functionality works, is that it simply makes one controller mirror the output of another. In your case, the follower wouldn’t do any closed-loop control of it’s own, but would act as though it was doing percent-output control based on the output of the master controller.

I’m not certain how this would work with different controllers, but given my description above, I believe it would work.

You certainly can do this with two Talon SRX’s, two Victor SPX’s, or one of each. I would avoid trying to use a follower configuration that mixes Talon/Victors and SPARK MAX’s. I’ve seen posts saying it’s not supported, and here’s what REV says in their release notes:

  • Adds ability to follow Phoenix 4.11 motor controllers
  • Note: This feature depends on the firmware of the Phoenix controllers, and is not controlled by REV. We will do our best to build this functionality, but this is not an officially supported feature.

There are a few things to consider:

  1. Does your follower need to be inverted? It’s not a big deal with the Talons SRX’s and Victor SPX’s, but you need to consider it. follower.setInverted(InvertType.OpposeMaster);
  2. Are your motors physically joined (by a shaft or the same gearbox) so they cannot rotate at a different speed?
  • If they are, you’re pretty much done once you set the follower. You only need an encoder on the master, there is physically no way for them to spin out of sync.
  • If they are not, you’ll need encoders on both sides and you’ll want to look at Differential Sensors. I’m not sure if SPARK MAX has such a function.
2 Likes

Yeah there was definitely no intent to mix Spark Maxes and Talon/Victors. To my knowledge they won’t be linked, that would just make it too easy for programming, lol. Thanks for all the info though, very helpful!

Will have to look through the docs again then to see if there is an equivalent for Spark Max’s.