]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/gps.hxx
Melchior FRANZ:
[flightgear.git] / src / Instrumentation / gps.hxx
1 // gps.hxx - distance-measuring equipment.
2 // Written by David Megginson, started 2003.
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6
7 #ifndef __INSTRUMENTS_GPS_HXX
8 #define __INSTRUMENTS_GPS_HXX 1
9
10 #ifndef __cplusplus
11 # error This library requires C++
12 #endif
13
14 #include <simgear/props/props.hxx>
15 #include <simgear/route/route.hxx>
16 #include <simgear/structure/subsystem_mgr.hxx>
17
18
19 /**
20  * Model a GPS radio.
21  *
22  * Input properties:
23  *
24  * /position/longitude-deg
25  * /position/latitude-deg
26  * /position/altitude-ft
27  * /environment/magnetic-variation-deg
28  * /systems/electrical/outputs/gps
29  * /instrumentation/gps/serviceable
30  * 
31  * /instrumentation/gps/wp-longitude-deg
32  * /instrumentation/gps/wp-latitude-deg
33  * /instrumentation/gps/wp-altitude-ft
34  * /instrumentation/gps/wp-ID
35  * /instrumentation/gps/wp-name
36  * /instrumentation/gps/desired-course-deg
37  * /instrumentation/gps/get-nearest-airport
38  * /instrumentation/gps/waypoint-type
39  * /instrumentation/gps/tracking-bug
40  *
41  * Output properties:
42  *
43  * /instrumentation/gps/indicated-longitude-deg
44  * /instrumentation/gps/indicated-latitude-deg
45  * /instrumentation/gps/indicated-altitude-ft
46  * /instrumentation/gps/indicated-vertical-speed-fpm
47  * /instrumentation/gps/indicated-track-true-deg
48  * /instrumentation/gps/indicated-track-magnetic-deg
49  * /instrumentation/gps/indicated-ground-speed-kt
50  *
51  * /instrumentation/gps/wp-distance-nm
52  * /instrumentation/gps/wp-bearing-deg
53  * /instrumentation/gps/wp-bearing-mag-deg
54  * /instrumentation/gps/TTW
55  * /instrumentation/gps/course-deviation-deg
56  * /instrumentation/gps/course-error-nm
57  * /instrumentation/gps/to-flag
58  * /instrumentation/gps/odometer
59  * /instrumentation/gps/trip-odometer
60  * /instrumentation/gps/true-bug-error-deg
61  * /instrumentation/gps/magnetic-bug-error-deg
62  * /instrumentation/gps/true-bearing-error-deg
63  * /instrumentation/gps/magnetic-bearing-error-deg
64  */
65 class GPS : public SGSubsystem
66 {
67
68 public:
69
70     GPS (SGPropertyNode *node);
71     GPS ();
72     virtual ~GPS ();
73
74     virtual void init ();
75     virtual void update (double delta_time_sec);
76
77 private:
78
79     void search (double frequency, double longitude_rad,
80                  double latitude_rad, double altitude_m);
81
82     SGPropertyNode_ptr _longitude_node;
83     SGPropertyNode_ptr _latitude_node;
84     SGPropertyNode_ptr _altitude_node;
85     SGPropertyNode_ptr _magvar_node;
86     SGPropertyNode_ptr _serviceable_node;
87     SGPropertyNode_ptr _electrical_node;
88     SGPropertyNode_ptr _wp0_longitude_node;
89     SGPropertyNode_ptr _wp0_latitude_node;
90     SGPropertyNode_ptr _wp0_altitude_node;
91     SGPropertyNode_ptr _wp0_ID_node;
92     SGPropertyNode_ptr _wp0_name_node;
93     SGPropertyNode_ptr _wp0_course_node;
94     SGPropertyNode_ptr _get_nearest_airport_node;
95     SGPropertyNode_ptr _wp0_waypoint_type_node;
96     SGPropertyNode_ptr _wp1_longitude_node;
97     SGPropertyNode_ptr _wp1_latitude_node;
98     SGPropertyNode_ptr _wp1_altitude_node;
99     SGPropertyNode_ptr _wp1_ID_node;
100     SGPropertyNode_ptr _wp1_name_node;
101     SGPropertyNode_ptr _wp1_course_node;
102     SGPropertyNode_ptr _wp1_waypoint_type_node;
103     SGPropertyNode_ptr _tracking_bug_node;
104
105     SGPropertyNode_ptr _raim_node;
106     SGPropertyNode_ptr _indicated_longitude_node;
107     SGPropertyNode_ptr _indicated_latitude_node;
108     SGPropertyNode_ptr _indicated_altitude_node;
109     SGPropertyNode_ptr _indicated_vertical_speed_node;
110     SGPropertyNode_ptr _true_track_node;
111     SGPropertyNode_ptr _magnetic_track_node;
112     SGPropertyNode_ptr _speed_node;
113     SGPropertyNode_ptr _wp0_distance_node;
114     SGPropertyNode_ptr _wp0_ttw_node;
115     SGPropertyNode_ptr _wp0_bearing_node;
116     SGPropertyNode_ptr _wp0_mag_bearing_node;
117     SGPropertyNode_ptr _wp0_course_deviation_node;
118     SGPropertyNode_ptr _wp0_course_error_nm_node;
119     SGPropertyNode_ptr _wp0_to_flag_node;
120     SGPropertyNode_ptr _wp1_distance_node;
121     SGPropertyNode_ptr _wp1_ttw_node;
122     SGPropertyNode_ptr _wp1_bearing_node;
123     SGPropertyNode_ptr _wp1_mag_bearing_node;
124     SGPropertyNode_ptr _wp1_course_deviation_node;
125     SGPropertyNode_ptr _wp1_course_error_nm_node;
126     SGPropertyNode_ptr _wp1_to_flag_node;
127     SGPropertyNode_ptr _odometer_node;
128     SGPropertyNode_ptr _trip_odometer_node;
129     SGPropertyNode_ptr _true_bug_error_node;
130     SGPropertyNode_ptr _magnetic_bug_error_node;
131     SGPropertyNode_ptr _true_wp0_bearing_error_node;
132     SGPropertyNode_ptr _magnetic_wp0_bearing_error_node;
133     SGPropertyNode_ptr _true_wp1_bearing_error_node;
134     SGPropertyNode_ptr _magnetic_wp1_bearing_error_node;
135     SGPropertyNode_ptr _leg_distance_node;
136     SGPropertyNode_ptr _leg_course_node;
137     SGPropertyNode_ptr _leg_magnetic_course_node;
138     SGPropertyNode_ptr _alt_dist_ratio_node;
139     SGPropertyNode_ptr _leg_course_deviation_node;
140     SGPropertyNode_ptr _leg_course_error_nm_node;
141     SGPropertyNode_ptr _leg_to_flag_node;
142     SGPropertyNode_ptr _alt_deviation_node;
143
144     SGPropertyNode *_route;
145     SGPropertyNode *addWp;
146     SGPropertyNode *popWp;
147
148     SGRoute *route;
149
150     bool _last_valid;
151     double _last_longitude_deg;
152     double _last_latitude_deg;
153     double _last_altitude_m;
154     double _last_speed_kts;
155
156     double _wp0_latitude_deg;
157     double _wp0_longitude_deg;
158     double _wp0_altitude_m;
159     double _wp1_latitude_deg;
160     double _wp1_longitude_deg;
161     double _wp1_altitude_m;
162     string _last_wp0_ID;
163     string _last_wp1_ID;
164
165     double _alt_dist_ratio;
166     double _distance_m;
167     double _course_deg;
168
169     double bias_length;
170     double bias_angle;
171     double azimuth_error;
172     double range_error;
173     double elapsed_time;
174
175     string name;
176     int num;
177
178 };
179
180
181 #endif // __INSTRUMENTS_GPS_HXX