Debian Codegraph @

src/Instrumentation/gyro.hxx

raw symbols SCIP
1 // gyro.hxx - simple model of a spinning gyro.
2
3 #pragma once
4
5 /**
6 * Simple model of a spinning gyro.
7 *
8 * The gyro decelerates gradually if no power is available to keep it
9 * spinning, and spins up quickly when power becomes available.
10 */
11 class Gyro
12 {
13 public:
14
15 /**
16 * Constructor.
17 */
18 Gyro ();
19
20 /**
21 * Destructor.
22 */
23 virtual ~Gyro ();
24
25 /**
26 * Reset the gyro.
27 */
28 void reinit(void);
29
30 /**
31 * Update the gyro.
32 *
33 * @param delta_time_sec The elapsed time since the last update.
34 * @param power_norm The power available to drive the gyro, from
35 * 0.0 to 1.0.
36 */
37 virtual void update (double delta_time_sec);
38
39
40 /**
41 * Set the power available to the gyro.
42 *
43 * @param power_norm The amount of power (vacuum or electrical)
44 * available to keep the gyro spinning, from 0.0 (none) to
45 * 1.0 (full power)
46 */
47 virtual void set_power_norm (double power_norm);
48
49
50 /**
51 * Get the gyro's current spin.
52 *
53 * @return The spin from 0.0 (not spinning) to 1.0 (full speed).
54 */
55 virtual double get_spin_norm () const;
56
57
58 /**
59 * Set the gyro's current spin.
60 *
61 * @spin_norm The spin from 0.0 (not spinning) to 1.0 (full speed).
62 */
63 virtual void set_spin_norm (double spin_norm);
64
65
66 /**
67 * Test if the gyro is serviceable.
68 *
69 * @return true if the gyro is serviceable, false otherwise.
70 */
71 virtual bool is_serviceable () const;
72
73
74 /**
75 * Set the gyro's serviceability.
76 *
77 * @param serviceable true if the gyro is functional, false otherwise.
78 */
79 virtual void set_serviceable (bool serviceable);
80
81 /**
82 * Set the gyro's spin up time in seconds (from 0 to full spin).
83 *
84 * @spin_up secs
85 */
86 virtual void set_spin_up(double spin_up);
87
88 /**
89 * Set the gyro's spin down time in seconds (from full spin to 0).
90 *
91 * @spin_down secs
92 */
93 virtual void set_spin_down(double spin_down);
94
95 private:
96
97 bool _serviceable;
98 double _power_norm;
99 double _spin_norm;
100 double _spin_down;
101 double _spin_up;
102 };