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.
6 #include "slip_skid_ball.hxx"
7 #include <Main/fg_props.hxx>
8 #include <Main/util.hxx>
11 SlipSkidBall::SlipSkidBall ( SGPropertyNode *node)
13 name("slip-skid-ball"),
17 for ( i = 0; i < node->nChildren(); ++i ) {
18 SGPropertyNode *child = node->getChild(i);
19 string cname = child->getName();
20 string cval = child->getStringValue();
21 if ( cname == "name" ) {
23 } else if ( cname == "number" ) {
24 num = child->getIntValue();
26 SG_LOG( SG_INSTR, SG_WARN, "Error in slip-skid-ball config logic" );
27 if ( name.length() ) {
28 SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
34 SlipSkidBall::SlipSkidBall ()
38 SlipSkidBall::~SlipSkidBall ()
46 branch = "/instrumentation/" + name;
48 SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
49 _serviceable_node = node->getChild("serviceable", 0, true);
50 _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
51 _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
52 _out_node = node->getChild("indicated-slip-skid", 0, true);
53 _override_node = node->getChild("iverride", 0, true);
57 SlipSkidBall::update (double delta_time_sec)
59 if (_serviceable_node->getBoolValue() && !_override_node->getBoolValue()) {
60 double d = -_z_accel_node->getDoubleValue();
63 double pos = _y_accel_node->getDoubleValue() / d * 10.0;
64 pos = fgGetLowPass(_out_node->getDoubleValue(), pos, delta_time_sec);
65 _out_node->setDoubleValue(pos);
69 // end of slip_skid_ball.cxx