/* * GPS.hpp * * Created on: Aug 17, 2025 * Author: jakoboberbuchner */ #ifndef AUTOPILOT_SHARED_DATA_GPS_HPP_ #define AUTOPILOT_SHARED_DATA_GPS_HPP_ #include #include namespace GPS { /*------------------ Enums ------------------*/ enum class NMEA_PositionFix : uint32_t { invalid = 0, // Fix not valid. gps_fix = 1, // GPS fix (SPS). differential_gps_fix = 2, // Differential GPS fix (DGNSS), SBAS, OmniSTAR VBS, Beacon, RTX in GVBS mode. not_applicable = 3, // Not applicable (or PPS fix in some older/non-standard implementations). rtk_fixed = 4, // RTK (Real-Time Kinematic) Fixed, xFill, RTX. rtk_float = 5, // RTK Float, OmniSTAR XP/HP, Location RTK, RTX. NOTE: Less accurate that Fixed dead_reckoning = 6, // INS (Inertial Navigation System) Dead Reckoning. }; /*------------------ Structs ------------------*/ struct Time { uint32_t year = 2000; uint8_t month = 1; uint8_t day = 1; uint8_t hour = 0; uint8_t minute = 0; float second = 0; }; struct Data { Time time; float latitude = 0.0; // Degrees (˚) float longitude = 0.0; // Degrees (˚) float altitude = 0.0; // Meters (MSL) float ground_speed = 0.0; // Knots float ground_speedKPH = 0.0; // Km/Hr float magnetic_heading = 0.0; // Degrees (˚M) float true_heading = 0.0; // Degrees (˚T) float magnetic_track = 0.0; // Degrees (˚M) float true_track = 0.0; // Degrees (˚T) float magnetic_variation = 0.0; // Degrees (˚) float HDOP = 0.0; // Horizontal Dilution of Precision float VDOP = 0.0; // Vertical Dilution of Precision NMEA_PositionFix fixValidity = NMEA_PositionFix::invalid; float geoid_seperation = 0.0; // Meters float diff_correction_age = 0.0; // Seconds (only used with DGPS) uint8_t satellites = 0; // Number of satellites in view bool isFixValid( void ) { return (fixValidity == NMEA_PositionFix::gps_fix) || (fixValidity == NMEA_PositionFix::differential_gps_fix) || (fixValidity == NMEA_PositionFix::rtk_fixed) || (fixValidity == NMEA_PositionFix::dead_reckoning); } }; } //namespace GPS #endif /* AUTOPILOT_SHARED_DATA_GPS_HPP_ */