]> git.mxchange.org Git - flightgear.git/commitdiff
Added magnetic compass instrument.
authordavid <david>
Sun, 26 Jan 2003 15:56:11 +0000 (15:56 +0000)
committerdavid <david>
Sun, 26 Jan 2003 15:56:11 +0000 (15:56 +0000)
Removed some unused bind/unbind methods.

Improved responsiveness of slip-skid ball.

Some minor cleanups.

src/Instrumentation/Makefile.am
src/Instrumentation/airspeed_indicator.cxx
src/Instrumentation/airspeed_indicator.hxx
src/Instrumentation/altimeter.cxx
src/Instrumentation/altimeter.hxx
src/Instrumentation/instrument_mgr.cxx
src/Instrumentation/slip_skid_ball.cxx
src/Instrumentation/slip_skid_ball.hxx
src/Instrumentation/vertical_speed_indicator.cxx
src/Instrumentation/vertical_speed_indicator.hxx

index aa060b7da20fc2e428800d4f81a36d8a8a22b2f7..84c86e83e4809259a9652653cc96cdbe26f996af 100644 (file)
@@ -8,6 +8,7 @@ libInstrumentation_a_SOURCES = instrument_mgr.cxx instrument_mgr.hxx \
                                turn_indicator.cxx turn_indicator.hxx \
                                slip_skid_ball.cxx slip_skid_ball.hxx \
                                heading_indicator.cxx heading_indicator.hxx \
-                               vertical_speed_indicator.cxx vertical_speed_indicator.hxx
+                               vertical_speed_indicator.cxx vertical_speed_indicator.hxx \
+                               mag_compass.cxx mag_compass.hxx
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
index 480d6dab33894c72349aa1bd9f531e248c20093e..bc83602de188f767bb8630782d6c1836285bf19f 100644 (file)
@@ -35,17 +35,6 @@ AirspeedIndicator::init ()
                   true);
 }
 
-void
-AirspeedIndicator::bind ()
-{
-}
-
-void
-AirspeedIndicator::unbind ()
-{
-}
-
-
 #ifndef SEA_LEVEL_DENSITY_SLUGFG3
 # define SEA_LEVEL_DENSITY_SLUGFT3 0.002378
 #endif
index cb52e1a7d940be9ef2b5719e2eea1bf13a986634..1047608cb9863388ed0dcbe681cfec6446e67e53 100644 (file)
@@ -37,8 +37,6 @@ public:
     virtual ~AirspeedIndicator ();
 
     virtual void init ();
-    virtual void bind ();
-    virtual void unbind ();
     virtual void update (double dt);
 
 private:
index cf15be1f00b706dcccf1cba59391d7795fff7bd4..993672e6fbeffe1ce101da32eea180ffb05d18cb 100644 (file)
@@ -67,16 +67,6 @@ Altimeter::init ()
         fgGetNode("/instrumentation/altimeter/indicated-altitude-ft", true);
 }
 
-void
-Altimeter::bind ()
-{
-}
-
-void
-Altimeter::unbind ()
-{
-}
-
 void
 Altimeter::update (double dt)
 {
index 5a5250d2993234a592c94bfbd1c60a6b8711783c..439a677d02daca2ca819b7095f7114a0c537e1fc 100644 (file)
@@ -40,8 +40,6 @@ public:
     virtual ~Altimeter ();
 
     virtual void init ();
-    virtual void bind ();
-    virtual void unbind ();
     virtual void update (double dt);
 
 private:
index 21ded6b567aece6197c6fc1d18dbdf19f1d23201..07541da5a0b549bceccae9d236f273e3ddf698e9 100644 (file)
@@ -12,6 +12,7 @@
 #include "slip_skid_ball.hxx"
 #include "heading_indicator.hxx"
 #include "vertical_speed_indicator.hxx"
+#include "mag_compass.hxx"
 
 
 FGInstrumentMgr::FGInstrumentMgr ()
@@ -23,6 +24,7 @@ FGInstrumentMgr::FGInstrumentMgr ()
     set_subsystem("ball", new SlipSkidBall);
     set_subsystem("hi", new HeadingIndicator);
     set_subsystem("vsi", new VerticalSpeedIndicator);
+    set_subsystem("compass", new MagCompass);
 }
 
 FGInstrumentMgr::~FGInstrumentMgr ()
index 4132027136beafe17b847fe9be3c72ffe1354327..3a1a4604ba946d9964019b78b95d3f0c521e1733 100644 (file)
@@ -19,22 +19,25 @@ SlipSkidBall::~SlipSkidBall ()
 void
 SlipSkidBall::init ()
 {
-    _y_accel_node = fgGetNode("/orientation/roll-rate-degps", true);
-    _z_accel_node = fgGetNode("/orientation/yaw-rate-degps", true);
+    _serviceable_node =
+        fgGetNode("/instrumentation/slip-skid-ball/serviceable", true);
+    _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
+    _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
     _out_node =
         fgGetNode("/instrumentation/slip-skid-ball/indicated-slip-skid", true);
 }
 
 void
-SlipSkidBall::update (double dt)
+SlipSkidBall::update (double delta_time_sec)
 {
-    double d = -_z_accel_node->getDoubleValue();
-    if (d < 60.0)               // originally 1 radian
-        d = 60.0;
-    double pos = _y_accel_node->getDoubleValue()/d;
-    pos = fgGetLowPass(_last_pos, pos, dt);
-    _last_pos = pos;
-    _out_node->setDoubleValue(pos);
+    if (_serviceable_node->getBoolValue()) {
+        double d = -_z_accel_node->getDoubleValue();
+        if (d < 1.0)
+            d = 1.0;
+        double pos = _y_accel_node->getDoubleValue() / d * 5.0;
+        pos = fgGetLowPass(_out_node->getDoubleValue(), pos, delta_time_sec);
+        _out_node->setDoubleValue(pos);
+    }
 }
 
 // end of slip_skid_ball.cxx
index 994eb5f8bc79e0732da706a29940543f61a45502..e71438cb469b301fbcc240580982333631a4b26b 100644 (file)
@@ -45,6 +45,7 @@ private:
     Gyro _gyro;
     double _last_pos;
 
+    SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _y_accel_node;
     SGPropertyNode_ptr _z_accel_node;
     SGPropertyNode_ptr _out_node;
index 295346691025d904303404e945837731db7faabd..d707b704442d0dc81d371b4cadfd84948ef682d5 100644 (file)
@@ -32,16 +32,6 @@ VerticalSpeedIndicator::init ()
                   true);
 }
 
-void
-VerticalSpeedIndicator::bind ()
-{
-}
-
-void
-VerticalSpeedIndicator::unbind ()
-{
-}
-
 void
 VerticalSpeedIndicator::update (double dt)
 {
index b7d7755317aa3366b86ee4e1fa0e9e16ceb7ea6e..876fc5ef4e819d5235b84cf2b94ac299b06b275a 100644 (file)
@@ -36,8 +36,6 @@ public:
     virtual ~VerticalSpeedIndicator ();
 
     virtual void init ();
-    virtual void bind ();
-    virtual void unbind ();
     virtual void update (double dt);
 
 private: