2003-03-10 14:09:43 +00:00
|
|
|
// gps.hxx - distance-measuring equipment.
|
|
|
|
// Written by David Megginson, started 2003.
|
|
|
|
//
|
|
|
|
// This file is in the Public Domain and comes with no warranty.
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __INSTRUMENTS_GPS_HXX
|
|
|
|
#define __INSTRUMENTS_GPS_HXX 1
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
# error This library requires C++
|
|
|
|
#endif
|
|
|
|
|
2003-05-06 23:46:24 +00:00
|
|
|
#include <simgear/props/props.hxx>
|
2003-09-24 17:20:55 +00:00
|
|
|
#include <simgear/structure/subsystem_mgr.hxx>
|
2003-03-10 14:09:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Model a GPS radio.
|
|
|
|
*
|
|
|
|
* Input properties:
|
|
|
|
*
|
|
|
|
* /position/longitude-deg
|
|
|
|
* /position/latitude-deg
|
|
|
|
* /position/altitude-ft
|
|
|
|
* /environment/magnetic-variation-deg
|
|
|
|
* /systems/electrical/outputs/gps
|
|
|
|
* /instrumentation/gps/serviceable
|
2004-03-15 19:23:39 +00:00
|
|
|
*
|
|
|
|
* /instrumentation/gps/wp-longitude-deg
|
|
|
|
* /instrumentation/gps/wp-latitude-deg
|
|
|
|
* /instrumentation/gps/wp-ID
|
|
|
|
* /instrumentation/gps/wp-name
|
|
|
|
* /instrumentation/gps/course-deg
|
|
|
|
* /instrumentation/gps/get-nearest-airport
|
|
|
|
* /instrumentation/gps/waypoint-type
|
2003-03-10 14:09:43 +00:00
|
|
|
*
|
|
|
|
* Output properties:
|
|
|
|
*
|
2004-03-15 19:23:39 +00:00
|
|
|
* /instrumentation/gps/longitude-deg
|
|
|
|
* /instrumentation/gps/latitude-deg
|
|
|
|
* /instrumentation/gps/altitude-ft
|
|
|
|
* /instrumentation/gps/track-true-deg
|
|
|
|
* /instrumentation/gps/track-magnetic-deg
|
|
|
|
* /instrumentation/gps/ground-speed-kt
|
|
|
|
*
|
|
|
|
* /instrumentation/gps/wp-distance-m
|
|
|
|
* /instrumentation/gps/wp-bearing-deg
|
|
|
|
* /instrumentation/gps/TTW
|
|
|
|
* /instrumentation/gps/wp-bearing-deg
|
|
|
|
* /instrumentation/gps/radials/actual-deg
|
|
|
|
* /instrumentation/gps/course-deviation-deg
|
|
|
|
* /instrumentation/gps/course-error-nm
|
|
|
|
* /instrumentation/gps/to-flag
|
|
|
|
* /instrumentation/gps/odometer
|
|
|
|
* /instrumentation/gps/trip-odometer
|
2003-03-10 14:09:43 +00:00
|
|
|
*/
|
2003-09-24 17:20:55 +00:00
|
|
|
class GPS : public SGSubsystem
|
2003-03-10 14:09:43 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
GPS ();
|
|
|
|
virtual ~GPS ();
|
|
|
|
|
|
|
|
virtual void init ();
|
|
|
|
virtual void update (double delta_time_sec);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void search (double frequency, double longitude_rad,
|
|
|
|
double latitude_rad, double altitude_m);
|
|
|
|
|
|
|
|
SGPropertyNode_ptr _longitude_node;
|
|
|
|
SGPropertyNode_ptr _latitude_node;
|
|
|
|
SGPropertyNode_ptr _altitude_node;
|
|
|
|
SGPropertyNode_ptr _magvar_node;
|
|
|
|
SGPropertyNode_ptr _serviceable_node;
|
|
|
|
SGPropertyNode_ptr _electrical_node;
|
2004-03-15 19:23:39 +00:00
|
|
|
SGPropertyNode_ptr _wp_longitude_node;
|
|
|
|
SGPropertyNode_ptr _wp_latitude_node;
|
|
|
|
SGPropertyNode_ptr _wp_ID_node;
|
|
|
|
SGPropertyNode_ptr _wp_name_node;
|
|
|
|
SGPropertyNode_ptr _wp_course_node;
|
|
|
|
SGPropertyNode_ptr _get_nearest_airport_node;
|
|
|
|
SGPropertyNode_ptr _waypoint_type_node;
|
2003-03-10 14:09:43 +00:00
|
|
|
|
|
|
|
SGPropertyNode_ptr _raim_node;
|
|
|
|
SGPropertyNode_ptr _indicated_longitude_node;
|
|
|
|
SGPropertyNode_ptr _indicated_latitude_node;
|
|
|
|
SGPropertyNode_ptr _indicated_altitude_node;
|
|
|
|
SGPropertyNode_ptr _true_track_node;
|
|
|
|
SGPropertyNode_ptr _magnetic_track_node;
|
|
|
|
SGPropertyNode_ptr _speed_node;
|
2004-03-15 19:23:39 +00:00
|
|
|
SGPropertyNode_ptr _wp_distance_node;
|
|
|
|
SGPropertyNode_ptr _wp_ttw_node;
|
|
|
|
SGPropertyNode_ptr _wp_bearing_node;
|
|
|
|
SGPropertyNode_ptr _wp_actual_radial_node;
|
|
|
|
SGPropertyNode_ptr _wp_course_deviation_node;
|
|
|
|
SGPropertyNode_ptr _wp_course_error_nm_node;
|
|
|
|
SGPropertyNode_ptr _wp_to_flag_node;
|
|
|
|
SGPropertyNode_ptr _odometer_node;
|
|
|
|
SGPropertyNode_ptr _trip_odometer_node;
|
2003-03-10 14:09:43 +00:00
|
|
|
|
|
|
|
bool _last_valid;
|
|
|
|
double _last_longitude_deg;
|
|
|
|
double _last_latitude_deg;
|
|
|
|
double _last_altitude_m;
|
2004-03-15 19:23:39 +00:00
|
|
|
double _last_speed_kts;
|
|
|
|
|
|
|
|
double _wp_latitude;
|
|
|
|
double _wp_longitude;
|
|
|
|
string _last_wp_ID;
|
2003-03-10 14:09:43 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // __INSTRUMENTS_GPS_HXX
|