From 348b72088560a4990e38a85eebe3370c0c113776 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 3 Aug 2023 20:56:46 +0200 Subject: [PATCH 1/8] well this was easy --- linux/acs/GpsHyperionLinuxController.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index 900de0aa..6e594a08 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -217,6 +217,14 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { return returnvalue::FAILED; } + for (int idx = 0; idx < 12; idx++) { + sif::debug << "PRN:" << gps.skyview[idx].PRN << std::endl; + sif::debug << "Az:" << gps.skyview[idx].azimuth << std::endl; + sif::debug << "El:" << gps.skyview[idx].elevation << std::endl; + sif::debug << "SS:" << gps.skyview[idx].ss << std::endl; + sif::debug << "used:" << gps.skyview[idx].used << std::endl; + } + bool validFix = false; uint8_t newFix = 0; if (modeIsSet) { From 0c25b37c7be3e83af9619c24feb41c771fb3a7bc Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 4 Aug 2023 10:50:19 +0200 Subject: [PATCH 2/8] gps satellites signals to dataset --- linux/acs/GpsHyperionLinuxController.cpp | 41 ++++++++++--- linux/acs/GpsHyperionLinuxController.h | 3 + mission/acs/archive/GPSDefinitions.h | 78 ++++++++++++++++++------ 3 files changed, 96 insertions(+), 26 deletions(-) diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index 6e594a08..6e6b5b85 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -21,6 +21,7 @@ GpsHyperionLinuxController::GpsHyperionLinuxController(object_id_t objectId, obj bool enableHkSets, bool debugHyperionGps) : ExtendedControllerBase(objectId), gpsSet(this), + skyviewSet(this), enableHkSets(enableHkSets), debugHyperionGps(debugHyperionGps) {} @@ -90,6 +91,13 @@ ReturnValue_t GpsHyperionLinuxController::initializeLocalDataPool( localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry()); localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry()); poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), enableHkSets, 30.0}); + localDataPoolMap.emplace(GpsHyperion::SKYVIEW_UNIX_SECONDS, new PoolEntry()); + localDataPoolMap.emplace(GpsHyperion::PRN_ID, new PoolEntry()); + localDataPoolMap.emplace(GpsHyperion::AZIMUTH, new PoolEntry()); + localDataPoolMap.emplace(GpsHyperion::ELEVATION, new PoolEntry()); + localDataPoolMap.emplace(GpsHyperion::SIGNAL2NOISE, new PoolEntry()); + localDataPoolMap.emplace(GpsHyperion::USED, new PoolEntry()); + poolManager.subscribeForRegularPeriodicPacket({skyviewSet.getSid(), false, 120.0}); return returnvalue::OK; } @@ -208,7 +216,15 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { return returnvalue::FAILED; } } + ReturnValue_t result = handleCoreTelemetry(modeIsSet); + if (result != returnvalue::OK) { + return result; + } + result = handleSkyviewTelemetry(); + return result; +} +ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) { PoolReadGuard pg(&gpsSet); if (pg.getReadResult() != returnvalue::OK) { #if FSFW_VERBOSE_LEVEL >= 1 @@ -217,14 +233,6 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { return returnvalue::FAILED; } - for (int idx = 0; idx < 12; idx++) { - sif::debug << "PRN:" << gps.skyview[idx].PRN << std::endl; - sif::debug << "Az:" << gps.skyview[idx].azimuth << std::endl; - sif::debug << "El:" << gps.skyview[idx].elevation << std::endl; - sif::debug << "SS:" << gps.skyview[idx].ss << std::endl; - sif::debug << "used:" << gps.skyview[idx].used << std::endl; - } - bool validFix = false; uint8_t newFix = 0; if (modeIsSet) { @@ -377,6 +385,23 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { return returnvalue::OK; } +ReturnValue_t GpsHyperionLinuxController::handleSkyviewTelemetry() { + PoolReadGuard pg(&skyviewSet); + sif::debug << sizeof(gps.skyview[0].PRN) << std::endl; + if (pg.getReadResult() != returnvalue::OK) { + return returnvalue::FAILED; + } + skyviewSet.unixSeconds.value = gps.skyview_time; + for (int sat = 0; sat < GpsHyperion::MAX_SATELLITES; sat++) { + skyviewSet.prn_id.value[sat] = gps.skyview[sat].PRN; + skyviewSet.azimuth.value[sat] = gps.skyview[sat].azimuth; + skyviewSet.elevation.value[sat] = gps.skyview[sat].elevation; + skyviewSet.signal2noise.value[sat] = gps.skyview[sat].ss; + skyviewSet.used.value[sat] = gps.skyview[sat].used; + } + return returnvalue::OK; +} + void GpsHyperionLinuxController::overwriteTimeIfNotSane(timeval time, bool validFix) { if (not timeInit and validFix) { if (not utility::timeSanityCheck()) { diff --git a/linux/acs/GpsHyperionLinuxController.h b/linux/acs/GpsHyperionLinuxController.h index d5b1f637..c2d068bb 100644 --- a/linux/acs/GpsHyperionLinuxController.h +++ b/linux/acs/GpsHyperionLinuxController.h @@ -54,9 +54,12 @@ class GpsHyperionLinuxController : public ExtendedControllerBase { LocalDataPoolManager& poolManager) override; ReturnValue_t handleGpsReadData(); + ReturnValue_t handleCoreTelemetry(bool modeIsSet); + ReturnValue_t handleSkyviewTelemetry(); private: GpsPrimaryDataset gpsSet; + SkyviewDataset skyviewSet; gps_data_t gps = {}; bool enableHkSets = false; const char* currentClientBuf = nullptr; diff --git a/mission/acs/archive/GPSDefinitions.h b/mission/acs/archive/GPSDefinitions.h index d9f93173..d8fc3e84 100644 --- a/mission/acs/archive/GPSDefinitions.h +++ b/mission/acs/archive/GPSDefinitions.h @@ -20,32 +20,47 @@ static constexpr Event CANT_GET_FIX = event::makeEvent(SUBSYSTEM_ID, 1, severity static constexpr DeviceCommandId_t GPS_REPLY = 0; static constexpr DeviceCommandId_t TRIGGER_RESET_PIN_GNSS = 5; -static constexpr uint32_t DATASET_ID = 0; +enum SetIds : uint32_t { + CORE_DATASET, + SKYVIEW_DATASET, +}; enum GpsPoolIds : lp_id_t { - LATITUDE = 0, - LONGITUDE = 1, - ALTITUDE = 2, - SPEED = 3, - FIX_MODE = 4, - SATS_IN_USE = 5, - SATS_IN_VIEW = 6, - UNIX_SECONDS = 7, - YEAR = 8, - MONTH = 9, - DAY = 10, - HOURS = 11, - MINUTES = 12, - SECONDS = 13 + LATITUDE, + LONGITUDE, + ALTITUDE, + SPEED, + FIX_MODE, + SATS_IN_USE, + SATS_IN_VIEW, + UNIX_SECONDS, + YEAR, + MONTH, + DAY, + HOURS, + MINUTES, + SECONDS, + SKYVIEW_UNIX_SECONDS, + PRN_ID, + AZIMUTH, + ELEVATION, + SIGNAL2NOISE, + USED, }; +static constexpr uint8_t CORE_DATASET_ENTRIES = 14; +static constexpr uint8_t SKYVIEW_ENTRIES = 6; + +static constexpr uint8_t MAX_SATELLITES = 30; + enum GpsFixModes : uint8_t { INVALID = 0, NO_FIX = 1, FIX_2D = 2, FIX_3D = 3 }; } // namespace GpsHyperion -class GpsPrimaryDataset : public StaticLocalDataSet<18> { +class GpsPrimaryDataset : public StaticLocalDataSet { public: - GpsPrimaryDataset(object_id_t gpsId) : StaticLocalDataSet(sid_t(gpsId, GpsHyperion::DATASET_ID)) { + GpsPrimaryDataset(object_id_t gpsId) + : StaticLocalDataSet(sid_t(gpsId, GpsHyperion::CORE_DATASET)) { setAllVariablesReadOnly(); } @@ -69,7 +84,34 @@ class GpsPrimaryDataset : public StaticLocalDataSet<18> { friend class GpsHyperionLinuxController; friend class GpsCtrlDummy; GpsPrimaryDataset(HasLocalDataPoolIF* hkOwner) - : StaticLocalDataSet(hkOwner, GpsHyperion::DATASET_ID) {} + : StaticLocalDataSet(hkOwner, GpsHyperion::CORE_DATASET) {} +}; + +class SkyviewDataset : public StaticLocalDataSet { + public: + SkyviewDataset(object_id_t gpsId) + : StaticLocalDataSet(sid_t(gpsId, GpsHyperion::SKYVIEW_DATASET)) { + setAllVariablesReadOnly(); + } + + lp_var_t unixSeconds = + lp_var_t(sid.objectId, GpsHyperion::SKYVIEW_UNIX_SECONDS, this); + lp_vec_t prn_id = + lp_vec_t(sid.objectId, GpsHyperion::PRN_ID, this); + lp_vec_t azimuth = + lp_vec_t(sid.objectId, GpsHyperion::AZIMUTH, this); + lp_vec_t elevation = + lp_vec_t(sid.objectId, GpsHyperion::ELEVATION, this); + lp_vec_t signal2noise = + lp_vec_t(sid.objectId, GpsHyperion::SIGNAL2NOISE, this); + lp_vec_t used = + lp_vec_t(sid.objectId, GpsHyperion::USED, this); + + private: + friend class GpsHyperionLinuxController; + friend class GpsCtrlDummy; + SkyviewDataset(HasLocalDataPoolIF* hkOwner) + : StaticLocalDataSet(hkOwner, GpsHyperion::SKYVIEW_DATASET) {} }; #endif /* MISSION_ACS_ARCHIVE_GPSDEFINITIONS_H_ */ From 2952f1feb144dc08094b4e1e389191df37d61530 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 4 Aug 2023 12:22:31 +0200 Subject: [PATCH 3/8] fix --- mission/acs/archive/GPSDefinitions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/acs/archive/GPSDefinitions.h b/mission/acs/archive/GPSDefinitions.h index d8fc3e84..67169cbc 100644 --- a/mission/acs/archive/GPSDefinitions.h +++ b/mission/acs/archive/GPSDefinitions.h @@ -102,8 +102,8 @@ class SkyviewDataset : public StaticLocalDataSet { lp_vec_t(sid.objectId, GpsHyperion::AZIMUTH, this); lp_vec_t elevation = lp_vec_t(sid.objectId, GpsHyperion::ELEVATION, this); - lp_vec_t signal2noise = - lp_vec_t(sid.objectId, GpsHyperion::SIGNAL2NOISE, this); + lp_vec_t signal2noise = + lp_vec_t(sid.objectId, GpsHyperion::SIGNAL2NOISE, this); lp_vec_t used = lp_vec_t(sid.objectId, GpsHyperion::USED, this); From d91a71fb51a8c23be7b6c4e037db5ef420406b40 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 4 Aug 2023 12:22:47 +0200 Subject: [PATCH 4/8] remove debug output --- linux/acs/GpsHyperionLinuxController.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index 6e6b5b85..4c32b029 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -387,7 +387,6 @@ ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) { ReturnValue_t GpsHyperionLinuxController::handleSkyviewTelemetry() { PoolReadGuard pg(&skyviewSet); - sif::debug << sizeof(gps.skyview[0].PRN) << std::endl; if (pg.getReadResult() != returnvalue::OK) { return returnvalue::FAILED; } From 27cf93e6abf57515f08b6f91f65ce8f27fd4051b Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 4 Aug 2023 15:54:03 +0200 Subject: [PATCH 5/8] lets actually downlink both datasets --- linux/acs/GpsHyperionLinuxController.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index 4c32b029..b41661ec 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -30,7 +30,17 @@ GpsHyperionLinuxController::~GpsHyperionLinuxController() { gps_close(&gps); } -LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; } +LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) { + switch (sid.ownerSetId) { + case GpsHyperion::CORE_DATASET: + return &gpsSet; + case GpsHyperion::SKYVIEW_DATASET: + return &skyviewSet; + default: + return nullptr; + } + return nullptr; +} ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode, uint32_t *msToReachTheMode) { From 1e9d772d37492657868953ffb4ecc172c9efd01c Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 4 Aug 2023 16:28:06 +0200 Subject: [PATCH 6/8] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18ba4097..34740937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +- `eive-tmtc`: + +## Added + +- Skyview dataset for more GPS TM has been added + # [v6.3.0] 2023-08-03 ## Fixed From 185d86245bd412e89aad11abec089c9be1db4849 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 9 Aug 2023 11:29:52 +0200 Subject: [PATCH 7/8] HOW CAN ANYONE WORK WITH THIS SHITTY SPAM --- linux/acs/GpsHyperionLinuxController.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index b451c112..3da94d07 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -238,7 +238,9 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { } } if (gpsSet.fixMode.value != newFix) { +#if OBSW_Q7S_EM != 1 triggerEvent(GpsHyperion::GPS_FIX_CHANGE, gpsSet.fixMode.value, newFix); +#endif } gpsSet.fixMode = newFix; gpsSet.fixMode.setValid(modeIsSet); From a467dd790fd90803df34a303250d2f7e8222a6e5 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 9 Aug 2023 11:32:05 +0200 Subject: [PATCH 8/8] CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f1f275c..c6724fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ will consitute of a breaking change warranting a new major release: ## Fixed - The handling function of the GPS data is only called once per GPS read. This should remove the fake fix-has-changed events. + +## Changed +- GPS Fix has changed event is no longer triggered for the EM # [v6.3.0] 2023-08-03