![]() |
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Quote:
I'd like, when I find the time, to run some actual tests and find out what the practical difference in performance is between the two approaches in FRC contexts. I know the WPILib implementation runs in its own thread and the loop frequency can be set manually - do you know what the fastest speed it can run is? |
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Quote:
As you get faster and faster, you'll start to see noise show up in the velocity measurement due to the discrete differentiation. When that starts to happen, you'll need to add complexity to filter it out. |
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Quote:
|
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Quote:
The math for an observer boils down to X_hat(n + 1) = A X_hat(n) + B u(n) + L * (Y - C X_hat(n)) A and B are derived from your model. C is the mapping from your state to your sensor readings. X_hat is the estimate of the state. Y is your sensor measurement, and L is the feedback gain that you get from tuning the filter. I'm happy to go into more details if you are interested, and our code to implement this is publically available. |
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Quote:
For example, to find the gains for the single pole IIR filter, we discretized the transfer function Y(s)/X(s) = 1/(1+s*tau) where tau is the time constant. The cutoff frequency can be obtained with f_c = 1/(2*pi*tau). I should warn you we tried using the moving average filter with a buffer length of 50 in the velocity PID controller (instead of a std::queue of length 50) and it failed WPILib's integration tests. I haven't had time to determine why, but my current guess is floating point precision errors from adding so many values together. More testing is needed. |
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Note that the Talon SRX does velocity filtering for you (IIRC a 64-tap FIR filter, where each value is the change in position over the preceding 100 milliseconds, and the filter is updated at 1KHz).
|
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Quote:
|
Re: Velocity PID(F) Best Practices - To Integrate, or Not To Integrate?
Quote:
|
| All times are GMT -5. The time now is 04:48 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi