We tried maintaining a consistent flywheel speed using the Talon SRX’s built in PIDF velocity control mode. Using the software reference manual, we calculated the feedforward gain correctly, but the flywheel always spun at the wrong RPM, around 1500 RPM below the target. That was when the Talon SRX was in brake mode. Later on, I realized that the Talon SRX was in brake mode and switched it to coast because I read somewhere here that flywheels are supposed to be on coast. After doing that, the flywheel worked as intended when in coast mode.
My question is, why does brake mode mess up the Talon SRX’s PIDF velocity control mode?
We’ve been running Talon PIDF control since the preseason, and have not experienced this - in fact, as far as we can tell, break/coast mode makes absolutely no difference (we’ve run a flywheel with both and seen effectively no difference in the resulting velocity profiles).
It does not make sense for it to make a significant difference, either - remember, brake/coast mode only makes a difference when the commanded output is precisely 0. This is almost never the case if you are running PIDF control - it might happen in some edge cases if you call configMaxOutputVoltage to prevent the motor controller from ever commanding a reverse voltage and your control loop has a very big proportional gain, but it shouldn’t have an effect in the vast majority of cases.
The results you have sound similar to what would be expected (and I have read has occurred) when using bang-bang with the controller in brake mode. In case you are not familiar with it, bang-bang is a method of (usually speed) control in which the applied voltage is either 100% (if too slow) or 0% (if fast enough or too fast). If you run PID with a very large value for P*, you will get essentially bang-bang. To see if this is your issue, make a log of your motor’s “set voltage” and see if it goes quickly from 100% to 0% and back. A “proper” PID will settle on an intermediate value at low/no load, and make brake/coast inconsequential.