1
0
Fork 0

Heading-Indicator DG normalisation fix

From Benedikt Hallinger
This commit is contained in:
James Turner 2024-01-29 13:52:44 +00:00
parent d35a28647a
commit b32c33fc72

View file

@ -281,7 +281,11 @@ HeadingIndicatorDG::update (double dt)
error = SGMiscd::normalizePeriodic(-180.0, 180.0, error); error = SGMiscd::normalizePeriodic(-180.0, 180.0, error);
_error_node->setDoubleValue(error); _error_node->setDoubleValue(error);
_last_indicated_heading_dg = SGMiscd::normalizePeriodic(-180.0, 180.0, (heading - _last_indicated_heading_dg)); // Bring heading to the same range as errors for calculation. Otherwise the low-pass filter will
// get confused.
heading = SGMiscd::normalizePeriodic(-180.0, 180.0, heading);
_last_indicated_heading_dg = SGMiscd::normalizePeriodic(-180.0, 180.0, _last_indicated_heading_dg);
heading = fgGetLowPass(_last_indicated_heading_dg, heading, dt * 100 * factor); heading = fgGetLowPass(_last_indicated_heading_dg, heading, dt * 100 * factor);
_last_indicated_heading_dg = heading; _last_indicated_heading_dg = heading;