From: ThorstenB Date: Fri, 21 Sep 2012 13:59:04 +0000 (+0200) Subject: gyro heading indicator: realism when spin is low X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=002cada172fb80fffe351758870e921d8945b5d5;p=flightgear.git gyro heading indicator: realism when spin is low Low spin or switched off gyros result in the indicator being stuck. When the gyros are repowered, the indication doesn't jump to the correct indication, but keeps the current error. --- diff --git a/src/Instrumentation/heading_indicator_dg.cxx b/src/Instrumentation/heading_indicator_dg.cxx index 3f64a0c82..52fe89834 100644 --- a/src/Instrumentation/heading_indicator_dg.cxx +++ b/src/Instrumentation/heading_indicator_dg.cxx @@ -148,12 +148,17 @@ HeadingIndicatorDG::update (double dt) error += 0.033 * g * dt; } - _error_node->setDoubleValue(error); - // Next, calculate the indicated heading, // introducing errors. - double factor = 100 * (spin * spin * spin * spin * spin * spin); + double factor = spin * spin * spin * spin * spin * spin; double heading = _heading_in_node->getDoubleValue(); + if (spin < 0.9) + { + // when gyro spin is low, then any heading change results in + // increasing the error (spin=0 => indicator is stuck) + error += (_last_heading_deg - heading)*(1-factor); + } + _error_node->setDoubleValue(error); // Now, we have to get the current // heading and the last heading into @@ -162,8 +167,7 @@ HeadingIndicatorDG::update (double dt) _last_heading_deg += 360; while ((heading - _last_heading_deg) < -180) _last_heading_deg -= 360; - - heading = fgGetLowPass(_last_heading_deg, heading, dt * factor); + heading = fgGetLowPass(_last_heading_deg, heading, dt * factor * 100); _last_heading_deg = heading; heading += offset + align + error;