1
0
Fork 0
flightgear/src/Instrumentation/slip_skid_ball.cxx

41 lines
943 B
C++
Raw Normal View History

2003-01-25 21:13:13 +00:00
// 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