From: Torsten Dreyer Date: Mon, 31 Dec 2012 20:27:13 +0000 (+0100) Subject: Autopilot: initialize the derivative filter X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fcf40ec6a80e8e961250f63807172abdb0113cc8;p=flightgear.git Autopilot: initialize the derivative filter Dont let the derivative filter emit a spike on init or reset if the input value is non-zero. This is a potential fix for #973. --- diff --git a/src/Autopilot/digitalfilter.cxx b/src/Autopilot/digitalfilter.cxx index 26377e131..adff0480a 100644 --- a/src/Autopilot/digitalfilter.cxx +++ b/src/Autopilot/digitalfilter.cxx @@ -75,6 +75,7 @@ class DerivativeFilterImplementation : public GainFilterImplementation { public: DerivativeFilterImplementation(); double compute( double dt, double input ); + virtual void initialize( double output ); }; class ExponentialFilterImplementation : public GainFilterImplementation { @@ -180,6 +181,12 @@ DerivativeFilterImplementation::DerivativeFilterImplementation() : { } +void DerivativeFilterImplementation::initialize( double output ) +{ + _input_1 = output; +} + + bool DerivativeFilterImplementation::configure( const std::string & nodeName, SGPropertyNode_ptr configNode ) { if( GainFilterImplementation::configure( nodeName, configNode ) )