X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fslip_skid_ball.cxx;h=4bb1f916bdc7ed58b2a7595bc0dff7534a29768b;hb=84a26de9ae9ade8629dee53cac8b9357f0930690;hp=4132027136beafe17b847fe9be3c72ffe1354327;hpb=99aa857dcb7cc803a678cf52811a94d7cc8bd8a7;p=flightgear.git diff --git a/src/Instrumentation/slip_skid_ball.cxx b/src/Instrumentation/slip_skid_ball.cxx index 413202713..4bb1f916b 100644 --- a/src/Instrumentation/slip_skid_ball.cxx +++ b/src/Instrumentation/slip_skid_ball.cxx @@ -3,12 +3,20 @@ // // This file is in the Public Domain and comes with no warranty. +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "slip_skid_ball.hxx" #include
#include
+using std::string; -SlipSkidBall::SlipSkidBall () +SlipSkidBall::SlipSkidBall ( SGPropertyNode *node) + : + _name(node->getStringValue("name", "slip-skid-ball")), + _num(node->getIntValue("number", 0)) { } @@ -19,22 +27,36 @@ 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); + string branch; + branch = "/instrumentation/" + _name; + + SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true ); + _serviceable_node = node->getChild("serviceable", 0, true); + _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true); + _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true); + _out_node = node->getChild("indicated-slip-skid", 0, true); + _override_node = node->getChild("override", 0, true); + + reinit(); +} + +void +SlipSkidBall::reinit () +{ + _out_node->setDoubleValue(0.0); } void -SlipSkidBall::update (double dt) +SlipSkidBall::update (double delta_time_sec) { - 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); + if (_serviceable_node->getBoolValue() && !_override_node->getBoolValue()) { + double d = -_z_accel_node->getDoubleValue(); + if (d < 1.0) + d = 1.0; + double pos = _y_accel_node->getDoubleValue() / d * 10.0; + pos = fgGetLowPass(_out_node->getDoubleValue(), pos, delta_time_sec); + _out_node->setDoubleValue(pos); + } } // end of slip_skid_ball.cxx