« Monday: Round 1 Winners! | Main | Gain Constant Kp »

Mon, April 10, 2006 9:03 PM

Digital Filtering

I wrote a simple 8-tap moving average, and some code to spit out values for the left-minus-right error, filtered error, and steering command. The steering command range is very small, so it doesn't show up like much on these graphs. The graphs are over time, with each data point coming in at 200 Hz, or every 0.005 s.

Click each graph for a larger version.

This graph shows a section from 1000 to 1500.

ThFilterGraph.png

This graph shows the filter startup (you can see the initial value is zero, and it ramps up).

ThFilterStartupGraph.png

Comments

Looks great Rick, it really smooths out the error term! Don't forget that the 8-tap moving average has a 4-sample group delay. I think we can also optimize the filter coefficients for much better performance, does your code allow for that?

No, it's strictly a simple moving-average. A big advantage of a simple moving-average is that if you use windows that are powers of two in size, then the division at the end become a simple right-shift, much faster than a real divide.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Please enter the security code you see here