I thought I'd report some troubles we found with the pid controller code while we're waiting for our regional.
We wanted to use the PIDController class to control a Jaguar for rate control. (And yes, if we'd done CAN protocol, we wouldn't need this, but we're not that cool a team...yet).
But it seems to me that the current code really does not work well for rate control.
The Screen Steps Live documentation for using the PIDController to govern a rate:
http://wpilib.screenstepslive.com/s/...rs-pid-control
seems to suggest that the 'feed forward' term will help. But kF is just a constant offset. We were not able to get any kind of PID tuning that was workable just using that.
We ended up wrapping the Jaguar class with another class that implemented PIDWrite as a delta, not an absolute, and that gave us reasonable results, and also seemed to be a more theoretically correct implementation. (My PID experts insist that the goal of PID code should be to drive error to 0, not to have an I term that provides a perpetual error correction).
Also, the OnTarget() method consistently crashed for us; my guess is that the use of GetError(), and the doubled critical sections cause that crash.
Hope this helps someone else.
Cheers,
Jeremy