1 // slip_skid_ball.cxx - an electric-powered turn indicator.
2 // Written by David Megginson, started 2003.
4 // This file is in the Public Domain and comes with no warranty.
10 #include "slip_skid_ball.hxx"
11 #include <Main/fg_props.hxx>
12 #include <Main/util.hxx>
16 SlipSkidBall::SlipSkidBall ( SGPropertyNode *node)
18 _name(node->getStringValue("name", "slip-skid-ball")),
19 _num(node->getIntValue("number", 0))
23 SlipSkidBall::~SlipSkidBall ()
31 branch = "/instrumentation/" + _name;
33 SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
34 _serviceable_node = node->getChild("serviceable", 0, true);
35 _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
36 _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
37 _out_node = node->getChild("indicated-slip-skid", 0, true);
38 _override_node = node->getChild("override", 0, true);
44 SlipSkidBall::reinit ()
46 _out_node->setDoubleValue(0.0);
50 SlipSkidBall::update (double delta_time_sec)
52 if (_serviceable_node->getBoolValue() && !_override_node->getBoolValue()) {
53 double d = -_z_accel_node->getDoubleValue();
56 double pos = _y_accel_node->getDoubleValue() / d * 10.0;
57 pos = fgGetLowPass(_out_node->getDoubleValue(), pos, delta_time_sec);
58 _out_node->setDoubleValue(pos);
62 // end of slip_skid_ball.cxx