Quote:
Originally Posted by xraymypanda
As far as I know and recall, GetRate() returns data per second.
|
GetRate() works great for velocity control... in fact in my tests it works better for noise control than using raw/time way.
In our code we work with radians per second as the preferred unit of measurment, and we do not need to normalize to use PID... I did however rewrite the PID class from 2011 to something more direct that does not use any threading. Instead the main loop is timed and each time change call uses a delta time parameter (double in units of seconds). And this gets factored in for the error computation. This will take care of uneven time-slices which is why the threading was used. Finally on the averaging... don't use a smooth blend type of average because this will introduce extra latency on your actual time. Instead use either a priority queue or a fixed number averager (or both) also use the kalman filter... I use all three of these... to combat the worst case encoder noisy-ness... like when the shaking of the motor caused the encoder to bust out of its casing and lose values per revolution.
The re-written PID controller source is here:
http://www.termstech.com/files/Archi...Controller.zip
The averagers are also in here in the Misc.h file