]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/gyro.hxx
GPS: fix bad init when far from any airport
[flightgear.git] / src / Instrumentation / gyro.hxx
1 // gyro.hxx - simple model of a spinning gyro.
2
3 #ifndef __INSTRUMENTATION_GYRO_HXX
4 #define __INSTRUMENTATION_GYRO_HXX 1
5
6 /**
7  * Simple model of a spinning gyro.
8  *
9  * The gyro decelerates gradually if no power is available to keep it
10  * spinning, and spins up quickly when power becomes available.
11  */
12 class Gyro
13 {
14 public:
15
16     /**
17      * Constructor.
18      */
19     Gyro ();
20
21     /**
22      * Destructor.
23      */
24     virtual ~Gyro ();
25
26     /**
27      * Reset the gyro.
28      */
29     void reinit(void);
30
31     /**
32      * Update the gyro.
33      *
34      * @param delta_time_sec The elapsed time since the last update.
35      * @param power_norm The power available to drive the gyro, from
36      *        0.0 to 1.0.
37      */
38     virtual void update (double delta_time_sec);
39
40
41     /**
42      * Set the power available to the gyro.
43      *
44      * @param power_norm The amount of power (vacuum or electrical)
45      *        available to keep the gyro spinning, from 0.0 (none) to
46      *        1.0 (full power)
47      */
48     virtual void set_power_norm (double power_norm);
49
50
51     /**
52      * Get the gyro's current spin.
53      *
54      * @return The spin from 0.0 (not spinning) to 1.0 (full speed).
55      */
56     virtual double get_spin_norm () const;
57
58
59     /**
60      * Set the gyro's current spin.
61      *
62      * @spin_norm The spin from 0.0 (not spinning) to 1.0 (full speed).
63      */
64     virtual void set_spin_norm (double spin_norm);
65
66
67     /**
68      * Test if the gyro is serviceable.
69      *
70      * @return true if the gyro is serviceable, false otherwise.
71      */
72     virtual bool is_serviceable () const;
73
74
75     /**
76      * Set the gyro's serviceability.
77      *
78      * @param serviceable true if the gyro is functional, false otherwise.
79      */
80     virtual void set_serviceable (bool serviceable);
81
82
83 private:
84
85     bool _serviceable;
86     double _power_norm;
87     double _spin_norm;
88
89 };
90
91 #endif // __INSTRUMENTATION_GYRO_HXX