]> git.mxchange.org Git - flightgear.git/commit
Roy Vegard Ovesen:
authorehofman <ehofman>
Thu, 14 Oct 2004 09:19:44 +0000 (09:19 +0000)
committerehofman <ehofman>
Thu, 14 Oct 2004 09:19:44 +0000 (09:19 +0000)
commitfa7f2468c29640326b87d4934b774c031b19baec
treec8c96b557b2f78652ce7c0db23f9b75c3f5522d2
parentc72e6e281e9c5fda20d0f2509367ef27f9e49df0
Roy Vegard Ovesen:

I've added some digital filters to the autopilot. They are all low-pass
filters that filter away high frequency signals/noise. There are 4 different
filters:

1. Exponential - The algorithm is essentially the same as the one used in the
   fgGetLowPass() function.

2. Double exponential - Two exponential filters in series. This filter has a
   "steeper" frequency response curve. It filters "better" than the single
   exponential.

3. Moving average - Averages a number of inputs.

4. Noise spike - limits the amount that the output value can change from one
   sample to the next.

Filters 1 and 2 are characterised by it's filter-time in seconds. For filter 3
you have to set the number of input samples to average over. For filter 4 you
set the maximum allowed rate of change as [1/s]. Since the sampling interval
(dt) isn't constant we have to calculate the maximum allowed change for every
update.

Example of a double exponential filter with filter time 0.1 seconds, that is
1/0.1 = 10 Hz.

  <filter>
    <name>pressure-rate-filter</name>
    <debug>true</debug>
    <type>double-exponential</type>
    <input>/autopilot/internal/pressure-rate</input>
    <output>/autopilot/internal/filtered-pressure-rate</output>
    <filter-time>0.1</filter-time>
  </filter>

This would go in the autopilot configuration file.

I've also removed the filtering of the "pressure-rate" helper value, use the
new filters if you want to filter it!  ;-)
src/Autopilot/xmlauto.cxx
src/Autopilot/xmlauto.hxx