Debian Codegraph @

src/Instrumentation/mag_compass.hxx

raw symbols SCIP
1 /*
2 * SPDX-License-Identifier: CC0-1.0
3 *
4 * mag_compass.hxx - models a magnetic compass
5 * Written by David Megginson, started 2002.
6 *
7 * This file is in the Public Domain and comes with no warranty.
8 */
9
10 #pragma once
11
12 #ifndef __cplusplus
13 # error This library requires C++
14 #endif
15
16 #include <simgear/props/props.hxx>
17 #include <simgear/structure/subsystem_mgr.hxx>
18 #include <simgear/math/interpolater.hxx>
19
20
21 /**
22 * Model a magnetic compass.
23 *
24 * Input properties:
25 *
26 * /instrumentation/"name"/serviceable
27 * /instrumentation/"name"/pitch-offset-deg
28 * /instrumentation/"name"/max-pitch-deg
29 * /instrumentation/"name"/max-roll-deg
30 * /orientation/roll-deg
31 * /orientation/pitch-deg
32 * /orientation/heading-magnetic-deg
33 * /orientation/side-slip-deg
34 * /environment/magnetic-dip-deg
35 * /accelerations/pilot/north-accel-fps_sec
36 * /accelerations/pilot/east-accel-fps_sec
37 * /accelerations/pilot/down-accel-fps_sec
38 *
39 * Output properties:
40 *
41 * /instrumentation/"name"/indicated-heading-deg
42 * /instrumentation/"name"/pitch-deg
43 * /instrumentation/"name"/roll-deg
44 *
45 * Config properties:
46 * /instrumentation/"name"/fluid-viscosity
47 *
48 */
49 class MagCompass : public SGSubsystem
50 {
51 public:
52 MagCompass ( SGPropertyNode *node);
53 MagCompass ();
54 virtual ~MagCompass ();
55
56 // Subsystem API.
57 void init() override;
58 void reinit() override;
59 void update(double dt) override;
60
61 // Subsystem identification.
62 static const char* staticSubsystemClassId() { return "magnetic-compass"; }
63
64 private:
65 double _rate_degps;
66
67 double _last_pitch, _last_roll, _cfg_viscosity;
68
69 std::string _name;
70 int _num;
71 SGSharedPtr<SGInterpTable> _deviation_table;
72 SGPropertyNode_ptr _deviation_node;
73
74 SGPropertyNode_ptr _serviceable_node;
75 SGPropertyNode_ptr _pitch_offset_node;
76 SGPropertyNode_ptr _roll_node;
77 SGPropertyNode_ptr _pitch_node;
78 SGPropertyNode_ptr _heading_node;
79 SGPropertyNode_ptr _beta_node;
80 SGPropertyNode_ptr _dip_node;
81 SGPropertyNode_ptr _x_accel_node;
82 SGPropertyNode_ptr _y_accel_node;
83 SGPropertyNode_ptr _z_accel_node;
84 SGPropertyNode_ptr _fluid_viscosity;
85 SGPropertyNode_ptr _out_node;
86 SGPropertyNode_ptr _roll_out_node;
87 SGPropertyNode_ptr _pitch_out_node;
88 };