]> git.mxchange.org Git - flightgear.git/commitdiff
Some xml-autopilot tuning
authorTorsten Dreyer <Torsten@t3r.de>
Wed, 15 Feb 2012 13:59:10 +0000 (14:59 +0100)
committerTorsten Dreyer <Torsten@t3r.de>
Wed, 15 Feb 2012 13:59:10 +0000 (14:59 +0100)
- Add update-interval-secs to the entire autopilot
- cache min/max values in InputValue
- a little more relaxed "equals zero" checking in the NoiseSpikeFilter

src/Autopilot/autopilotgroup.cxx
src/Autopilot/digitalfilter.cxx
src/Autopilot/inputvalue.cxx

index a856c342fb8d0d4f2bcbbcb49913074eea97b45e..8cf389f8e2d85fb4e6da3d4a8d0a7ba23cc0a353 100644 (file)
@@ -65,7 +65,9 @@ void FGXMLAutopilotGroupImplementation::addAutopilot( const std::string & name,
     }
     FGXMLAutopilot::Autopilot * ap = new FGXMLAutopilot::Autopilot( apNode, config );
     ap->set_name( name );
-    set_subsystem( name, ap );
+
+    double updateInterval = config->getDoubleValue( "update-interval-secs", 0.0 );
+    set_subsystem( name, ap, updateInterval );
     _autopilotNames.push_back( name );
 }
 
index d73a2585e150d062bc87a70e8042148cb424a26c..d3b55cb4d3b41ca599c7fdd93e20e8f017597e25 100644 (file)
@@ -251,7 +251,7 @@ void NoiseSpikeFilterImplementation::initialize( double output )
 double NoiseSpikeFilterImplementation::compute(  double dt, double input )
 {
   double delta = input - _output_1;
-  if( delta == 0.0 ) return input; // trivial
+  if( fabs(delta) <= SGLimitsd::min() ) return input; // trivial
 
   double maxChange = _rateOfChangeInput.get_value() * dt;
   const PeriodicalValue * periodical = _digitalFilter->getPeriodicalValue();
index d097cef9152e95cbcfd31e207b7614313e344d9c..6fd686b33cf603bd63d155278bfeb1b0195b62cf 100644 (file)
@@ -41,8 +41,11 @@ double PeriodicalValue::normalize( double value ) const
 
 double PeriodicalValue::normalizeSymmetric( double value ) const
 {
-  value = SGMiscd::normalizePeriodic( minPeriod->get_value(), maxPeriod->get_value(), value );
-  double width_2 = (maxPeriod->get_value() - minPeriod->get_value())/2;
+  double minValue = minPeriod->get_value();
+  double maxValue = maxPeriod->get_value();
+  
+  value = SGMiscd::normalizePeriodic( minValue, maxValue, value );
+  double width_2 = (maxValue - minValue)/2;
   return value > width_2 ? width_2 - value : value;
 }