| 1 | /* |
| 2 | * SPDX-FileName: heading_indicator.hxx |
| 3 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | * SPDX-FileContributor: Written by David Megginson, started 2002. |
| 5 | */ |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | |
| 10 | #include <simgear/props/props.hxx> |
| 11 | #include <simgear/structure/subsystem_mgr.hxx> |
| 12 | |
| 13 | #include "gyro.hxx" |
| 14 | |
| 15 | |
| 16 | /** |
| 17 | * Model a vacuum-powered heading indicator. |
| 18 | * |
| 19 | * Input properties: |
| 20 | * |
| 21 | * /instrumentation/"name"/serviceable |
| 22 | * /instrumentation/"name"/spin |
| 23 | * /instrumentation/"name"/offset-deg |
| 24 | * /orientation/heading-deg |
| 25 | * "vacuum_system"/suction-inhg |
| 26 | * |
| 27 | * Output properties: |
| 28 | * |
| 29 | * /instrumentation/"name"/indicated-heading-deg |
| 30 | */ |
| 31 | class HeadingIndicator : public SGSubsystem |
| 32 | { |
| 33 | public: |
| 34 | HeadingIndicator ( SGPropertyNode *node ); |
| 35 | HeadingIndicator (); |
| 36 | virtual ~HeadingIndicator (); |
| 37 | |
| 38 | // Subsystem API. |
| 39 | void bind() override; |
| 40 | void init() override; |
| 41 | void reinit() override; |
| 42 | void unbind() override; |
| 43 | void update(double dt) override; |
| 44 | |
| 45 | // Subsystem identification. |
| 46 | static const char* staticSubsystemClassId() { return "heading-indicator"; } |
| 47 | |
| 48 | private: |
| 49 | Gyro _gyro; |
| 50 | double _last_heading_deg; |
| 51 | |
| 52 | std::string _name; |
| 53 | int _num; |
| 54 | std::string _suction; |
| 55 | |
| 56 | SGPropertyNode_ptr _offset_node; |
| 57 | SGPropertyNode_ptr _heading_in_node; |
| 58 | SGPropertyNode_ptr _suction_node; |
| 59 | SGPropertyNode_ptr _heading_out_node; |
| 60 | SGPropertyNode_ptr _heading_bug_error_node; |
| 61 | SGPropertyNode_ptr _heading_bug_node; |
| 62 | }; |