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.
This graph shows the filter startup (you can see the initial value is zero, and it ramps up).


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?
Posted by: John | April 11, 2006 08:57 AM
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.
Posted by: Rick | April 11, 2006 09:07 AM