Hello ,
This is a small patch to add a "heading-pointer-offset" for RMI's and
HSI's that have these pointers.
The reason for an "offset" is to illiminate the need to calculate true /
magnetic headings or magnetic variation... not required as far as the needle
is concerned.
It rests at a 90 degree offset until active.
Could someone take a look and commit if this property is desireable ?
Thanks
Index: navradio.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/navradio.cxx,v
retrieving revision 1.63
diff -U 3 -r1.63 navradio.cxx
--- navradio.cxx 15 Feb 2010 22:52:12 -0000 1.63
+++ navradio.cxx 19 Mar 2010 06:46:39 -0000
@@ -146,7 +146,9 @@
SGPropertyNode* node = _radio_node.get();
bus_power_node =
- fgGetNode(("/systems/electrical/outputs/" + _name).c_str(), true);
+ fgGetNode(("/systems/electrical/outputs/" + _name).c_str(), true);
+
+ true_hdg = fgGetNode("/orientation/heading-deg", true);
// inputs
is_valid_node = node->getChild("data-is-valid", 0, true);
@@ -191,6 +193,7 @@
// outputs
heading_node = node->getChild("heading-deg", 0, true);
+ heading_pointer_offset_node = node->getChild("heading-pointer-offset", 0, true);
time_to_intercept = node->getChild("time-to-intercept-sec", 0, true);
to_flag_node = node->getChild("to-flag", 0, true);
from_flag_node = node->getChild("from-flag", 0, true);
@@ -371,7 +374,7 @@
gs_inrange_node->setBoolValue( false );
loc_node->setBoolValue( false );
has_gs_node->setBoolValue(false);
-
+ heading_pointer_offset_node->setDoubleValue(90.0);
to_flag_node->setBoolValue( false );
from_flag_node->setBoolValue( false );
@@ -412,7 +415,7 @@
double az2, s;
//////////////////////////////////////////////////////////
- // compute forward and reverse wgs84 headings to localizer
+ // compute forward and reverse wgs84 headings to localizer
//////////////////////////////////////////////////////////
double hdg;
SGGeodesy::inverse(pos, _navaid->geod(), hdg, az2, s);
@@ -422,7 +425,14 @@
SG_NORMALIZE_RANGE(recip, 0.0, 360.0);
radial_node->setDoubleValue( radial );
recip_radial_node->setDoubleValue( recip );
-
+
+ //////////////////////////////////////////////////////////
+ // set magnetic heading offset for RMI or HSI pointers
+ //////////////////////////////////////////////////////////
+ double ptr_offset = hdg - true_hdg->getDoubleValue();
+ if(ptr_offset>180)ptr_offset-=360;
+ if(ptr_offset<-180)ptr_offset+=360;
+ heading_pointer_offset_node->setDoubleValue(ptr_offset);
//////////////////////////////////////////////////////////
// compute the target/selected radial in "true" heading
//////////////////////////////////////////////////////////
@@ -690,8 +700,6 @@
double gnd_trk_true = atan2( ve, vn ) * SGD_RADIANS_TO_DEGREES;
if ( gnd_trk_true < 0.0 ) { gnd_trk_true += 360.0; }
- SGPropertyNode *true_hdg
- = fgGetNode("/orientation/heading-deg", true);
hdg_error = gnd_trk_true - true_hdg->getDoubleValue();
// cout << "ground track = " << gnd_trk_true
Index: navradio.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/navradio.hxx,v
retrieving revision 1.37
diff -U 3 -r1.37 navradio.hxx
--- navradio.hxx 29 Dec 2009 13:56:19 -0000 1.37
+++ navradio.hxx 19 Mar 2010 06:46:39 -0000
@@ -52,6 +52,7 @@
SGPropertyNode_ptr lat_node;
SGPropertyNode_ptr alt_node;
SGPropertyNode_ptr bus_power_node;
+ SGPropertyNode_ptr true_hdg;
// property inputs
SGPropertyNode_ptr is_valid_node; // is station data valid (may be way out
@@ -74,6 +75,7 @@
SGPropertyNode_ptr fmt_freq_node; // formated frequency
SGPropertyNode_ptr fmt_alt_freq_node; // formated alternate frequency
SGPropertyNode_ptr heading_node; // true heading to nav station
+ SGPropertyNode_ptr heading_pointer_offset_node; // heading offset for HSI / RMI's
SGPropertyNode_ptr radial_node; // current radial we are on (taking
// into consideration the vor station
// alignment which likely doesn't
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel