On Mon, Apr 14, 2008 at 11:29 AM, LeeE wrote:
> Oops - meant an exponential filter - seems to work ok, except for
> the inevitable glitch between 360/0 deg (I'm using
> indicated-track-true-deg) but then it resolves in 0.45 sec, which
> isn't too bad. The lag affected a couple of controllers but they
> were easily re-tuned.
So how do you filter/average a heading? I had to think about this on my
trip at sea for one of our applications. I came up with a scheme that
actually hasn't been well tested; does anyone see any holes in this?
Let's say I want to do a simple moving average ... so the new value is
(let's say) 9 parts the previous filtered value + 1 part of the latest
sensor reading. Doing that as a simple average though will glitch if your
values are coming in around 0/360.
So instead I looked at the (signed) angular difference between the current
filter value and the current sensor reading and normalized that to the -180
to +180 range. Then the new filter value is computed as the old filter
value plus 1/10 of this difference.
I think that is equivalent. But before I crash any airplanes, can anyone
poke any holes in my approach?
Thanks,
Curt.
--
Curtis Olson: http://baron.flightgear.org/~curt/
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel