Add support for a back-course mode. Nothing changes visualy, but this
reverses the autopilot helpers so that the FD/AP can properly fly a BC appr.
This commit is contained in:
parent
ae62896f9f
commit
aad3c711a1
2 changed files with 17 additions and 16 deletions
|
@ -56,6 +56,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||||
vol_btn_node(NULL),
|
vol_btn_node(NULL),
|
||||||
ident_btn_node(NULL),
|
ident_btn_node(NULL),
|
||||||
audio_btn_node(NULL),
|
audio_btn_node(NULL),
|
||||||
|
backcourse_node(NULL),
|
||||||
nav_serviceable_node(NULL),
|
nav_serviceable_node(NULL),
|
||||||
cdi_serviceable_node(NULL),
|
cdi_serviceable_node(NULL),
|
||||||
gs_serviceable_node(NULL),
|
gs_serviceable_node(NULL),
|
||||||
|
@ -167,6 +168,8 @@ FGNavRadio::init ()
|
||||||
ident_btn_node->setBoolValue( true );
|
ident_btn_node->setBoolValue( true );
|
||||||
audio_btn_node = node->getChild("audio-btn", 0, true);
|
audio_btn_node = node->getChild("audio-btn", 0, true);
|
||||||
audio_btn_node->setBoolValue( true );
|
audio_btn_node->setBoolValue( true );
|
||||||
|
backcourse_node = node->getChild("back-course-btn", 0, true);
|
||||||
|
backcourse_node->setBoolValue( false );
|
||||||
nav_serviceable_node = node->getChild("serviceable", 0, true);
|
nav_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
cdi_serviceable_node = (node->getChild("cdi", 0, true))
|
cdi_serviceable_node = (node->getChild("cdi", 0, true))
|
||||||
->getChild("serviceable", 0, true);
|
->getChild("serviceable", 0, true);
|
||||||
|
@ -497,8 +500,8 @@ FGNavRadio::update(double dt)
|
||||||
// of ( -10 , 10 )
|
// of ( -10 , 10 )
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
double r = 0.0;
|
double r = 0.0;
|
||||||
bool loc_bc = false; // an in-code flag indicating that we are
|
bool loc_backside = false; // an in-code flag indicating that we are
|
||||||
// on a localizer backcourse.
|
// on a localizer backcourse.
|
||||||
if ( cdi_serviceable ) {
|
if ( cdi_serviceable ) {
|
||||||
if ( nav_slaved_to_gps_node->getBoolValue() ) {
|
if ( nav_slaved_to_gps_node->getBoolValue() ) {
|
||||||
r = gps_cdi_deflection_node->getDoubleValue();
|
r = gps_cdi_deflection_node->getDoubleValue();
|
||||||
|
@ -516,7 +519,7 @@ FGNavRadio::update(double dt)
|
||||||
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
||||||
} else {
|
} else {
|
||||||
if ( is_loc ) {
|
if ( is_loc ) {
|
||||||
loc_bc = true;
|
loc_backside = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,16 +668,13 @@ FGNavRadio::update(double dt)
|
||||||
// determine the target heading to fly to intercept the
|
// determine the target heading to fly to intercept the
|
||||||
// tgt_radial = target radial (true) + cdi offset adjustmest -
|
// tgt_radial = target radial (true) + cdi offset adjustmest -
|
||||||
// xtrack heading error adjustment
|
// xtrack heading error adjustment
|
||||||
double nta_hdg = 0.0;
|
double nta_hdg;
|
||||||
if ( is_loc && loc_bc ) {
|
if ( is_loc && backcourse_node->getBoolValue() ) {
|
||||||
// tuned to a localizer and positioned in backcourse range
|
// tuned to a localizer and backcourse mode activated
|
||||||
// trtrue += 180.0; // reverse the target localizer heading
|
trtrue += 180.0; // reverse the target localizer heading
|
||||||
// while ( trtrue > 360.0 ) { trtrue -= 360.0; }
|
while ( trtrue > 360.0 ) { trtrue -= 360.0; }
|
||||||
nta_hdg = trtrue + adjustment - hdg_error;
|
nta_hdg = trtrue - adjustment - hdg_error;
|
||||||
cout << "trtrue = " << trtrue << " adj = " << adjustment
|
} else {
|
||||||
<< " hdg_error = " << hdg_error << endl;
|
|
||||||
} else {
|
|
||||||
// all other situations (nav or loc front course)
|
|
||||||
nta_hdg = trtrue + adjustment - hdg_error;
|
nta_hdg = trtrue + adjustment - hdg_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class FGNavRadio : public SGSubsystem
|
||||||
|
|
||||||
// property inputs
|
// property inputs
|
||||||
SGPropertyNode_ptr is_valid_node; // is station data valid (may be way out
|
SGPropertyNode_ptr is_valid_node; // is station data valid (may be way out
|
||||||
// of range.)
|
// of range.)
|
||||||
SGPropertyNode_ptr power_btn_node;
|
SGPropertyNode_ptr power_btn_node;
|
||||||
SGPropertyNode_ptr freq_node; // primary freq
|
SGPropertyNode_ptr freq_node; // primary freq
|
||||||
SGPropertyNode_ptr alt_freq_node; // standby freq
|
SGPropertyNode_ptr alt_freq_node; // standby freq
|
||||||
|
@ -58,6 +58,7 @@ class FGNavRadio : public SGSubsystem
|
||||||
SGPropertyNode_ptr vol_btn_node;
|
SGPropertyNode_ptr vol_btn_node;
|
||||||
SGPropertyNode_ptr ident_btn_node;
|
SGPropertyNode_ptr ident_btn_node;
|
||||||
SGPropertyNode_ptr audio_btn_node;
|
SGPropertyNode_ptr audio_btn_node;
|
||||||
|
SGPropertyNode_ptr backcourse_node;
|
||||||
SGPropertyNode_ptr nav_serviceable_node;
|
SGPropertyNode_ptr nav_serviceable_node;
|
||||||
SGPropertyNode_ptr cdi_serviceable_node;
|
SGPropertyNode_ptr cdi_serviceable_node;
|
||||||
SGPropertyNode_ptr gs_serviceable_node;
|
SGPropertyNode_ptr gs_serviceable_node;
|
||||||
|
|
Loading…
Reference in a new issue