From 5bd01b926e4243a78589a0db546b389f92b5b938 Mon Sep 17 00:00:00 2001 From: Jakob Oberbuchner Date: Mon, 18 Aug 2025 15:49:27 -0500 Subject: [PATCH] WORKING + Starting creation --- DataExchange.hpp | 15 ---------- GPS.hpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ IMU.hpp | 15 ++++++++++ 3 files changed, 90 insertions(+), 15 deletions(-) delete mode 100644 DataExchange.hpp create mode 100644 GPS.hpp create mode 100644 IMU.hpp diff --git a/DataExchange.hpp b/DataExchange.hpp deleted file mode 100644 index ec85d23..0000000 --- a/DataExchange.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// DataExchange.hpp -// CppTests -// -// Created by Jakob Oberbuchner on 2025-08-15. -// - -#ifndef DataExchange_h -#define DataExchange_h - - - - - -#endif /* DataExchange_h */ diff --git a/GPS.hpp b/GPS.hpp new file mode 100644 index 0000000..4e0f3a9 --- /dev/null +++ b/GPS.hpp @@ -0,0 +1,75 @@ +/* + * 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_ */ diff --git a/IMU.hpp b/IMU.hpp new file mode 100644 index 0000000..5b97992 --- /dev/null +++ b/IMU.hpp @@ -0,0 +1,15 @@ +/* + * IMU.hpp + * + * Created on: Aug 17, 2025 + * Author: jakoboberbuchner + */ + +#ifndef AUTOPILOT_SHARED_DATA_IMU_HPP_ +#define AUTOPILOT_SHARED_DATA_IMU_HPP_ + + + + + +#endif /* AUTOPILOT_SHARED_DATA_IMU_HPP_ */