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

44 lines
1.1 KiB
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 ()
{
_serviceable_node =
fgGetNode("/instrumentation/slip-skid-ball/serviceable", true);
_y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
2003-01-25 21:13:13 +00:00
_out_node =
fgGetNode("/instrumentation/slip-skid-ball/indicated-slip-skid", true);
}
void
SlipSkidBall::update (double delta_time_sec)
2003-01-25 21:13:13 +00:00
{
if (_serviceable_node->getBoolValue()) {
double d = -_z_accel_node->getDoubleValue();
if (d < 1.0)
d = 1.0;
double pos = _y_accel_node->getDoubleValue() / d * 5.0;
pos = fgGetLowPass(_out_node->getDoubleValue(), pos, delta_time_sec);
_out_node->setDoubleValue(pos);
}
2003-01-25 21:13:13 +00:00
}
// end of slip_skid_ball.cxx