]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/slip_skid_ball.cxx
Moved random ground cover object management code (userdata.[ch]xx) over
[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     _serviceable_node =
23         fgGetNode("/instrumentation/slip-skid-ball/serviceable", true);
24     _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
25     _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
26     _out_node =
27         fgGetNode("/instrumentation/slip-skid-ball/indicated-slip-skid", true);
28 }
29
30 void
31 SlipSkidBall::update (double delta_time_sec)
32 {
33     if (_serviceable_node->getBoolValue()) {
34         double d = -_z_accel_node->getDoubleValue();
35         if (d < 1.0)
36             d = 1.0;
37         double pos = _y_accel_node->getDoubleValue() / d * 5.0;
38         pos = fgGetLowPass(_out_node->getDoubleValue(), pos, delta_time_sec);
39         _out_node->setDoubleValue(pos);
40     }
41 }
42
43 // end of slip_skid_ball.cxx