FlightGear next
mag_compass.hxx
Go to the documentation of this file.
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
49class MagCompass : public SGSubsystem
50{
51public:
52 MagCompass ( SGPropertyNode *node);
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
64private:
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};
void init() override
virtual ~MagCompass()
MagCompass(SGPropertyNode *node)
void reinit() override
void update(double dt) override
static const char * staticSubsystemClassId()