]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/slip_skid_ball.cxx
Added support for the slip-skid ball.
[flightgear.git] / src / Instrumentation / slip_skid_ball.cxx
1 // slip_skid_ball.cxx - an electric-powered turn indicator.
2 // Written by David Megginson, started 2003.
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6 #include "slip_skid_ball.hxx"
7 #include <Main/fg_props.hxx>
8 #include <Main/util.hxx>
9
10
11 SlipSkidBall::SlipSkidBall ()
12 {
13 }
14
15 SlipSkidBall::~SlipSkidBall ()
16 {
17 }
18
19 void
20 SlipSkidBall::init ()
21 {
22     _y_accel_node = fgGetNode("/orientation/roll-rate-degps", true);
23     _z_accel_node = fgGetNode("/orientation/yaw-rate-degps", true);
24     _out_node =
25         fgGetNode("/instrumentation/slip-skid-ball/indicated-slip-skid", true);
26 }
27
28 void
29 SlipSkidBall::update (double dt)
30 {
31     double d = -_z_accel_node->getDoubleValue();
32     if (d < 60.0)               // originally 1 radian
33         d = 60.0;
34     double pos = _y_accel_node->getDoubleValue()/d;
35     pos = fgGetLowPass(_last_pos, pos, dt);
36     _last_pos = pos;
37     _out_node->setDoubleValue(pos);
38 }
39
40 // end of slip_skid_ball.cxx