]> git.mxchange.org Git - flightgear.git/commitdiff
Jim Wilson:
authorehofman <ehofman>
Fri, 26 Sep 2003 16:58:15 +0000 (16:58 +0000)
committerehofman <ehofman>
Fri, 26 Sep 2003 16:58:15 +0000 (16:58 +0000)
This has been on my local copy for a while (well tested :-))
It fixes a problem with the auto throttle jumping around needlessly.  Adjustments are calculated based on the last calculated autothrottle setting rather than reading the throttle setting from the property tree.

src/Autopilot/newauto.cxx
src/Autopilot/newauto.hxx

index 5c2109ecd430dd8549ac677b62de261d97c36f86..81708ff2aac6a7f2326267087dfce59d29b058c6 100644 (file)
@@ -903,17 +903,17 @@ FGAutopilot::update (double dt)
        total_adj = (1.0 - throttle_integral->getFloatValue()) * prop_adj + 
                                      throttle_integral->getFloatValue() * int_adj;
 
-                      total_adj = current_throttle->getFloatValue() + total_adj;
+                      current_ap_throttle = current_ap_throttle + total_adj;
 
-       if ( total_adj > 1.0 ) {
-           total_adj = 1.0;
+       if ( current_ap_throttle > 1.0 ) {
+           current_ap_throttle = 1.0;
        }
-       else if ( total_adj < 0.0 ) {
-           total_adj = 0.0;
+       else if ( current_ap_throttle < 0.0 ) {
+           current_ap_throttle = 0.0;
        }
 
        globals->get_controls()->set_throttle( FGControls::ALL_ENGINES,
-                                              total_adj );
+                                              current_ap_throttle );
     }
 
 #ifdef THIS_CODE_IS_NOT_USED
@@ -1186,7 +1186,9 @@ void FGAutopilot::set_AutoThrottleEnabled( bool value ) {
         if (TargetSpeed < 0.0001) {
           TargetSpeed = fgGetDouble("/velocities/airspeed-kt");
         }
-       speed_error_accum = 0.0;
+        speed_error_accum = 0.0;
+        // initialize autothrottle at current control setting;
+        current_ap_throttle = current_throttle->getFloatValue();
     }
 
     update_old_control_values();
index 49e88c4516e7485d62665cf83d5b03f7459cec84..467847f1813a3c9e0dce54e15efe596760d1577d 100644 (file)
@@ -85,6 +85,7 @@ private:
     double climb_error_accum;   // climb error accumulator (for GS)
     double speed_error_accum;   // speed error accumulator
 
+    double current_ap_throttle;  // current ap stored throttle setting used to set all engines
     double previous_speed;  // used to detect acceleration rate
 
     double TargetSlope;         // the glide slope hold value