On Saturday 17 Sep 2005 15:43, Paul Kahler wrote: > On Fri, 2005-09-16 at 04:41 +0100, Lee Elliott wrote: > > Hello List, > > > > I think there's a small bug in the moving-average filter in > > ... > > > xmlauto.cxx > > else if (filterType == movingAverage) > > { > > output.push_front(output[0] + > > (input[0] - input.back()) / > > (samples - 1)); > > unsigned int i; > > for ( i = 0; i < output_list.size(); ++i ) { > > output_list[i]->setDoubleValue( output[0] ); > > } > > output.resize(1); > > } > > I'm not trying to flame, but why would you be using a moving > average filter? That's the most complicated filter I've ever > seen - it calls other functions! I always liked the simplicity > of a low pass filter: > > output += (measurement - output) * gain; > > Using floats, doubles, or fixed point of course. > > No need to call a function either, just in-line it where you > need it. Want fast convergence on startup? Just sweep the gain > from 1.0 down to whatever the steady state value needs to be. > I bet this is nothing new - it's probably in the code under > "else if (filterType == IIRfilter)" or something. > > So why do people use moving average filters? Why does FGFS? > > Thanks, > Paul
I'm trying them to smooth the input data for agl and nav1 holds. The agl data can be pretty spiky due to terrain/scenery artifacts and 3d buildings/structures and using a moving average filter here reduces the influence of the spikes they produce.. I'm also trying a moving-average filter to smooth the nav1 data at extreme range where the 'signal' is intermittent. ...and talking of agl... I've noticed that the default keyboard command for engaging terrain-following (Ctrl-t) sets /autopilot/locks/altitude to 'terrain-follow' but the autopilot settings dialogue sets it to 'agl-hold' Either one is fine... ;) I also noticed that the agl ladder in the hud now seems to start with the correct offset, so that it reads zero ft at the starting airport, but then tracks the altitude ladder - starting at zero feet alt results in them reading identically. I haven't checked this with different aircraft yet but I'm just going to do a quick check through my cvs archives. LeeE _______________________________________________ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d