]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gsdi.cxx
commradio: typo: cuttoff --> cutoff
[flightgear.git] / src / Instrumentation / gsdi.cxx
index b624e6405c8455b859c9bf401dcc4fd0a9bc3658..b383f3c3e8a9a6349f1b4a6cf9e9dd15387358f1 100644 (file)
 
 
 GSDI::GSDI(SGPropertyNode *node) :
-       _name("gsdi"),
-       _num(0)
-{
-       for (int i = 0; i < node->nChildren(); ++i) {
-               SGPropertyNode *child = node->getChild(i);
-               string name = child->getName();
-
-               if (name == "name") {
-                       _name = child->getStringValue();
-               } else if (name == "number") {
-                       _num = child->getIntValue();
-               } else {
-                       SG_LOG(SG_INSTR, SG_WARN, "Error in gsdi config logic");
-                       if (_name.length())
-                               SG_LOG(SG_INSTR, SG_WARN, "Section = " << _name);
-               }
-       }
-}
-
-
-GSDI::GSDI()
+       _name(node->getStringValue("name", "gsdi")),
+       _num(node->getIntValue("number", 0))
 {
 }
 
@@ -68,18 +49,15 @@ GSDI::~GSDI()
 
 void GSDI::init()
 {
-       string branch;
+  std::string branch;
        branch = "/instrumentation/" + _name;
        SGPropertyNode *n = fgGetNode(branch.c_str(), _num, true);
        _serviceableN = n->getNode("serviceable", true);
 
        // input
-       _headingN = fgGetNode("/orientation/heading-deg", true);
        _ubodyN = fgGetNode("/velocities/uBody-fps", true);
        _vbodyN = fgGetNode("/velocities/vBody-fps", true);
-       _wind_dirN = fgGetNode("/environment/wind-from-heading-deg", true);
-       _wind_speedN = fgGetNode("/environment/wind-speed-kt", true);
-
+       
        // output
        _drift_uN = n->getNode("drift-u-kt", true);
        _drift_vN = n->getNode("drift-v-kt", true);
@@ -93,14 +71,8 @@ void GSDI::update(double /*delta_time_sec*/)
        if (!_serviceableN->getBoolValue())
                return;
 
-       double wind_speed = _wind_speedN->getDoubleValue();
-       double rel_wind_dir = (_headingN->getDoubleValue() - _wind_dirN->getDoubleValue())
-                       * SGD_DEGREES_TO_RADIANS;
-       double wind_u = wind_speed * cos(rel_wind_dir);
-       double wind_v = wind_speed * sin(rel_wind_dir);
-
-       double u = _ubodyN->getDoubleValue() * SG_FPS_TO_KT - wind_u;
-       double v = _vbodyN->getDoubleValue() * SG_FPS_TO_KT + wind_v;
+       double u = _ubodyN->getDoubleValue() * SG_FPS_TO_KT;
+       double v = _vbodyN->getDoubleValue() * SG_FPS_TO_KT;
 
        double speed = sqrt(u * u + v * v);
        double angle = atan2(v, u) * SGD_RADIANS_TO_DEGREES;