]> git.mxchange.org Git - flightgear.git/commitdiff
Added support for the slip-skid ball.
authordavid <david>
Sat, 25 Jan 2003 21:13:13 +0000 (21:13 +0000)
committerdavid <david>
Sat, 25 Jan 2003 21:13:13 +0000 (21:13 +0000)
src/Instrumentation/Makefile.am
src/Instrumentation/instrument_mgr.cxx
src/Instrumentation/slip_skid_ball.cxx [new file with mode: 0644]
src/Instrumentation/slip_skid_ball.hxx [new file with mode: 0644]

index 02eff900c318038ab08ade11e736d2244d52d19a..aa060b7da20fc2e428800d4f81a36d8a8a22b2f7 100644 (file)
@@ -6,6 +6,7 @@ libInstrumentation_a_SOURCES = instrument_mgr.cxx instrument_mgr.hxx \
                                attitude_indicator.cxx attitude_indicator.hxx \
                                altimeter.cxx altimeter.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
 
index 410245cb7499d14148c0617c66e42a1c335881ef..21ded6b567aece6197c6fc1d18dbdf19f1d23201 100644 (file)
@@ -9,6 +9,7 @@
 #include "attitude_indicator.hxx"
 #include "altimeter.hxx"
 #include "turn_indicator.hxx"
+#include "slip_skid_ball.hxx"
 #include "heading_indicator.hxx"
 #include "vertical_speed_indicator.hxx"
 
@@ -19,6 +20,7 @@ FGInstrumentMgr::FGInstrumentMgr ()
     set_subsystem("ai", new AttitudeIndicator);
     set_subsystem("alt", new Altimeter);
     set_subsystem("ti", new TurnIndicator);
+    set_subsystem("ball", new SlipSkidBall);
     set_subsystem("hi", new HeadingIndicator);
     set_subsystem("vsi", new VerticalSpeedIndicator);
 }
diff --git a/src/Instrumentation/slip_skid_ball.cxx b/src/Instrumentation/slip_skid_ball.cxx
new file mode 100644 (file)
index 0000000..4132027
--- /dev/null
@@ -0,0 +1,40 @@
+// slip_skid_ball.cxx - an electric-powered turn indicator.
+// Written by David Megginson, started 2003.
+//
+// This file is in the Public Domain and comes with no warranty.
+
+#include "slip_skid_ball.hxx"
+#include <Main/fg_props.hxx>
+#include <Main/util.hxx>
+
+
+SlipSkidBall::SlipSkidBall ()
+{
+}
+
+SlipSkidBall::~SlipSkidBall ()
+{
+}
+
+void
+SlipSkidBall::init ()
+{
+    _y_accel_node = fgGetNode("/orientation/roll-rate-degps", true);
+    _z_accel_node = fgGetNode("/orientation/yaw-rate-degps", true);
+    _out_node =
+        fgGetNode("/instrumentation/slip-skid-ball/indicated-slip-skid", true);
+}
+
+void
+SlipSkidBall::update (double dt)
+{
+    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);
+}
+
+// end of slip_skid_ball.cxx
diff --git a/src/Instrumentation/slip_skid_ball.hxx b/src/Instrumentation/slip_skid_ball.hxx
new file mode 100644 (file)
index 0000000..994eb5f
--- /dev/null
@@ -0,0 +1,54 @@
+// slip_skid_ball.hxx - an slip-skid ball.
+// Written by David Megginson, started 2003.
+//
+// This file is in the Public Domain and comes with no warranty.
+
+
+#ifndef __INSTRUMENTS_SLIP_SKID_BALL_HXX
+#define __INSTRUMENTS_SLIP_SKID_BALL_HXX 1
+
+#ifndef __cplusplus
+# error This library requires C++
+#endif
+
+#include <simgear/misc/props.hxx>
+#include <Main/fgfs.hxx>
+
+#include "gyro.hxx"
+
+
+/**
+ * Model a slip-skid ball.
+ *
+ * Input properties:
+ *
+ * /accelerations/pilot/y-accel-fps_sec
+ * /accelerations/pilot/z-accel-fps_sec
+ *
+ * Output properties:
+ *
+ * /instrumentation/slip-skid-ball/indicated-slip-skid
+ */
+class SlipSkidBall : public FGSubsystem
+{
+
+public:
+
+    SlipSkidBall ();
+    virtual ~SlipSkidBall ();
+
+    virtual void init ();
+    virtual void update (double dt);
+
+private:
+
+    Gyro _gyro;
+    double _last_pos;
+
+    SGPropertyNode_ptr _y_accel_node;
+    SGPropertyNode_ptr _z_accel_node;
+    SGPropertyNode_ptr _out_node;
+    
+};
+
+#endif // __INSTRUMENTS_SLIP_SKID_BALL_HXX