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
#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"
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);
}
--- /dev/null
+// 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
--- /dev/null
+// 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