1
0
Fork 0

Smooth out the time-to-intercept radial computation so it's a bit more useful.

This commit is contained in:
curt 2009-09-30 20:53:22 +00:00 committed by Tim Moore
parent 4ec0d64c50
commit 28b847da09
2 changed files with 4 additions and 1 deletions

View file

@ -137,6 +137,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
last_x(0.0), last_x(0.0),
last_loc_dist(0.0), last_loc_dist(0.0),
last_xtrack_error(0.0), last_xtrack_error(0.0),
xrate_ms(0.0),
_localizerWidth(5.0), _localizerWidth(5.0),
_name(node->getStringValue("name", "nav")), _name(node->getStringValue("name", "nav")),
_num(node->getIntValue("number", 0)), _num(node->getIntValue("number", 0)),
@ -686,7 +687,8 @@ void FGNavRadio::updateCDI(double dt)
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
double t = 0.0; double t = 0.0;
if ( inrange && cdi_serviceable ) { if ( inrange && cdi_serviceable ) {
double xrate_ms = (last_xtrack_error - _cdiCrossTrackErrorM) / dt; double cur_rate = (last_xtrack_error - _cdiCrossTrackErrorM) / dt;
xrate_ms = 0.99 * xrate_ms + 0.01 * cur_rate;
if ( fabs(xrate_ms) > 0.00001 ) { if ( fabs(xrate_ms) > 0.00001 ) {
t = _cdiCrossTrackErrorM / xrate_ms; t = _cdiCrossTrackErrorM / xrate_ms;
} else { } else {

View file

@ -135,6 +135,7 @@ class FGNavRadio : public SGSubsystem
double last_x; double last_x;
double last_loc_dist; double last_loc_dist;
double last_xtrack_error; double last_xtrack_error;
double xrate_ms;
double _localizerWidth; // cached localizer width in degrees double _localizerWidth; // cached localizer width in degrees
string _name; string _name;