From: mfranz Date: Fri, 9 Jun 2006 18:29:51 +0000 (+0000) Subject: Vivian MEAZZA: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4db6e924fe038b4e0a548ab27f70862a40c4f5f7;p=flightgear.git Vivian MEAZZA: " Make a couple of minor adjustments to Harald's weather radar code, make elevation work in the radar code, and add station ident to the TACAN code" --- diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index b1dca66e7..28a486cd0 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -210,6 +210,7 @@ void FGAIBase::bind() { props->tie("radar/x-shift", SGRawValuePointer(&x_shift)); props->tie("radar/y-shift", SGRawValuePointer(&y_shift)); props->tie("radar/rotation", SGRawValuePointer(&rotation)); + props->tie("radar/ht-diff-ft", SGRawValuePointer(&ht_diff)); props->tie("controls/lighting/nav-lights", SGRawValueFunctions(_isNight)); @@ -240,6 +241,7 @@ void FGAIBase::unbind() { props->untie("radar/x-shift"); props->untie("radar/y-shift"); props->untie("radar/rotation"); + props->untie("radar/ht-diff-ft"); props->untie("controls/lighting/nav-lights"); } @@ -298,11 +300,10 @@ double FGAIBase::UpdateRadar(FGAIManager* manager) if (horiz_offset < -180.0) horiz_offset += 360.0; // calculate elevation to target - elevation = atan2( altitude * SG_METER_TO_FEET - user_altitude, range_ft ) - * SG_RADIANS_TO_DEGREES; + elevation = atan2( altitude - user_altitude, range_ft ) * SG_RADIANS_TO_DEGREES; // calculate look up/down to target - vert_offset = elevation + user_pitch; + vert_offset = elevation - user_pitch; /* this calculation needs to be fixed, but it isn't important anyway // calculate range rate @@ -323,6 +324,7 @@ double FGAIBase::UpdateRadar(FGAIManager* manager) x_shift = range * sin( horiz_offset * SG_DEGREES_TO_RADIANS); rotation = hdg - user_heading; if (rotation < 0.0) rotation += 360.0; + ht_diff = altitude - user_altitude; } diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx index 1bed52ab1..250631d0d 100644 --- a/src/AIModel/AIBase.hxx +++ b/src/AIModel/AIBase.hxx @@ -116,7 +116,7 @@ protected: double x_shift; // value used by radar display instrument double y_shift; // value used by radar display instrument double rotation; // value used by radar display instrument - + double ht_diff; // value used by radar display instrument string model_path; //Path to the 3D model ssgSharedPtr model; //The 3D model object diff --git a/src/Instrumentation/tacan.cxx b/src/Instrumentation/tacan.cxx index 895874f1e..4aa530ab4 100755 --- a/src/Instrumentation/tacan.cxx +++ b/src/Instrumentation/tacan.cxx @@ -111,6 +111,7 @@ TACAN::init () _yaw_node = fgGetNode("/orientation/side-slip-deg", true); _serviceable_node = node->getChild("serviceable", 0, true); _electrical_node = fgGetNode("/systems/electrical/outputs/tacan", true); + _ident_node = node->getChild("ident", 0, true); SGPropertyNode *fnode = node->getChild("frequencies", 0, true); _source_node = fnode->getChild("source", 0, true); _frequency_node = fnode->getChild("selected-mhz", 0, true); @@ -245,6 +246,8 @@ TACAN::update (double delta_time_sec) _transmitter_bias = _mobile_bias; _transmitter_name = _mobile_name; _name_node->setStringValue(_transmitter_name.c_str()); + _transmitter_ident = _mobile_ident; + _ident_node->setStringValue(_transmitter_ident.c_str()); _channel_node->setStringValue(_channel.c_str()); } @@ -324,6 +327,8 @@ TACAN::update (double delta_time_sec) _rotation_node->setDoubleValue(0); _transmitter_name = ""; _name_node->setStringValue(_transmitter_name.c_str()); + _transmitter_ident = ""; + _ident_node->setStringValue(_transmitter_ident.c_str()); _channel_node->setStringValue(_channel.c_str()); return; } @@ -372,6 +377,7 @@ TACAN::search (double frequency_mhz, double longitude_rad, _mobile_range_nm = mobile_tacan->get_range(); _mobile_bias = mobile_tacan->get_multiuse(); _mobile_name = mobile_tacan->get_name(); + _mobile_ident = mobile_tacan->get_trans_ident(); _mobile_valid = true; SG_LOG( SG_INSTR, SG_DEBUG, " carrier transmitter valid " << _mobile_valid ); break; @@ -411,6 +417,7 @@ TACAN::search (double frequency_mhz, double longitude_rad, _mobile_range_nm = mobile_tacan->get_range(); _mobile_bias = mobile_tacan->get_multiuse(); _mobile_name = mobile_tacan->get_name(); + _mobile_ident = mobile_tacan->get_trans_ident(); _mobile_valid = true; SG_LOG( SG_INSTR, SG_DEBUG, " tanker transmitter valid " << _mobile_valid ); break; @@ -452,6 +459,7 @@ TACAN::search (double frequency_mhz, double longitude_rad, _mobile_range_nm = mobile_tacan->get_range(); _mobile_bias = mobile_tacan->get_multiuse(); _mobile_name = mobile_tacan->get_name(); + _mobile_ident = mobile_tacan->get_trans_ident(); _mobile_valid = true; SG_LOG( SG_INSTR, SG_DEBUG, " mp tanker transmitter valid " << _mobile_valid ); @@ -488,6 +496,8 @@ TACAN::search (double frequency_mhz, double longitude_rad, _transmitter_bias = tacan->get_multiuse(); _transmitter_name = tacan->get_name(); _name_node->setStringValue(_transmitter_name.c_str()); + _transmitter_ident = tacan->get_trans_ident(); + _ident_node->setStringValue(_transmitter_ident.c_str()); SG_LOG( SG_INSTR, SG_DEBUG, "name " << _transmitter_name); SG_LOG( SG_INSTR, SG_DEBUG, "lat " << _transmitter_lat << "lon " << _transmitter_lon); diff --git a/src/Instrumentation/tacan.hxx b/src/Instrumentation/tacan.hxx index 34e0172ae..59985e682 100755 --- a/src/Instrumentation/tacan.hxx +++ b/src/Instrumentation/tacan.hxx @@ -68,6 +68,9 @@ private: SGPropertyNode_ptr _x_shift_node; SGPropertyNode_ptr _y_shift_node; SGPropertyNode_ptr _rotation_node; + /*SGPropertyNode_ptr _x_shift_calibration_node; + SGPropertyNode_ptr _y_shift_calibration_node; + SGPropertyNode_ptr _distance_calibration_node;*/ SGPropertyNode_ptr _in_range_node; SGPropertyNode_ptr _distance_node; @@ -97,6 +100,7 @@ private: double _transmitter_bearing_deg; double _transmitter_bias; string _transmitter_name; + string _transmitter_ident; double _mobile_lat, _mobile_lon; double _mobile_elevation_ft; @@ -104,6 +108,7 @@ private: double _mobile_bearing_deg; double _mobile_bias; string _mobile_name; + string _mobile_ident; string name; int num; diff --git a/src/Instrumentation/wxradar.cxx b/src/Instrumentation/wxradar.cxx index 83e8848fb..d464c6199 100644 --- a/src/Instrumentation/wxradar.cxx +++ b/src/Instrumentation/wxradar.cxx @@ -159,6 +159,7 @@ wxRadarBg::update (double delta_time_sec) // find something interesting to do... } else { string display_mode = _Instrument->getStringValue("display-mode", "arc"); + // pretend we have a scan angle bigger then the FOV // TODO:check real fov, enlarge if < nn, and do clipping if > mm const float fovFactor = 1.45f; @@ -172,7 +173,7 @@ wxRadarBg::update (double delta_time_sec) // float view_heading = get_track() * SG_DEGREES_TO_RADIANS; } else if( display_mode == "plan" ) { // no sense I presume - float view_heading = 0.0; + view_heading = 0; } else { // rose } @@ -276,10 +277,13 @@ wxRadarBg::update (double delta_time_sec) --------- */ float yOffset = 180.0f, xOffset = 256.0f; + if( display_mode != "arc" ) { yOffset = 40.0f; xOffset = 240.0f; } + + if ( display_mode != "plan" ) { glDisable(GL_BLEND); glColor4f(1.0f, 0.0f, 0.0f, 0.01f); glBegin( GL_QUADS ); @@ -301,11 +305,11 @@ wxRadarBg::update (double delta_time_sec) glBegin( GL_TRIANGLES ); glVertex2f(0.0, 0.0); glVertex2f(-256.0, 0.0); - glVertex2f(-256.0, 256.0); + glVertex2f(-256.0, 256.0 * tan(30*SG_DEGREES_TO_RADIANS)); glVertex2f(0.0, 0.0); glVertex2f(256.0, 0.0); - glVertex2f(256.0, 256.0); + glVertex2f(256.0, 256.0 * tan(30*SG_DEGREES_TO_RADIANS)); glVertex2f(-256, 0.0); glVertex2f(256.0, 0.0); @@ -315,6 +319,7 @@ wxRadarBg::update (double delta_time_sec) glVertex2f(256.0, -256.0); glVertex2f(-256.0, -256.0); glEnd(); + } // DEBUG only /* glColor4f(1.0f, 0.0f, 0.0f, 1.0f);