Added support for the slip-skid ball.
This commit is contained in:
parent
8cc7b283d5
commit
99aa857dcb
4 changed files with 97 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
40
src/Instrumentation/slip_skid_ball.cxx
Normal file
40
src/Instrumentation/slip_skid_ball.cxx
Normal file
|
@ -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
|
54
src/Instrumentation/slip_skid_ball.hxx
Normal file
54
src/Instrumentation/slip_skid_ball.hxx
Normal file
|
@ -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
|
Loading…
Reference in a new issue