From 4a386ad3d18a8d19bb1466e413c2e0447ea284e1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 10 Mar 2023 15:21:36 +0100 Subject: [PATCH] simplification --- CHANGELOG.md | 3 ++- mission/controller/AcsController.cpp | 2 ++ mission/controller/acs/AcsParameters.h | 4 ++-- mission/system/objects/EiveSystem.cpp | 31 ++------------------------ 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48c18074..e153b91b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ will consitute of a breaking change warranting a new major release: ## Changed +- ACS CTRL transition to DETUBMLE is now done in CTRL internally. No + system level handling necessary anymore. - More fixes and improvements for SD card handling. Extend SD card setup in core controller to create full initial state for SD card manager are core controller as early as possible, turn execution of setup file update blocking. This might solve the issue with the SD card manager @@ -47,7 +49,6 @@ eive-tmtc: v2.17.2 ## Changed -- Move ACS event handling to system component. - Persistent TM stores will now create new files on each reboot. - Fast ACS subsystem commanding: Command SUS board consecutively with other devices now - Star Tracker: Use ground confguration for EM and flight config for FM by default. diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index ff0aa008..2ae2a7bd 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -198,6 +198,7 @@ void AcsController::performSafe() { detumbleCounter = 0; // Triggers detumble mode transition in subsystem triggerEvent(acs::SAFE_RATE_VIOLATION); + startTransition(mode, acs::SafeSubmode::DETUMBLE); } updateCtrlValData(errAng); @@ -245,6 +246,7 @@ void AcsController::performDetumble() { detumbleCounter = 0; // Triggers safe mode transition in subsystem triggerEvent(acs::SAFE_RATE_RECOVERY); + startTransition(mode, acs::SafeSubmode::DEFAULT); } disableCtrlValData(); diff --git a/mission/controller/acs/AcsParameters.h b/mission/controller/acs/AcsParameters.h index 11de10a3..8471fc44 100644 --- a/mission/controller/acs/AcsParameters.h +++ b/mission/controller/acs/AcsParameters.h @@ -924,8 +924,8 @@ class AcsParameters : public HasParametersIF { } magnetorquesParameter; struct DetumbleParameter { - uint8_t detumblecounter = 75; // 30 s - double omegaDetumbleStart = 2 * M_PI / 180; + uint8_t detumblecounter = 75; // 30 s + double omegaDetumbleStart = 0; // 2 * M_PI / 180; double omegaDetumbleEnd = 0.4 * M_PI / 180; double gainD = pow(10.0, -3.3); } detumbleParameter; diff --git a/mission/system/objects/EiveSystem.cpp b/mission/system/objects/EiveSystem.cpp index ee1db4c2..bb2a229d 100644 --- a/mission/system/objects/EiveSystem.cpp +++ b/mission/system/objects/EiveSystem.cpp @@ -1,5 +1,6 @@ #include "EiveSystem.h" +#include #include #include #include @@ -65,44 +66,16 @@ ReturnValue_t EiveSystem::initialize() { << std::endl; #endif return ObjectManagerIF::CHILD_INIT_FAILED; - ; } - result = - manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::MULTIPLE_RW_INVALID)); - if (result != returnvalue::OK) { - sif::error << "AcsSubsystem: Subscribing for acs::MULTIPLE_RW_INVALID failed" << std::endl; - } - result = manager->subscribeToEvent(eventQueue->getId(), - event::getEventId(acs::MEKF_INVALID_MODE_VIOLATION)); - if (result != returnvalue::OK) { - sif::error << "AcsSubsystem: Subscribing for acs::MULTIPLE_RW_INVALID failed" << std::endl; - } - return returnvalue::OK; + return Subsystem::initialize(); } void EiveSystem::handleEventMessages() { EventMessage event; for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK; result = eventQueue->receiveMessage(&event)) { - ReturnValue_t status; switch (event.getMessageId()) { case EventMessage::EVENT_MESSAGE: - if (event.getEvent() == acs::SAFE_RATE_VIOLATION) { - CommandMessage msg; - ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, acs::SafeSubmode::DETUMBLE); - status = commandQueue->sendMessage(commandQueue->getId(), &msg); - if (result != returnvalue::OK) { - sif::error << "AcsSubsystem: sending DETUMBLE mode cmd to self has failed" << std::endl; - } - } - if (event.getEvent() == acs::SAFE_RATE_RECOVERY) { - CommandMessage msg; - ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, acs::SafeSubmode::DEFAULT); - status = commandQueue->sendMessage(commandQueue->getId(), &msg); - if (status != returnvalue::OK) { - sif::error << "AcsSubsystem: sending SAFE mode cmd to self has failed" << std::endl; - } - } break; default: sif::debug << "AcsSubsystem::performChildOperation: Did not subscribe "