diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index 08e8760d..02c0e094 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -22,7 +22,8 @@ AcsController::AcsController(object_id_t objectId, bool enableHkSets) mekfData(this), ctrlValData(this), actuatorCmdData(this), - fusedRotRateData(this) {} + fusedRotRateData(this), + tleData(this) {} ReturnValue_t AcsController::initialize() { ReturnValue_t result = parameterHelper.initialize(); @@ -62,6 +63,26 @@ ReturnValue_t AcsController::executeAction(ActionId_t actionId, MessageQueueId_t mekfLost = false; return HasActionsIF::EXECUTION_FINISHED; } + case UPDATE_TLE: { + if (size != 69 * 2) { + return INVALID_PARAMETERS; + } + ReturnValue_t result = navigation.updateTle(data, data + 69); + if (result != returnvalue::OK) { + PoolReadGuard pg(&tleData); + navigation.updateTle(tleData.line1.value, tleData.line2.value); + return result; + } + { + PoolReadGuard pg(&tleData); + if (pg.getReadResult() == returnvalue::OK) { + std::memcpy(tleData.line1.value, data, 69); + std::memcpy(tleData.line2.value, data + 69, 69); + tleData.setValidity(true, true); + } + } + return HasActionsIF::EXECUTION_FINISHED; + } default: { return HasActionsIF::INVALID_ACTION_ID; } @@ -758,6 +779,9 @@ ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localD localDataPoolMap.emplace(acsctrl::PoolIds::ROT_RATE_PARALLEL, &rotRateParallel); localDataPoolMap.emplace(acsctrl::PoolIds::ROT_RATE_TOTAL, &rotRateTotal); poolManager.subscribeForRegularPeriodicPacket({fusedRotRateData.getSid(), enableHkSets, 10.0}); + // TLE Data + localDataPoolMap.emplace(acsctrl::PoolIds::TLE_LINE_1, &line1); + localDataPoolMap.emplace(acsctrl::PoolIds::TLE_LINE_2, &line2); return returnvalue::OK; } diff --git a/mission/controller/AcsController.h b/mission/controller/AcsController.h index a7dfbf6a..ef7817b9 100644 --- a/mission/controller/AcsController.h +++ b/mission/controller/AcsController.h @@ -84,6 +84,7 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes static const DeviceCommandId_t SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL = 0x0; static const DeviceCommandId_t RESET_MEKF = 0x1; static const DeviceCommandId_t RESTORE_MEKF_NONFINITE_RECOVERY = 0x2; + static const DeviceCommandId_t UPDATE_TLE = 0x3; static const uint8_t INTERFACE_ID = CLASS_ID::ACS_CTRL; //! [EXPORT] : [COMMENT] File deletion failed and at least one file is still existent. @@ -234,6 +235,11 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes PoolEntry rotRateParallel = PoolEntry(3); PoolEntry rotRateTotal = PoolEntry(3); + // TLE Dataset + acsctrl::TleData tleData; + PoolEntry line1 = PoolEntry(69); + PoolEntry line2 = PoolEntry(69); + // Initial delay to make sure all pool variables have been initialized their owners Countdown initialCountdown = Countdown(INIT_DELAY); };