From 71c83c4de758ded55087e300281e5d806fe0a226 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 12 Feb 2004 22:35:29 +0000 Subject: [PATCH] Initialize autopilot output to start at current manual control position to [hopefully] make autopilot activation less "dramatic." --- src/Autopilot/xmlauto.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Autopilot/xmlauto.cxx b/src/Autopilot/xmlauto.cxx index 88c0f9984..d682f2b79 100644 --- a/src/Autopilot/xmlauto.cxx +++ b/src/Autopilot/xmlauto.cxx @@ -212,6 +212,15 @@ void FGPIDController::update( double dt ) { } if (enable_prop != NULL && enable_prop->getStringValue() == enable_value) { + if ( !enabled ) { + // first time being enabled, seed u_n with current + // property tree value + u_n = output_list[0]->getDoubleValue(); + // and clip + if ( u_n < u_min ) { u_n = u_min; } + if ( u_n > u_max ) { u_n = u_max; } + u_n_1 = u_n; + } enabled = true; } else { enabled = false; -- 2.39.5