Heading-Indicator DG normalisation fix
From Benedikt Hallinger
This commit is contained in:
parent
d35a28647a
commit
b32c33fc72
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue