1
0
Fork 0

Make GPS slaved mode on the navradio slightly more robust. Not done yet.

This commit is contained in:
jmt 2009-10-09 20:16:31 +00:00 committed by Tim Moore
parent 3637482916
commit bde366e0e3
2 changed files with 19 additions and 4 deletions

View file

@ -130,6 +130,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
gps_to_flag_node(NULL),
gps_from_flag_node(NULL),
gps_has_gs_node(NULL),
gps_xtrack_error_nm_node(NULL),
play_count(0),
last_time(0),
target_radial(0.0),
@ -245,7 +246,8 @@ FGNavRadio::init ()
gps_from_flag_node = fgGetNode("/instrumentation/gps/from-flag", true);
gps_has_gs_node = fgGetNode("/instrumentation/gps/has-gs", true);
gps_course_node = fgGetNode("/instrumentation/gps/selected-course-deg", true);
gps_xtrack_error_nm_node = fgGetNode("/instrumentation/gps/wp/wp[1]/course-error-nm", true);
std::ostringstream temp;
temp << _name << "nav-ident" << _num;
nav_fx_name = temp.str();
@ -598,13 +600,25 @@ void FGNavRadio::updateGPSSlaved()
_toFlag = gps_to_flag_node->getBoolValue();
_fromFlag = gps_from_flag_node->getBoolValue();
inrange_node->setBoolValue(_toFlag | _fromFlag);
bool gpsValid = (_toFlag | _fromFlag);
inrange_node->setBoolValue(gpsValid);
if (!gpsValid) {
signal_quality_norm_node->setDoubleValue(0.0);
_cdiDeflection = 0.0;
_cdiCrossTrackErrorM = 0.0;
_gsNeedleDeflection = 0.0;
return;
}
// this is unfortunate, but panel instruments use this value to decide
// if the navradio output is valid.
signal_quality_norm_node->setDoubleValue(1.0);
_cdiDeflection = gps_cdi_deflection_node->getDoubleValue();
// clmap to some range (+/- 10 degrees) as the regular deflection
SG_CLAMP_RANGE(_cdiDeflection, -10.0, 10.0 );
_cdiCrossTrackErrorM = 0.0; // FIXME, supply this
_cdiCrossTrackErrorM = gps_xtrack_error_nm_node->getDoubleValue() * SG_NM_TO_METER;
_gsNeedleDeflection = 0.0; // FIXME, supply this
//sel_radial_node->setDoubleValue(gps_course_node->getDoubleValue());

View file

@ -114,7 +114,8 @@ class FGNavRadio : public SGSubsystem
SGPropertyNode_ptr gps_from_flag_node;
SGPropertyNode_ptr gps_has_gs_node;
SGPropertyNode_ptr gps_course_node;
SGPropertyNode_ptr gps_xtrack_error_nm_node;
// internal (private) values
int play_count;