From: david Date: Sat, 25 Jan 2003 21:13:13 +0000 (+0000) Subject: Added support for the slip-skid ball. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=99aa857dcb7cc803a678cf52811a94d7cc8bd8a7;p=flightgear.git Added support for the slip-skid ball. --- diff --git a/src/Instrumentation/Makefile.am b/src/Instrumentation/Makefile.am index 02eff900c..aa060b7da 100644 --- a/src/Instrumentation/Makefile.am +++ b/src/Instrumentation/Makefile.am @@ -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 diff --git a/src/Instrumentation/instrument_mgr.cxx b/src/Instrumentation/instrument_mgr.cxx index 410245cb7..21ded6b56 100644 --- a/src/Instrumentation/instrument_mgr.cxx +++ b/src/Instrumentation/instrument_mgr.cxx @@ -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 index 000000000..413202713 --- /dev/null +++ b/src/Instrumentation/slip_skid_ball.cxx @@ -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
+#include
+ + +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 index 000000000..994eb5f8b --- /dev/null +++ b/src/Instrumentation/slip_skid_ball.hxx @@ -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 +#include
+ +#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