]> git.mxchange.org Git - flightgear.git/commitdiff
Vivian MEAZZA:
authormfranz <mfranz>
Fri, 9 Jun 2006 18:29:51 +0000 (18:29 +0000)
committermfranz <mfranz>
Fri, 9 Jun 2006 18:29:51 +0000 (18:29 +0000)
" 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"

src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx
src/Instrumentation/tacan.cxx
src/Instrumentation/tacan.hxx
src/Instrumentation/wxradar.cxx

index b1dca66e790f2fdda3d4037eef64b07eb7657c40..28a486cd0d1dd7397c20d357e1fb78d940450a41 100644 (file)
@@ -210,6 +210,7 @@ void FGAIBase::bind() {
    props->tie("radar/x-shift", SGRawValuePointer<double>(&x_shift));
    props->tie("radar/y-shift", SGRawValuePointer<double>(&y_shift));
    props->tie("radar/rotation", SGRawValuePointer<double>(&rotation));
+   props->tie("radar/ht-diff-ft", SGRawValuePointer<double>(&ht_diff));
 
    props->tie("controls/lighting/nav-lights",
                SGRawValueFunctions<bool>(_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;
 
    }
 
index 1bed52ab1d747c9220c82aad55fdb1c000d50ed5..250631d0d5ba0774c9ca24f1081cd7eec3389625 100644 (file)
@@ -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<ssgBranch> model; //The 3D model object
index 895874f1ed8eecd45ac192daa6c4a016148419e2..4aa530ab40b4d02a80414f98e6882bab5bdaba71 100755 (executable)
@@ -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);
index 34e0172aeb7ea5fd39137e80cbdf15b62ee8d1b7..59985e682ad69bd730aca7274665eac6dfc21539 100755 (executable)
@@ -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;
index 83e8848fba69e2616b47d88a3764e96007522f55..d464c61990fd2f71905ed88e97445fd34f945354 100644 (file)
@@ -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);