From acba821afd3f3b1adc42444626d1d3476dfd1db5 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Tue, 31 Jan 2023 19:12:39 +0100 Subject: [PATCH 01/39] fixed uint to int --- mission/devices/devicedefinitions/imtqHandlerDefinitions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/devices/devicedefinitions/imtqHandlerDefinitions.h b/mission/devices/devicedefinitions/imtqHandlerDefinitions.h index b3598970..2abf1c21 100644 --- a/mission/devices/devicedefinitions/imtqHandlerDefinitions.h +++ b/mission/devices/devicedefinitions/imtqHandlerDefinitions.h @@ -489,7 +489,7 @@ class DipoleActuationSet : public StaticLocalDataSet<4> { // Refresh torque command without changing any of the set dipoles. void refreshTorqueing(uint16_t durationMs_) { currentTorqueDurationMs = durationMs_; } - void setDipoles(uint16_t xDipole_, uint16_t yDipole_, uint16_t zDipole_, + void setDipoles(int16_t xDipole_, int16_t yDipole_, int16_t zDipole_, uint16_t currentTorqueDurationMs_) { if (xDipole.value != xDipole_) { } @@ -503,7 +503,7 @@ class DipoleActuationSet : public StaticLocalDataSet<4> { currentTorqueDurationMs = currentTorqueDurationMs_; } - void getDipoles(uint16_t& xDipole_, uint16_t& yDipole_, uint16_t& zDipole_) { + void getDipoles(int16_t& xDipole_, int16_t& yDipole_, int16_t& zDipole_) { xDipole_ = xDipole.value; yDipole_ = yDipole.value; zDipole_ = zDipole.value; From 4bed0fd563ddf584b8001e273c064f2b513a90af Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 2 Feb 2023 10:47:58 +0100 Subject: [PATCH 02/39] scale dipole of controller to by the MTQ expected range --- mission/controller/acs/ActuatorCmd.cpp | 17 +++++++++-------- mission/controller/acs/ActuatorCmd.h | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mission/controller/acs/ActuatorCmd.cpp b/mission/controller/acs/ActuatorCmd.cpp index 2a0a9425..771f9d6f 100644 --- a/mission/controller/acs/ActuatorCmd.cpp +++ b/mission/controller/acs/ActuatorCmd.cpp @@ -54,21 +54,22 @@ void ActuatorCmd::cmdSpeedToRws(const int32_t *speedRw0, const int32_t *speedRw1 VectorOperations::add(speedRws, deltaSpeed, rwCmdSpeed, 4); } -void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, double *dipolMomentUnits) { - // Convert to Unit frame +void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, double *dipolMomentActuator) { + // Convert to actuator frame MatrixOperations::multiply(*acsParameters.magnetorquesParameter.inverseAlignment, - dipolMoment, dipolMomentUnits, 3, 3, 1); - // Scaling along largest element if dipol exceeds maximum + dipolMoment, dipolMomentActuator, 3, 3, 1); + // Scaling along largest element if dipol exceeds maximum double maxDipol = acsParameters.magnetorquesParameter.DipolMax; double maxValue = 0; for (int i = 0; i < 3; i++) { - if (abs(dipolMomentUnits[i]) > maxDipol) { - maxValue = abs(dipolMomentUnits[i]); + if (abs(dipolMomentActuator[i]) > maxDipol) { + maxValue = abs(dipolMomentActuator[i]); } } - if (maxValue > maxDipol) { double scalingFactor = maxDipol / maxValue; - VectorOperations::mulScalar(dipolMomentUnits, scalingFactor, dipolMomentUnits, 3); + VectorOperations::mulScalar(dipolMomentActuator, scalingFactor, dipolMomentActuator, 3); } + // scale dipole from 1 Am^2 to 1e^-4 Am^2 + VectorOperations::mulScalar(dipolMomentActuator, 1e4, dipolMomentActuator, 3); } diff --git a/mission/controller/acs/ActuatorCmd.h b/mission/controller/acs/ActuatorCmd.h index 5cb3ff00..181bf175 100644 --- a/mission/controller/acs/ActuatorCmd.h +++ b/mission/controller/acs/ActuatorCmd.h @@ -35,9 +35,9 @@ class ActuatorCmd { * @brief: cmdDipolMtq() gives the commanded dipol moment for the magnetorques * * @param: dipolMoment given dipol moment in spacecraft frame - * dipolMomentUnits resulting dipol moment for every unit + * dipolMomentActuator resulting dipol moment in actuator reference frame */ - void cmdDipolMtq(const double *dipolMoment, double *dipolMomentUnits); + void cmdDipolMtq(const double *dipolMoment, double *dipolMomentActuator); protected: private: From 8c03b2ec95171b8eefdd8f6e91f571f74034ba59 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 2 Feb 2023 10:56:14 +0100 Subject: [PATCH 03/39] bump changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15c4f12..03737313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ change warranting a new major release: - Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00) instead of unsegmented (0b11). +- Fixed usage of uint instead of int for commanding MTQ. Also fixed the range in which the ACS Ctrl + commands the MTQ to match the actual commanding range. # [v1.23.0] 2023-02-01 From 2b00d3a56595f8f19f20d042a84fc9c565fa752b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Feb 2023 16:27:50 +0100 Subject: [PATCH 04/39] ACS updates - Adapt ACS subsystem to handle events from ACS CTRL - Some fixes and updates for ACS subsystem --- CHANGELOG.md | 1 + fsfw | 2 +- linux/devices/GPSHyperionLinuxController.cpp | 3 + mission/acsDefs.h | 26 +++ mission/controller/AcsController.cpp | 19 +- mission/controller/AcsController.h | 10 - .../AcsControllerDefinitions.h | 14 -- mission/core/GenericFactory.cpp | 3 +- mission/system/objects/AcsSubsystem.cpp | 78 +++++++- mission/system/objects/AcsSubsystem.h | 6 + mission/system/tree/acsModeTree.cpp | 174 ++++++------------ mission/tmtc/CcsdsIpCoreHandler.cpp | 2 +- 12 files changed, 187 insertions(+), 151 deletions(-) create mode 100644 mission/acsDefs.h delete mode 100644 mission/controller/controllerdefinitions/AcsControllerDefinitions.h diff --git a/CHANGELOG.md b/CHANGELOG.md index b15c4f12..5cd9fc32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ change warranting a new major release: - Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00) instead of unsegmented (0b11). +- Set GPS set entries to invalid on MODE_OFF command. # [v1.23.0] 2023-02-01 diff --git a/fsfw b/fsfw index 01cc619e..f2461cd7 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 01cc619e67b84cef514b045377771ff1e11caf80 +Subproject commit f2461cd7e9df449e9ea4a842ca820d5002ef6494 diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 1799ef4a..d112d507 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -48,6 +48,9 @@ ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_ return HasModesIF::INVALID_MODE; } } + if (mode == MODE_OFF) { + gpsSet.setValidity(false, true); + } return returnvalue::OK; } diff --git a/mission/acsDefs.h b/mission/acsDefs.h new file mode 100644 index 00000000..ab182112 --- /dev/null +++ b/mission/acsDefs.h @@ -0,0 +1,26 @@ +#ifndef MISSION_ACSDEFS_H_ +#define MISSION_ACSDEFS_H_ + +#include + +namespace acs { + +enum CtrlSubmode { + OFF = HasModesIF::MODE_OFF, + SAFE = 2, + DETUMBLE = 3, + IDLE = 4, + PTG_NADIR = 5, + PTG_TARGET = 6, + PTG_TARGET_GS = 7, + PTG_INERTIAL = 8, +}; + +static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::ACS_SUBSYSTEM; +static const Event SAFE_RATE_VIOLATION = + MAKE_EVENT(0, severity::MEDIUM); //!< The limits for the rotation in safe mode were violated. +static constexpr Event SAFE_RATE_RECOVERY = MAKE_EVENT(1, severity::MEDIUM); + +} // namespace acs + +#endif /* MISSION_ACSDEFS_H_ */ diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index e684e4d4..2796bc8b 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -2,6 +2,7 @@ #include +#include "mission/acsDefs.h" #include "mission/config/torquer.h" AcsController::AcsController(object_id_t objectId) @@ -45,15 +46,15 @@ void AcsController::performControlOperation() { case InternalState::READY: { if (mode != MODE_OFF) { switch (submode) { - case SUBMODE_SAFE: + case acs::SAFE: performSafe(); break; - case SUBMODE_DETUMBLE: + case acs::DETUMBLE: performDetumble(); break; - case SUBMODE_PTG_TARGET: - case SUBMODE_PTG_NADIR: - case SUBMODE_PTG_INERTIAL: + case acs::PTG_TARGET: + case acs::PTG_NADIR: + case acs::PTG_INERTIAL: performPointingCtrl(); break; } @@ -151,9 +152,10 @@ void AcsController::performSafe() { detumbleCounter = 0; } if (detumbleCounter > acsParameters.detumbleParameter.detumblecounter) { - submode = SUBMODE_DETUMBLE; + // TODO: Trigger mode transition in ACS subsystem? + submode = acs::CtrlSubmode::DETUMBLE; detumbleCounter = 0; - triggerEvent(SAFE_RATE_VIOLATION); + triggerEvent(acs::SAFE_RATE_VIOLATION); } { @@ -208,7 +210,8 @@ void AcsController::performDetumble() { detumbleCounter = 0; } if (detumbleCounter > acsParameters.detumbleParameter.detumblecounter) { - submode = SUBMODE_SAFE; + // TODO: Trigger mode transition in subsystem instead + submode = acs::CtrlSubmode::DETUMBLE; detumbleCounter = 0; } diff --git a/mission/controller/AcsController.h b/mission/controller/AcsController.h index 1c4996b3..bc23fdaf 100644 --- a/mission/controller/AcsController.h +++ b/mission/controller/AcsController.h @@ -24,16 +24,6 @@ class AcsController : public ExtendedControllerBase { AcsController(object_id_t objectId); - static const Submode_t SUBMODE_SAFE = 2; - static const Submode_t SUBMODE_DETUMBLE = 3; - static const Submode_t SUBMODE_PTG_TARGET = 4; - static const Submode_t SUBMODE_PTG_NADIR = 5; - static const Submode_t SUBMODE_PTG_INERTIAL = 6; - - static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::ACS_SUBSYSTEM; - static const Event SAFE_RATE_VIOLATION = - MAKE_EVENT(0, severity::MEDIUM); //!< The limits for the rotation in safe mode were violated. - protected: void performSafe(); void performDetumble(); diff --git a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h deleted file mode 100644 index 8122178d..00000000 --- a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ -#define MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ - -#include - -namespace acs { - -enum CtrlModes { OFF = HasModesIF::MODE_OFF, SAFE = 1, DETUMBLE = 2, IDLE = 3, TARGET_PT = 4 }; - -static constexpr Submode_t IDLE_CHARGE = 1; - -} // namespace acs - -#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ */ diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 9c08726c..a5acd734 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -162,7 +162,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun pus::PUS_SERVICE_20); new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_200, 8); - HealthServiceCfg healthCfg(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID, *healthTable, 20); + HealthServiceCfg healthCfg(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID, *healthTable, + 20); new CServiceHealthCommanding(healthCfg); #if OBSW_ADD_CFDP_COMPONENTS == 1 diff --git a/mission/system/objects/AcsSubsystem.cpp b/mission/system/objects/AcsSubsystem.cpp index 96735ae9..5ae387ac 100644 --- a/mission/system/objects/AcsSubsystem.cpp +++ b/mission/system/objects/AcsSubsystem.cpp @@ -1,5 +1,81 @@ #include "AcsSubsystem.h" +#include +#include + +#include "fsfw/modes/ModeMessage.h" +#include "mission/acsDefs.h" + AcsSubsystem::AcsSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables) - : Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) {} + : Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) { + auto mqArgs = MqArgs(getObjectId(), static_cast(this)); + eventQueue = + QueueFactory::instance()->createMessageQueue(10, EventMessage::EVENT_MESSAGE_SIZE, &mqArgs); +} + +ReturnValue_t AcsSubsystem::initialize() { + EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); + if (manager == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "AcsSubsystem::initialize: Invalid event manager" << std::endl; +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + } + ReturnValue_t result = manager->registerListener(eventQueue->getId()); + if (result != returnvalue::OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "AcsSubsystem::registerListener: Failed to register as " + "listener" + << std::endl; +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + ; + } + result = manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_VIOLATION)); + if(result != returnvalue::OK) { + sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_VIOLATION failed" << std::endl; + } + result = manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_RECOVERY)); + if(result != returnvalue::OK) { + sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_RECOVERY failed" << std::endl; + } + return Subsystem::initialize(); +} + +void AcsSubsystem::performChildOperation() { + handleEventMessages(); + return Subsystem::performChildOperation(); +} + +void AcsSubsystem::handleEventMessages() { + EventMessage event; + for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK; + result = eventQueue->receiveMessage(&event)) { + switch (event.getMessageId()) { + case EventMessage::EVENT_MESSAGE: + if (event.getEvent() == acs::SAFE_RATE_VIOLATION) { + CommandMessage msg; + ModeMessage::setCmdModeModeMessage(msg, acs::CtrlSubmode::DETUMBLE, 0); + ReturnValue_t result = 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::setCmdModeModeMessage(msg, acs::CtrlSubmode::SAFE, 0); + ReturnValue_t result = commandQueue->sendMessage(commandQueue->getId(), &msg); + if (result != returnvalue::OK) { + sif::error << "AcsSubsystem: sending IDLE mode cmd to self has failed" << std::endl; + } + } + break; + default: + sif::debug << "AcsSubsystem::performChildOperation: Did not subscribe " + "to this event message" + << std::endl; + break; + } + } +} diff --git a/mission/system/objects/AcsSubsystem.h b/mission/system/objects/AcsSubsystem.h index 8673395a..df5bbbf3 100644 --- a/mission/system/objects/AcsSubsystem.h +++ b/mission/system/objects/AcsSubsystem.h @@ -8,6 +8,12 @@ class AcsSubsystem : public Subsystem { AcsSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables); private: + ReturnValue_t initialize() override; + void performChildOperation() override; + + void handleEventMessages(); + + MessageQueueIF* eventQueue = nullptr; }; #endif /* MISSION_SYSTEM_ACSSUBSYSTEM_H_ */ diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index 8eaf36d9..f5a1df23 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -7,7 +7,7 @@ #include #include "eive/objects.h" -#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" +#include "mission/acsDefs.h" #include "util.h" Subsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24); @@ -20,64 +20,62 @@ void buildOffSequence(Subsystem& ss, ModeListEntry& eh); void buildDetumbleSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildSafeSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildIdleSequence(Subsystem& ss, ModeListEntry& entryHelper); -void buildIdleChargeSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem& ss, ModeListEntry& entryHelper); } // namespace static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; -auto ACS_SEQUENCE_OFF = - std::make_pair(acs::CtrlModes::OFF << 24, FixedArrayList()); +auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlSubmode::OFF, FixedArrayList()); auto ACS_TABLE_OFF_TGT = - std::make_pair((acs::CtrlModes::OFF << 24) | 1, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::OFF << 24) | 1, FixedArrayList()); auto ACS_TABLE_OFF_TRANS = - std::make_pair((acs::CtrlModes::OFF << 24) | 2, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::OFF << 24) | 2, FixedArrayList()); auto ACS_SEQUENCE_DETUMBLE = - std::make_pair(acs::CtrlModes::DETUMBLE << 24, FixedArrayList()); + std::make_pair(acs::CtrlSubmode::DETUMBLE, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TGT = - std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 1, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 1, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_0 = - std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 2, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 2, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_1 = - std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 3, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 3, FixedArrayList()); -auto ACS_SEQUENCE_SAFE = - std::make_pair(acs::CtrlModes::SAFE << 24, FixedArrayList()); +auto ACS_SEQUENCE_SAFE = std::make_pair(acs::CtrlSubmode::SAFE, FixedArrayList()); auto ACS_TABLE_SAFE_TGT = - std::make_pair((acs::CtrlModes::SAFE << 24) | 1, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::SAFE << 24) | 1, FixedArrayList()); auto ACS_TABLE_SAFE_TRANS_0 = - std::make_pair((acs::CtrlModes::SAFE << 24) | 2, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::SAFE << 24) | 2, FixedArrayList()); auto ACS_TABLE_SAFE_TRANS_1 = - std::make_pair((acs::CtrlModes::SAFE << 24) | 3, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::SAFE << 24) | 3, FixedArrayList()); -auto ACS_SEQUENCE_IDLE = - std::make_pair(acs::CtrlModes::IDLE << 24, FixedArrayList()); +auto ACS_SEQUENCE_IDLE = std::make_pair(acs::CtrlSubmode::IDLE, FixedArrayList()); auto ACS_TABLE_IDLE_TGT = - std::make_pair((acs::CtrlModes::IDLE << 24) | 1, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::IDLE << 24) | 1, FixedArrayList()); auto ACS_TABLE_IDLE_TRANS_0 = - std::make_pair((acs::CtrlModes::IDLE << 24) | 2, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::IDLE << 24) | 2, FixedArrayList()); auto ACS_TABLE_IDLE_TRANS_1 = - std::make_pair((acs::CtrlModes::IDLE << 24) | 3, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::IDLE << 24) | 3, FixedArrayList()); -auto ACS_SEQUENCE_IDLE_CHRG = std::make_pair(acs::CtrlModes::IDLE << 24 | (acs::IDLE_CHARGE << 8), - FixedArrayList()); -auto ACS_TABLE_IDLE_CHRG_TGT = std::make_pair( - (acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 1, FixedArrayList()); -auto ACS_TABLE_IDLE_CHRG_TRANS_0 = std::make_pair( - (acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 2, FixedArrayList()); -auto ACS_TABLE_IDLE_CHRG_TRANS_1 = std::make_pair( - (acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 3, FixedArrayList()); +auto ACS_SEQUENCE_PTG_TARGET = + std::make_pair(acs::CtrlSubmode::PTG_TARGET, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_TGT = + std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 1, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_TRANS_0 = + std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 2, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_TRANS_1 = + std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 3, FixedArrayList()); -auto ACS_SEQUENCE_TARGET_PT = - std::make_pair(acs::CtrlModes::TARGET_PT, FixedArrayList()); +/* +auto ACS_SEQUENCE_PTG_TARGET = + std::make_pair(acs::CtrlSubmode::TARGET_PT, FixedArrayList()); auto ACS_TABLE_TARGET_PT_TGT = - std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 1, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 1, FixedArrayList()); auto ACS_TABLE_TARGET_PT_TRANS_0 = - std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 2, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 2, FixedArrayList()); auto ACS_TABLE_TARGET_PT_TRANS_1 = - std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList()); + std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 3, FixedArrayList()); +*/ void satsystem::acs::init() { ModeListEntry entry; @@ -85,9 +83,8 @@ void satsystem::acs::init() { buildSafeSequence(ACS_SUBSYSTEM, entry); buildDetumbleSequence(ACS_SUBSYSTEM, entry); buildIdleSequence(ACS_SUBSYSTEM, entry); - buildIdleChargeSequence(ACS_SUBSYSTEM, entry); buildTargetPtSequence(ACS_SUBSYSTEM, entry); - ACS_SUBSYSTEM.setInitialMode(HasModesIF::MODE_OFF); + ACS_SUBSYSTEM.setInitialMode(::acs::CtrlSubmode::SAFE); } namespace { @@ -151,7 +148,7 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; // Build SAFE target - iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TGT.second); + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::SAFE, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); @@ -167,7 +164,7 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { ctxc); // Build SAFE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); check(ss.addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), ctxc); @@ -200,7 +197,7 @@ void buildDetumbleSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; // Build DETUMBLE target - iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); @@ -218,7 +215,7 @@ void buildDetumbleSequence(Subsystem& ss, ModeListEntry& eh) { ctxc); // Build DETUMBLE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true), ctxc); @@ -252,7 +249,7 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; // Build IDLE target - iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TGT.second); + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::IDLE, 0, ACS_TABLE_IDLE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TGT.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second); @@ -264,11 +261,11 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); - iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_TRANS_0.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); ss.addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true); // Build IDLE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TRANS_1.second); + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::IDLE, 0, ACS_TABLE_IDLE_TRANS_1.second); ss.addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true); // Build IDLE sequence @@ -279,60 +276,6 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { true); } -void buildIdleChargeSequence(Subsystem& ss, ModeListEntry& eh) { - std::string context = "satsystem::acs::buildIdleChargeSequence"; - auto ctxc = context.c_str(); - // Insert Helper Table - auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, - ArrayList& sequence) { - eh.setObject(obj); - eh.setMode(mode); - eh.setSubmode(submode); - check(sequence.insert(eh), ctxc); - }; - // Insert Helper Sequence - auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, - bool checkSuccess) { - eh.setTableId(tableId); - eh.setWaitSeconds(waitSeconds); - eh.setCheckSuccess(checkSuccess); - check(sequence.insert(eh), ctxc); - }; - // Build IDLE target - iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, - ACS_TABLE_IDLE_CHRG_TGT.second); - iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); - iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); - iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); - check(ss.addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true), - ctxc); - - // Build IDLE transition 0 - iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); - iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); - iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); - iht(objects::RW_ASS, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); - iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); - check(ss.addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false, - true), - ctxc); - - // Build IDLE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, - ACS_TABLE_IDLE_CHRG_TRANS_1.second); - check(ss.addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false, - true), - ctxc); - - // Build IDLE sequence - ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TGT.first, 0, true); - ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, 0, true); - ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, 0, false); - check(ss.addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first, - ACS_SEQUENCE_SAFE.first, false, true), - ctxc); -} - void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildTargetPtSequence"; auto ctxc = context.c_str(); @@ -354,36 +297,37 @@ void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { }; // Build TARGET PT table - iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TGT.second); - iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - check(ss.addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true), + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::PTG_TARGET, 0, ACS_TABLE_PTG_TARGET_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); + check(ss.addTable(&ACS_TABLE_PTG_TARGET_TGT.second, ACS_TABLE_PTG_TARGET_TGT.first, false, true), ctxc); // Build TARGET PT transition 0 - iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - check(ss.addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); + check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_0.second, ACS_TABLE_PTG_TARGET_TRANS_0.first, false, true), ctxc); // Build TARGET PT transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second); - check(ss.addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, + iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::PTG_TARGET, 0, + ACS_TABLE_PTG_TARGET_TRANS_1.second); + check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_1.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, false, true), ctxc); // Build IDLE sequence - ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, true); - ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, true); - ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false); - check(ss.addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, + ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TGT.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, false); + check(ss.addSequence(&ACS_SEQUENCE_PTG_TARGET.second, ACS_SEQUENCE_PTG_TARGET.first, ACS_SEQUENCE_IDLE.first, false, true), ctxc); } diff --git a/mission/tmtc/CcsdsIpCoreHandler.cpp b/mission/tmtc/CcsdsIpCoreHandler.cpp index 85d1143b..02089da8 100644 --- a/mission/tmtc/CcsdsIpCoreHandler.cpp +++ b/mission/tmtc/CcsdsIpCoreHandler.cpp @@ -361,7 +361,7 @@ void CcsdsIpCoreHandler::checkTxTimer() { } if (transmitterCountdown.hasTimedOut()) { disableTransmit(); - //TODO: set mode to off (move timer to subsystem) + // TODO: set mode to off (move timer to subsystem) } } From a5997c773f388338c5cf97f4ef4f65ea0a4ecbc7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Feb 2023 17:12:22 +0100 Subject: [PATCH 05/39] host compiles --- mission/acsDefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mission/acsDefs.h b/mission/acsDefs.h index ab182112..d17351a6 100644 --- a/mission/acsDefs.h +++ b/mission/acsDefs.h @@ -1,6 +1,7 @@ #ifndef MISSION_ACSDEFS_H_ #define MISSION_ACSDEFS_H_ +#include #include namespace acs { From aaac3b24b2ede8760b687751d70d0d98f1cc20f9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Feb 2023 17:14:48 +0100 Subject: [PATCH 06/39] update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cd9fc32..fe417267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,12 @@ change warranting a new major release: instead of unsegmented (0b11). - Set GPS set entries to invalid on MODE_OFF command. +## Changed + +- Update and tweak ACS subsystem to represent the actual ACS design +- Event handling in the ACS subsystem for events triggered by the ACS controller. + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/365 + # [v1.23.0] 2023-02-01 TMTC version: v2.9.0 From 7226f02d4b69962c7147e575fec7d50fa6521a91 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Feb 2023 18:22:07 +0100 Subject: [PATCH 07/39] bump tmtc and fsfw --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 01cc619e..f2461cd7 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 01cc619e67b84cef514b045377771ff1e11caf80 +Subproject commit f2461cd7e9df449e9ea4a842ca820d5002ef6494 diff --git a/tmtc b/tmtc index c633893d..b4e42280 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit c633893df43030bb26b8422604b569bf8419d454 +Subproject commit b4e4228040e5b77169fdd92c5577d6f58d318275 From 5a54d4e1ed2a6e8ed221301c3f7eb78bec16c25c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Feb 2023 18:22:28 +0100 Subject: [PATCH 08/39] afmt --- mission/core/GenericFactory.cpp | 3 ++- mission/tmtc/CcsdsIpCoreHandler.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 9c08726c..a5acd734 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -162,7 +162,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun pus::PUS_SERVICE_20); new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_200, 8); - HealthServiceCfg healthCfg(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID, *healthTable, 20); + HealthServiceCfg healthCfg(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID, *healthTable, + 20); new CServiceHealthCommanding(healthCfg); #if OBSW_ADD_CFDP_COMPONENTS == 1 diff --git a/mission/tmtc/CcsdsIpCoreHandler.cpp b/mission/tmtc/CcsdsIpCoreHandler.cpp index 85d1143b..02089da8 100644 --- a/mission/tmtc/CcsdsIpCoreHandler.cpp +++ b/mission/tmtc/CcsdsIpCoreHandler.cpp @@ -361,7 +361,7 @@ void CcsdsIpCoreHandler::checkTxTimer() { } if (transmitterCountdown.hasTimedOut()) { disableTransmit(); - //TODO: set mode to off (move timer to subsystem) + // TODO: set mode to off (move timer to subsystem) } } From e6bafd51dc1de3cb3221bef52e2e415b42869e06 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Feb 2023 18:37:56 +0100 Subject: [PATCH 09/39] prepare v1.23.1 --- CHANGELOG.md | 6 ++++++ CMakeLists.txt | 2 +- fsfw | 2 +- tmtc | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15c4f12..52d52e98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,10 +17,16 @@ change warranting a new major release: # [unreleased] +# [v1.23.1] 2023-02-02 + +TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 + ## Fixed - Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00) instead of unsegmented (0b11). +- Bugfix in FSFW where the MGM RM3100 value Z axis data was parse incorrectly. + PR: https://egit.irs.uni-stuttgart.de/eive/fsfw/pulls/123 # [v1.23.0] 2023-02-01 diff --git a/CMakeLists.txt b/CMakeLists.txt index 55f4afe4..e9c51a6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 1) set(OBSW_VERSION_MINOR_IF_GIT_FAILS 23) -set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0) +set(OBSW_VERSION_REVISION_IF_GIT_FAILS 1) # set(CMAKE_VERBOSE TRUE) diff --git a/fsfw b/fsfw index f2461cd7..3250bbf2 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit f2461cd7e9df449e9ea4a842ca820d5002ef6494 +Subproject commit 3250bbf269b3326683222bb87ce7faecae63ad97 diff --git a/tmtc b/tmtc index b4e42280..15adb9bf 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b4e4228040e5b77169fdd92c5577d6f58d318275 +Subproject commit 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 From daa7c6652dd09c9247a4791154faec3bdab337bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 10:21:17 +0100 Subject: [PATCH 10/39] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b40eaa46..666fb053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 ## Changed +- ACS Subsystem Sequence Mode IDs updated. + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/365 - Update and tweak ACS subsystem to represent the actual ACS design - Event handling in the ACS subsystem for events triggered by the ACS controller. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/365 From 4615b2fe169ccde83e22ad050abbe95d358fca75 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 10:51:08 +0100 Subject: [PATCH 11/39] bumpchangelog --- CHANGELOG.md | 1 + tmtc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 666fb053..2f36f965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 - ACS Subsystem Sequence Mode IDs updated. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/365 + TMTC PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/130 - Update and tweak ACS subsystem to represent the actual ACS design - Event handling in the ACS subsystem for events triggered by the ACS controller. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/365 diff --git a/tmtc b/tmtc index 28c367c6..b9f58e06 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 28c367c6fb959b180fa5ead858e508178454891e +Subproject commit b9f58e061275392a867701f67a13d0c718d652be From c2100cc7821a2dbff366a4ace595a8838193ac55 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 10:51:56 +0100 Subject: [PATCH 12/39] overhead comment --- mission/acsDefs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/acsDefs.h b/mission/acsDefs.h index d17351a6..3c589f5c 100644 --- a/mission/acsDefs.h +++ b/mission/acsDefs.h @@ -18,9 +18,9 @@ enum CtrlSubmode { }; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::ACS_SUBSYSTEM; +//!< The limits for the rotation in safe mode were violated. static const Event SAFE_RATE_VIOLATION = - MAKE_EVENT(0, severity::MEDIUM); //!< The limits for the rotation in safe mode were violated. -static constexpr Event SAFE_RATE_RECOVERY = MAKE_EVENT(1, severity::MEDIUM); + MAKE_EVENT(0, severity::MEDIUM); static constexpr Event SAFE_RATE_RECOVERY = MAKE_EVENT(1, severity::MEDIUM); } // namespace acs From ef0a78dedb781ff10fc10f31dccafc2be28b59c8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 10:52:39 +0100 Subject: [PATCH 13/39] afmt --- mission/acsDefs.h | 5 +++-- mission/system/objects/AcsSubsystem.cpp | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/mission/acsDefs.h b/mission/acsDefs.h index 3c589f5c..34d29ebf 100644 --- a/mission/acsDefs.h +++ b/mission/acsDefs.h @@ -19,8 +19,9 @@ enum CtrlSubmode { static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::ACS_SUBSYSTEM; //!< The limits for the rotation in safe mode were violated. -static const Event SAFE_RATE_VIOLATION = - MAKE_EVENT(0, severity::MEDIUM); static constexpr Event SAFE_RATE_RECOVERY = MAKE_EVENT(1, severity::MEDIUM); +static const Event SAFE_RATE_VIOLATION = MAKE_EVENT(0, severity::MEDIUM); +//!< The system has recovered from a safe rate rotation violation. +static constexpr Event SAFE_RATE_RECOVERY = MAKE_EVENT(1, severity::MEDIUM); } // namespace acs diff --git a/mission/system/objects/AcsSubsystem.cpp b/mission/system/objects/AcsSubsystem.cpp index 5ae387ac..f5b8a0ce 100644 --- a/mission/system/objects/AcsSubsystem.cpp +++ b/mission/system/objects/AcsSubsystem.cpp @@ -32,20 +32,22 @@ ReturnValue_t AcsSubsystem::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; ; } - result = manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_VIOLATION)); - if(result != returnvalue::OK) { - sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_VIOLATION failed" << std::endl; + result = + manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_VIOLATION)); + if (result != returnvalue::OK) { + sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_VIOLATION failed" << std::endl; } - result = manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_RECOVERY)); - if(result != returnvalue::OK) { - sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_RECOVERY failed" << std::endl; + result = + manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_RECOVERY)); + if (result != returnvalue::OK) { + sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_RECOVERY failed" << std::endl; } return Subsystem::initialize(); } void AcsSubsystem::performChildOperation() { - handleEventMessages(); - return Subsystem::performChildOperation(); + handleEventMessages(); + return Subsystem::performChildOperation(); } void AcsSubsystem::handleEventMessages() { From b3a5c94f02800a9c14ea7eba688f3f3df3cfb534 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 10:53:16 +0100 Subject: [PATCH 14/39] update events --- generators/bsp_q7s_events.csv | 3 ++- generators/events/translateEvents.cpp | 7 +++++-- generators/objects/translateObjects.cpp | 2 +- linux/fsfwconfig/events/translateEvents.cpp | 7 +++++-- linux/fsfwconfig/objects/translateObjects.cpp | 2 +- tmtc | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 666710e8..2e39b641 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -84,7 +84,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 10800;0x2a30;STORE_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h 10801;0x2a31;MSG_QUEUE_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h 10802;0x2a32;SERIALIZATION_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h -11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;;mission/controller/AcsController.h +11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;;mission/acsDefs.h +11201;0x2bc1;SAFE_RATE_RECOVERY;MEDIUM;;mission/acsDefs.h 11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h 11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h 11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;;mission/devices/devicedefinitions/powerDefinitions.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 65f118b2..e810f4d1 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 244 translations. + * @brief Auto-generated event translation file. Contains 245 translations. * @details - * Generated on: 2023-02-01 19:42:11 + * Generated on: 2023-02-03 10:52:53 */ #include "translateEvents.h" @@ -91,6 +91,7 @@ const char *STORE_ERROR_STRING = "STORE_ERROR"; const char *MSG_QUEUE_ERROR_STRING = "MSG_QUEUE_ERROR"; const char *SERIALIZATION_ERROR_STRING = "SERIALIZATION_ERROR"; const char *SAFE_RATE_VIOLATION_STRING = "SAFE_RATE_VIOLATION"; +const char *SAFE_RATE_RECOVERY_STRING = "SAFE_RATE_RECOVERY"; const char *SWITCH_CMD_SENT_STRING = "SWITCH_CMD_SENT"; const char *SWITCH_HAS_CHANGED_STRING = "SWITCH_HAS_CHANGED"; const char *SWITCHING_Q7S_DENIED_STRING = "SWITCHING_Q7S_DENIED"; @@ -419,6 +420,8 @@ const char *translateEvents(Event event) { return SERIALIZATION_ERROR_STRING; case (11200): return SAFE_RATE_VIOLATION_STRING; + case (11201): + return SAFE_RATE_RECOVERY_STRING; case (11300): return SWITCH_CMD_SENT_STRING; case (11301): diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index fdc28d47..9707189d 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 152 translations. - * Generated on: 2023-02-01 19:42:11 + * Generated on: 2023-02-03 10:52:53 */ #include "translateObjects.h" diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 65f118b2..e810f4d1 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 244 translations. + * @brief Auto-generated event translation file. Contains 245 translations. * @details - * Generated on: 2023-02-01 19:42:11 + * Generated on: 2023-02-03 10:52:53 */ #include "translateEvents.h" @@ -91,6 +91,7 @@ const char *STORE_ERROR_STRING = "STORE_ERROR"; const char *MSG_QUEUE_ERROR_STRING = "MSG_QUEUE_ERROR"; const char *SERIALIZATION_ERROR_STRING = "SERIALIZATION_ERROR"; const char *SAFE_RATE_VIOLATION_STRING = "SAFE_RATE_VIOLATION"; +const char *SAFE_RATE_RECOVERY_STRING = "SAFE_RATE_RECOVERY"; const char *SWITCH_CMD_SENT_STRING = "SWITCH_CMD_SENT"; const char *SWITCH_HAS_CHANGED_STRING = "SWITCH_HAS_CHANGED"; const char *SWITCHING_Q7S_DENIED_STRING = "SWITCHING_Q7S_DENIED"; @@ -419,6 +420,8 @@ const char *translateEvents(Event event) { return SERIALIZATION_ERROR_STRING; case (11200): return SAFE_RATE_VIOLATION_STRING; + case (11201): + return SAFE_RATE_RECOVERY_STRING; case (11300): return SWITCH_CMD_SENT_STRING; case (11301): diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index fdc28d47..9707189d 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 152 translations. - * Generated on: 2023-02-01 19:42:11 + * Generated on: 2023-02-03 10:52:53 */ #include "translateObjects.h" diff --git a/tmtc b/tmtc index b9f58e06..a39e9427 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b9f58e061275392a867701f67a13d0c718d652be +Subproject commit a39e94279b0d77b9d21a996d87090d69fd4b3222 From 2c2c73b23fa9b29d80c27f577e30193252129525 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 11:25:03 +0100 Subject: [PATCH 15/39] fixes and updates for ACS mode tree --- mission/acsDefs.h | 4 +- mission/controller/AcsController.cpp | 4 +- mission/system/tree/acsModeTree.cpp | 172 ++++++++++++++++++++------- 3 files changed, 134 insertions(+), 46 deletions(-) diff --git a/mission/acsDefs.h b/mission/acsDefs.h index 34d29ebf..2bb536f2 100644 --- a/mission/acsDefs.h +++ b/mission/acsDefs.h @@ -11,10 +11,10 @@ enum CtrlSubmode { SAFE = 2, DETUMBLE = 3, IDLE = 4, - PTG_NADIR = 5, + PTG_TARGET_NADIR = 5, PTG_TARGET = 6, PTG_TARGET_GS = 7, - PTG_INERTIAL = 8, + PTG_TARGET_INERTIAL = 8, }; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::ACS_SUBSYSTEM; diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index 2796bc8b..a2ff9edf 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -53,8 +53,8 @@ void AcsController::performControlOperation() { performDetumble(); break; case acs::PTG_TARGET: - case acs::PTG_NADIR: - case acs::PTG_INERTIAL: + case acs::PTG_TARGET_NADIR: + case acs::PTG_TARGET_INERTIAL: performPointingCtrl(); break; } diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index f5a1df23..6c27b160 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -20,7 +20,11 @@ void buildOffSequence(Subsystem& ss, ModeListEntry& eh); void buildDetumbleSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildSafeSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildIdleSequence(Subsystem& ss, ModeListEntry& entryHelper); +void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh); void buildTargetPtSequence(Subsystem& ss, ModeListEntry& entryHelper); +void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& entryHelper); +void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& entryHelper); + } // namespace static const auto OFF = HasModesIF::MODE_OFF; @@ -29,8 +33,10 @@ static const auto NML = DeviceHandlerIF::MODE_NORMAL; auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlSubmode::OFF, FixedArrayList()); auto ACS_TABLE_OFF_TGT = std::make_pair((acs::CtrlSubmode::OFF << 24) | 1, FixedArrayList()); -auto ACS_TABLE_OFF_TRANS = - std::make_pair((acs::CtrlSubmode::OFF << 24) | 2, FixedArrayList()); +auto ACS_TABLE_OFF_TRANS_0 = + std::make_pair((acs::CtrlSubmode::OFF << 24) | 2, FixedArrayList()); +auto ACS_TABLE_OFF_TRANS_1 = + std::make_pair((acs::CtrlSubmode::OFF << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_DETUMBLE = std::make_pair(acs::CtrlSubmode::DETUMBLE, FixedArrayList()); @@ -57,28 +63,59 @@ auto ACS_TABLE_IDLE_TRANS_0 = auto ACS_TABLE_IDLE_TRANS_1 = std::make_pair((acs::CtrlSubmode::IDLE << 24) | 3, FixedArrayList()); +auto ACS_TABLE_PTG_TRANS_0 = + std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 2, FixedArrayList()); + auto ACS_SEQUENCE_PTG_TARGET = std::make_pair(acs::CtrlSubmode::PTG_TARGET, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_TGT = std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 1, FixedArrayList()); -auto ACS_TABLE_PTG_TARGET_TRANS_0 = - std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 2, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_TRANS_1 = std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 3, FixedArrayList()); -/* -auto ACS_SEQUENCE_PTG_TARGET = - std::make_pair(acs::CtrlSubmode::TARGET_PT, FixedArrayList()); -auto ACS_TABLE_TARGET_PT_TGT = - std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 1, FixedArrayList()); -auto ACS_TABLE_TARGET_PT_TRANS_0 = - std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 2, FixedArrayList()); -auto ACS_TABLE_TARGET_PT_TRANS_1 = - std::make_pair((acs::CtrlSubmode::TARGET_PT << 24) | 3, FixedArrayList()); -*/ +auto ACS_SEQUENCE_PTG_TARGET_GS = + std::make_pair(acs::CtrlSubmode::PTG_TARGET_GS, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_GS_TGT = + std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 1, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_GS_TRANS_0 = + std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 2, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_GS_TRANS_1 = + std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 3, FixedArrayList()); + +auto ACS_SEQUENCE_PTG_TARGET_NADIR = + std::make_pair(acs::CtrlSubmode::PTG_TARGET_NADIR, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_NADIR_TGT = std::make_pair((acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 1, + FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_0 = std::make_pair( + (acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 2, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_1 = std::make_pair( + (acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 3, FixedArrayList()); + +auto ACS_SEQUENCE_PTG_TARGET_INERTIAL = + std::make_pair(acs::CtrlSubmode::PTG_TARGET_INERTIAL, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_INERTIAL_TGT = std::make_pair( + (acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 1, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_0 = std::make_pair( + (acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 2, FixedArrayList()); +auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1 = std::make_pair( + (acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 3, FixedArrayList()); void satsystem::acs::init() { ModeListEntry entry; + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { + entry.setObject(obj); + entry.setMode(mode); + entry.setSubmode(submode); + check(table.insert(entry), "satsystem::acs::init: generic target"); + }; + // Build TARGET PT transition 0 + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TRANS_0.second); + buildOffSequence(ACS_SUBSYSTEM, entry); buildSafeSequence(ACS_SUBSYSTEM, entry); buildDetumbleSequence(ACS_SUBSYSTEM, entry); @@ -109,20 +146,24 @@ void buildOffSequence(Subsystem& ss, ModeListEntry& eh) { }; // OFF Target table is empty - check(ss.addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); + check(ss.addTable(TableEntry(ACS_TABLE_OFF_TGT.first, &ACS_TABLE_OFF_TGT.second)), ctxc); - // Build OFF transition - iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); - iht(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); - iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second); - iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - check(ss.addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc); + // Build OFF transition 0 + iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS_0.second); + check(ss.addTable(TableEntry(ACS_TABLE_OFF_TRANS_0.first, &ACS_TABLE_OFF_TRANS_0.second)), ctxc); + + // Build OFF transition 1 + iht(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); + iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); + iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); + iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); + iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); + check(ss.addTable(TableEntry(ACS_TABLE_OFF_TRANS_1.first, &ACS_TABLE_OFF_TRANS_1.second)), ctxc); // Build OFF sequence ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false); - ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false); + ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS_0.first, 0, false); + ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS_1.first, 0, false); check(ss.addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false, true), ctxc); @@ -148,7 +189,7 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; // Build SAFE target - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::SAFE, 0, ACS_TABLE_SAFE_TGT.second); + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::SAFE, ACS_TABLE_SAFE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); @@ -164,7 +205,7 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { ctxc); // Build SAFE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::SAFE, ACS_TABLE_SAFE_TRANS_1.second); check(ss.addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), ctxc); @@ -197,7 +238,7 @@ void buildDetumbleSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; // Build DETUMBLE target - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::DETUMBLE, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); @@ -215,7 +256,7 @@ void buildDetumbleSequence(Subsystem& ss, ModeListEntry& eh) { ctxc); // Build DETUMBLE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::DETUMBLE, ACS_TABLE_DETUMBLE_TRANS_1.second); check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true), ctxc); @@ -249,7 +290,7 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; // Build IDLE target - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::IDLE, 0, ACS_TABLE_IDLE_TGT.second); + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::IDLE, ACS_TABLE_IDLE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TGT.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second); @@ -265,7 +306,7 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { ss.addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true); // Build IDLE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::IDLE, 0, ACS_TABLE_IDLE_TRANS_1.second); + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::IDLE, ACS_TABLE_IDLE_TRANS_1.second); ss.addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true); // Build IDLE sequence @@ -297,7 +338,7 @@ void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { }; // Build TARGET PT table - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::PTG_TARGET, 0, ACS_TABLE_PTG_TARGET_TGT.second); + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET, ACS_TABLE_PTG_TARGET_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); @@ -306,18 +347,10 @@ void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { check(ss.addTable(&ACS_TABLE_PTG_TARGET_TGT.second, ACS_TABLE_PTG_TARGET_TGT.first, false, true), ctxc); - // Build TARGET PT transition 0 - iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); - iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); - iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); - iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); - iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_TRANS_0.second); - check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_0.second, ACS_TABLE_PTG_TARGET_TRANS_0.first, false, - true), - ctxc); + check(ss.addTable(&ACS_TABLE_PTG_TRANS_0.second, ACS_TABLE_PTG_TRANS_0.first, false, true), ctxc); // Build TARGET PT transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlSubmode::PTG_TARGET, 0, + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET, ACS_TABLE_PTG_TARGET_TRANS_1.second); check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_1.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, false, true), @@ -325,11 +358,66 @@ void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TGT.first, 0, true); - ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, false); check(ss.addSequence(&ACS_SEQUENCE_PTG_TARGET.second, ACS_SEQUENCE_PTG_TARGET.first, ACS_SEQUENCE_IDLE.first, false, true), ctxc); } +void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::acs::buildTargetPtNadirSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + // Build TARGET PT table + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET, + ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_NADIR_TGT.first, + &ACS_TABLE_PTG_TARGET_NADIR_TGT.second)), + ctxc); + + check(ss.addTable(TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)), ctxc); + + // Build TARGET PT transition 1 + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_NADIR, + ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.second); + check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, + &ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.second)), + ctxc); + + // Build IDLE sequence + ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TGT.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, 0, false); + check( + ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_NADIR.first, + &ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_SEQUENCE_IDLE.first)), + ctxc); +} + +void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& entryHelper) {} + +void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& entryHelper) {} + } // namespace From 76d18a67bcb1c58e68e6b08dd3cc288a9d8d5a98 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 11:33:18 +0100 Subject: [PATCH 16/39] almost done --- mission/system/tree/acsModeTree.cpp | 59 +++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index 6c27b160..94c4a5c9 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -121,6 +121,9 @@ void satsystem::acs::init() { buildDetumbleSequence(ACS_SUBSYSTEM, entry); buildIdleSequence(ACS_SUBSYSTEM, entry); buildTargetPtSequence(ACS_SUBSYSTEM, entry); + buildTargetPtGsSequence(ACS_SUBSYSTEM, entry); + buildTargetPtNadirSequence(ACS_SUBSYSTEM, entry); + buildTargetPtInertialSequence(ACS_SUBSYSTEM, entry); ACS_SUBSYSTEM.setInitialMode(::acs::CtrlSubmode::SAFE); } @@ -312,7 +315,7 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE sequence ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TGT.first, 0, true); ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, true); - ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, false); + ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, true); ss.addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, ACS_SEQUENCE_SAFE.first, false, true); } @@ -359,7 +362,7 @@ void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TGT.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); - ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, false); + ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, true); check(ss.addSequence(&ACS_SEQUENCE_PTG_TARGET.second, ACS_SEQUENCE_PTG_TARGET.first, ACS_SEQUENCE_IDLE.first, false, true), ctxc); @@ -409,14 +412,62 @@ void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TGT.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_0.first, 0, true); - ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, 0, false); + ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, 0, true); check( ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_NADIR.first, &ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_SEQUENCE_IDLE.first)), ctxc); } -void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& entryHelper) {} +void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::acs::buildTargetPtGsSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + // Build TARGET PT table + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_GS, + ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); + check(ss.addTable( + TableEntry(ACS_TABLE_PTG_TARGET_GS_TGT.first, &ACS_TABLE_PTG_TARGET_GS_TGT.second)), + ctxc); + + check(ss.addTable(TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)), ctxc); + + // Build TARGET PT transition 1 + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_GS, + ACS_TABLE_PTG_TARGET_GS_TRANS_1.second); + check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_GS_TRANS_1.first, + &ACS_TABLE_PTG_TARGET_GS_TRANS_1.second)), + ctxc); + + // Build IDLE sequence + ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TGT.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TRANS_1.first, 0, true); + check(ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_GS.first, + &ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_SEQUENCE_IDLE.first)), + ctxc); +} void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& entryHelper) {} From 4ed1e2411a4e79559780d294d6b658d1005ee31b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 14:21:36 +0100 Subject: [PATCH 17/39] works --- CHANGELOG.md | 7 +++ mission/controller/AcsController.cpp | 7 +-- mission/controller/acs/AcsParameters.h | 4 +- mission/system/tree/acsModeTree.cpp | 80 ++++++++++++++++++++------ mission/system/tree/acsModeTree.h | 5 +- tmtc | 2 +- 6 files changed, 77 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f36f965..c7d8bbd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,13 @@ change warranting a new major release: # [unreleased] +- `AcsSubsystem`: OFF, SAFE and DETUMBLE mode were tested. Auto-transitions SAFE <-> DETUMBLE tested + as well. Other modes still need to be tested. + +## Fixed + +- `AcsController`: Parameter fix in `DetumbleParameter`. + # [v1.23.1] 2023-02-02 TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index a2ff9edf..8ed396c5 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -152,9 +152,8 @@ void AcsController::performSafe() { detumbleCounter = 0; } if (detumbleCounter > acsParameters.detumbleParameter.detumblecounter) { - // TODO: Trigger mode transition in ACS subsystem? - submode = acs::CtrlSubmode::DETUMBLE; detumbleCounter = 0; + // Triggers detubmle mode transition in subsystem triggerEvent(acs::SAFE_RATE_VIOLATION); } @@ -210,9 +209,9 @@ void AcsController::performDetumble() { detumbleCounter = 0; } if (detumbleCounter > acsParameters.detumbleParameter.detumblecounter) { - // TODO: Trigger mode transition in subsystem instead - submode = acs::CtrlSubmode::DETUMBLE; detumbleCounter = 0; + // Triggers safe mode transition in subsystem + triggerEvent(acs::SAFE_RATE_RECOVERY); } int16_t cmdDipolUnitsInt[3] = {0, 0, 0}; diff --git a/mission/controller/acs/AcsParameters.h b/mission/controller/acs/AcsParameters.h index 816e4c71..5d40f752 100644 --- a/mission/controller/acs/AcsParameters.h +++ b/mission/controller/acs/AcsParameters.h @@ -899,8 +899,8 @@ class AcsParameters /*: public HasParametersIF*/ { struct DetumbleParameter { uint8_t detumblecounter = 75; // 30 s - double omegaDetumbleStart = 2 * M_PI / 180; - double omegaDetumbleEnd = 0.4 * M_PI / 180; + double omegaDetumbleStart = 2; + double omegaDetumbleEnd = 0.4; double gainD = pow(10.0, -3.3); } detumbleParameter; }; diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index 94c4a5c9..849959f9 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -10,7 +10,7 @@ #include "mission/acsDefs.h" #include "util.h" -Subsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24); +AcsSubsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24); namespace { // Alias for checker function @@ -30,7 +30,7 @@ void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& entryHelper); static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; -auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlSubmode::OFF, FixedArrayList()); +auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlSubmode::OFF, FixedArrayList()); auto ACS_TABLE_OFF_TGT = std::make_pair((acs::CtrlSubmode::OFF << 24) | 1, FixedArrayList()); auto ACS_TABLE_OFF_TRANS_0 = @@ -77,8 +77,6 @@ auto ACS_SEQUENCE_PTG_TARGET_GS = std::make_pair(acs::CtrlSubmode::PTG_TARGET_GS, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_GS_TGT = std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 1, FixedArrayList()); -auto ACS_TABLE_PTG_TARGET_GS_TRANS_0 = - std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 2, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_GS_TRANS_1 = std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 3, FixedArrayList()); @@ -86,8 +84,6 @@ auto ACS_SEQUENCE_PTG_TARGET_NADIR = std::make_pair(acs::CtrlSubmode::PTG_TARGET_NADIR, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_NADIR_TGT = std::make_pair((acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 1, FixedArrayList()); -auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_0 = std::make_pair( - (acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 2, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_1 = std::make_pair( (acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 3, FixedArrayList()); @@ -95,13 +91,12 @@ auto ACS_SEQUENCE_PTG_TARGET_INERTIAL = std::make_pair(acs::CtrlSubmode::PTG_TARGET_INERTIAL, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_INERTIAL_TGT = std::make_pair( (acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 1, FixedArrayList()); -auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_0 = std::make_pair( - (acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 2, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1 = std::make_pair( (acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 3, FixedArrayList()); void satsystem::acs::init() { ModeListEntry entry; + const char* ctxc = "satsystem::acs::init: generic target"; // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { entry.setObject(obj); @@ -115,6 +110,9 @@ void satsystem::acs::init() { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second); iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TRANS_0.second); + check(ACS_SUBSYSTEM.addTable( + TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)), + ctxc); buildOffSequence(ACS_SUBSYSTEM, entry); buildSafeSequence(ACS_SUBSYSTEM, entry); @@ -350,8 +348,7 @@ void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { check(ss.addTable(&ACS_TABLE_PTG_TARGET_TGT.second, ACS_TABLE_PTG_TARGET_TGT.first, false, true), ctxc); - check(ss.addTable(&ACS_TABLE_PTG_TRANS_0.second, ACS_TABLE_PTG_TRANS_0.first, false, true), ctxc); - + // Transition 0 already built // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET, ACS_TABLE_PTG_TARGET_TRANS_1.second); @@ -400,8 +397,7 @@ void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh) { &ACS_TABLE_PTG_TARGET_NADIR_TGT.second)), ctxc); - check(ss.addTable(TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)), ctxc); - + // Transition 0 already built // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_NADIR, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.second); @@ -411,7 +407,7 @@ void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TGT.first, 0, true); - ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, 0, true); check( ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_NADIR.first, @@ -441,7 +437,7 @@ void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& eh) { // Build TARGET PT table iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_GS, - ACS_TABLE_PTG_TARGET_NADIR_TGT.second); + ACS_TABLE_PTG_TARGET_GS_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); @@ -451,8 +447,7 @@ void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& eh) { TableEntry(ACS_TABLE_PTG_TARGET_GS_TGT.first, &ACS_TABLE_PTG_TARGET_GS_TGT.second)), ctxc); - check(ss.addTable(TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)), ctxc); - + // Transition 0 already built // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_GS, ACS_TABLE_PTG_TARGET_GS_TRANS_1.second); @@ -462,13 +457,62 @@ void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TGT.first, 0, true); - ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TRANS_1.first, 0, true); check(ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_GS.first, &ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_SEQUENCE_IDLE.first)), ctxc); } -void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& entryHelper) {} +void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::acs::buildTargetPtInertialSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + // Build TARGET PT table + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_INERTIAL, + ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); + check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_INERTIAL_TGT.first, + &ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second)), + ctxc); + + // Transition 0 already built + // Build TARGET PT transition 1 + iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_INERTIAL, + ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.second); + check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.first, + &ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.second)), + ctxc); + + // Build IDLE sequence + ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.first, 0, + true); + check(ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_INERTIAL.first, + &ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, + ACS_SEQUENCE_IDLE.first)), + ctxc); +} } // namespace diff --git a/mission/system/tree/acsModeTree.h b/mission/system/tree/acsModeTree.h index 210f8dcd..c814ca3a 100644 --- a/mission/system/tree/acsModeTree.h +++ b/mission/system/tree/acsModeTree.h @@ -1,11 +1,10 @@ -#include +#include -class Subsystem; namespace satsystem { namespace acs { -extern Subsystem ACS_SUBSYSTEM; +extern AcsSubsystem ACS_SUBSYSTEM; void init(); } // namespace acs diff --git a/tmtc b/tmtc index a39e9427..c3c58b95 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a39e94279b0d77b9d21a996d87090d69fd4b3222 +Subproject commit c3c58b95ada024e53a019c34b91f0552bfd487a7 From 825365263f95a3962d237ea26709293eb5c84565 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 14:23:39 +0100 Subject: [PATCH 18/39] update changelog --- CHANGELOG.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d8bbd6..661d5391 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,15 +23,6 @@ change warranting a new major release: ## Fixed - `AcsController`: Parameter fix in `DetumbleParameter`. - -# [v1.23.1] 2023-02-02 - -TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 - -## Fixed - -- Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00) - instead of unsegmented (0b11). - Set GPS set entries to invalid on MODE_OFF command. ## Changed @@ -42,6 +33,18 @@ TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 - Update and tweak ACS subsystem to represent the actual ACS design - Event handling in the ACS subsystem for events triggered by the ACS controller. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/365 + +# [v1.23.1] 2023-02-02 + +TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 + +## Fixed + +- Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00) + instead of unsegmented (0b11). + +## Changed + - Bugfix in FSFW where the MGM RM3100 value Z axis data was parse incorrectly. PR: https://egit.irs.uni-stuttgart.de/eive/fsfw/pulls/123 From 777d67346571757a2985c8e479e890401360bab7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 14:24:27 +0100 Subject: [PATCH 19/39] small fix --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 661d5391..2f0e4447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,9 +42,6 @@ TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 - Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00) instead of unsegmented (0b11). - -## Changed - - Bugfix in FSFW where the MGM RM3100 value Z axis data was parse incorrectly. PR: https://egit.irs.uni-stuttgart.de/eive/fsfw/pulls/123 From d9514e418443c69809434925b23642d2175810d6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 16:08:34 +0100 Subject: [PATCH 20/39] a lot of bugfixes --- CHANGELOG.md | 5 +++++ common/config/devices/addresses.h | 2 +- fsfw | 2 +- linux/ObjectFactory.cpp | 12 ++---------- mission/controller/AcsController.cpp | 2 +- mission/controller/AcsController.h | 1 + mission/system/tree/acsModeTree.h | 1 - 7 files changed, 11 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f0e4447..0ab1a83d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,9 +24,14 @@ change warranting a new major release: - `AcsController`: Parameter fix in `DetumbleParameter`. - Set GPS set entries to invalid on MODE_OFF command. +- Bump FSFW for bugfix in `setNormalDatapoolEntriesInvalid` where the validity was not set to false + properly +- Regression: Revert swap of SUS0 and SUS6. Those devices are on separate power lines. In a + future fix, the calibration matrices of SUS0 and SUS6 will be swapped. ## Changed +- `ACS::SensorValues` is now an ACS controller member to reduce the risk of stack overflow. - ACS Subsystem Sequence Mode IDs updated. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/365 TMTC PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/130 diff --git a/common/config/devices/addresses.h b/common/config/devices/addresses.h index d7056307..c1e65314 100644 --- a/common/config/devices/addresses.h +++ b/common/config/devices/addresses.h @@ -9,7 +9,7 @@ namespace addresses { /* Logical addresses have uint32_t datatype */ -enum logicalAddresses : address_t { +enum LogicAddress : address_t { PCDU, MGM_0_LIS3 = objects::MGM_0_LIS3_HANDLER, diff --git a/fsfw b/fsfw index 3250bbf2..38789e05 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 3250bbf269b3326683222bb87ce7faecae63ad97 +Subproject commit 38789e053b65cfa14604fc625e7bcc8ca03a3f17 diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index a147af26..cf27972f 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -79,11 +79,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo #if OBSW_ADD_SUN_SENSORS == 1 SusFdir* fdir = nullptr; std::array susHandlers = {}; - gpioId_t gpioId = gpioIds::CS_SUS_0; - if (swap0And6) { - gpioId = gpioIds::CS_SUS_6; - } - SpiCookie* spiCookie = new SpiCookie(addresses::SUS_0, gpioId, SUS::MAX_CMD_SIZE, + SpiCookie* spiCookie = new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ); susHandlers[0] = new SusHandler(objects::SUS_0_N_LOC_XFYFZM_PT_XF, 0, objects::SPI_MAIN_COM_IF, spiCookie); @@ -125,11 +121,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB); susHandlers[5]->setCustomFdir(fdir); - gpioId = gpioIds::CS_SUS_6; - if (swap0And6) { - gpioId = gpioIds::CS_SUS_0; - } - spiCookie = new SpiCookie(addresses::SUS_6, gpioId, SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, + spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ); susHandlers[6] = new SusHandler(objects::SUS_6_R_LOC_XFYBZM_PT_XF, 6, objects::SPI_MAIN_COM_IF, spiCookie); diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index 8ed396c5..8a58eb90 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -486,9 +486,9 @@ void AcsController::copyMgmData() { } void AcsController::copySusData() { - ACS::SensorValues sensorValues; { PoolReadGuard pg(&sensorValues.susSets[0]); + if (pg.getReadResult() == returnvalue::OK) { std::memcpy(susDataRaw.sus0.value, sensorValues.susSets[0].channels.value, 6 * sizeof(uint16_t)); diff --git a/mission/controller/AcsController.h b/mission/controller/AcsController.h index bc23fdaf..308700e4 100644 --- a/mission/controller/AcsController.h +++ b/mission/controller/AcsController.h @@ -60,6 +60,7 @@ class AcsController : public ExtendedControllerBase { void announceMode(bool recursive); /* ACS Datasets */ + ACS::SensorValues sensorValues; IMTQ::DipoleActuationSet dipoleSet = IMTQ::DipoleActuationSet(objects::IMTQ_HANDLER); // MGMs acsctrl::MgmDataRaw mgmDataRaw; diff --git a/mission/system/tree/acsModeTree.h b/mission/system/tree/acsModeTree.h index c814ca3a..134a86a7 100644 --- a/mission/system/tree/acsModeTree.h +++ b/mission/system/tree/acsModeTree.h @@ -1,6 +1,5 @@ #include - namespace satsystem { namespace acs { From a9bd792194ff5ace31450d6cd81949dd22a642c8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 16:11:28 +0100 Subject: [PATCH 21/39] changelog correction --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e73e4883..c05c05f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,9 @@ change warranting a new major release: - Set GPS set entries to invalid on MODE_OFF command. - Bump FSFW for bugfix in `setNormalDatapoolEntriesInvalid` where the validity was not set to false properly +- Fixed usage of uint instead of int for commanding MTQ. Also fixed the range in which the ACS Ctrl + commands the MTQ to match the actual commanding range. + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/363 - Regression: Revert swap of SUS0 and SUS6. Those devices are on separate power lines. In a future fix, the calibration matrices of SUS0 and SUS6 will be swapped. @@ -47,9 +50,6 @@ TMTC rev: 15adb9bf2ec68304a4f87b8dd418c1a8353283a3 - Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00) instead of unsegmented (0b11). -- Fixed usage of uint instead of int for commanding MTQ. Also fixed the range in which the ACS Ctrl - commands the MTQ to match the actual commanding range. - PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/363 - Bugfix in FSFW where the MGM RM3100 value Z axis data was parse incorrectly. PR: https://egit.irs.uni-stuttgart.de/eive/fsfw/pulls/123 From 9f28f32af9eae331d5ce79428b75743a15c71cbc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 16:12:11 +0100 Subject: [PATCH 22/39] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index c3c58b95..5ed3cec2 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit c3c58b95ada024e53a019c34b91f0552bfd487a7 +Subproject commit 5ed3cec20b609db435bd5663fd3edd5888fbb932 From 32042afccd29f7f84eca4e3f4ba522a49fbf36b8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 16:30:38 +0100 Subject: [PATCH 23/39] bump minor version --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9c51a6a..cf44cd86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 1) -set(OBSW_VERSION_MINOR_IF_GIT_FAILS 23) -set(OBSW_VERSION_REVISION_IF_GIT_FAILS 1) +set(OBSW_VERSION_MINOR_IF_GIT_FAILS 24) +set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0) # set(CMAKE_VERBOSE TRUE) From 05d168d6ee9982f1efd6da6e71d4fb77c6ecea64 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 16:42:35 +0100 Subject: [PATCH 24/39] bump tmtc to v2.10.0 --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 5ed3cec2..04f5a769 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5ed3cec20b609db435bd5663fd3edd5888fbb932 +Subproject commit 04f5a769629ae79048f68a37d0555e458c9f9a94 From 9bcc424d86c5bced0582a354617ce13741cda7de Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 16:43:53 +0100 Subject: [PATCH 25/39] prepare for v1.24.0 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c05c05f5..02a48aed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ change warranting a new major release: # [unreleased] +# [v1.24.0] 2023-02-03 + +- eive-tmtc v2.10.0 - `AcsSubsystem`: OFF, SAFE and DETUMBLE mode were tested. Auto-transitions SAFE <-> DETUMBLE tested as well. Other modes still need to be tested. From 10378ef1bb166365b552cd8f9caa5b670ccaf239 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 5 Feb 2023 13:13:09 +0100 Subject: [PATCH 26/39] bugfix for GPS handler --- bsp_q7s/core/ObjectFactory.cpp | 4 +- linux/ObjectFactory.cpp | 4 +- linux/devices/CMakeLists.txt | 2 +- ...ler.cpp => GpsHyperionLinuxController.cpp} | 70 ++++++++++--------- ...troller.h => GpsHyperionLinuxController.h} | 8 +-- .../devicedefinitions/GPSDefinitions.h | 2 +- tmtc | 2 +- 7 files changed, 49 insertions(+), 43 deletions(-) rename linux/devices/{GPSHyperionLinuxController.cpp => GpsHyperionLinuxController.cpp} (85%) rename linux/devices/{GPSHyperionLinuxController.h => GpsHyperionLinuxController.h} (92%) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 847cce5f..31dedeba 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -23,7 +23,7 @@ #include "linux/boardtest/UartTestClass.h" #include "linux/callbacks/gpioCallbacks.h" #include "linux/csp/CspComIF.h" -#include "linux/devices/GPSHyperionLinuxController.h" +#include "linux/devices/GpsHyperionLinuxController.h" #include "linux/devices/ScexUartReader.h" #include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" @@ -474,7 +474,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo RESET_ARGS_GNSS.gpioComIF = gpioComIF; RESET_ARGS_GNSS.waitPeriodMs = 100; auto gpsCtrl = - new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); + new GpsHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS); AcsBoardHelper acsBoardHelper = AcsBoardHelper( diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index cf27972f..469187a6 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -121,8 +121,8 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB); susHandlers[5]->setCustomFdir(fdir); - spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, - spi::SUS_MAX1227_SPI_FREQ); + spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE, + spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ); susHandlers[6] = new SusHandler(objects::SUS_6_R_LOC_XFYBZM_PT_XF, 6, objects::SPI_MAIN_COM_IF, spiCookie); fdir = new SusFdir(objects::SUS_6_R_LOC_XFYBZM_PT_XF); diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index a6a909d0..4864e01f 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -1,5 +1,5 @@ if(EIVE_BUILD_GPSD_GPS_HANDLER) - target_sources(${OBSW_NAME} PRIVATE GPSHyperionLinuxController.cpp) + target_sources(${OBSW_NAME} PRIVATE GpsHyperionLinuxController.cpp) endif() target_sources( diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp similarity index 85% rename from linux/devices/GPSHyperionLinuxController.cpp rename to linux/devices/GpsHyperionLinuxController.cpp index d112d507..e9832854 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -1,4 +1,4 @@ -#include "GPSHyperionLinuxController.h" +#include "GpsHyperionLinuxController.h" #include @@ -16,26 +16,26 @@ #include #include -GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId, +GpsHyperionLinuxController::GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId, bool debugHyperionGps) : ExtendedControllerBase(objectId), gpsSet(this), debugHyperionGps(debugHyperionGps) { timeUpdateCd.resetTimer(); } -GPSHyperionLinuxController::~GPSHyperionLinuxController() { +GpsHyperionLinuxController::~GpsHyperionLinuxController() { gps_stream(&gps, WATCH_DISABLE, nullptr); gps_close(&gps); } -void GPSHyperionLinuxController::performControlOperation() { +void GpsHyperionLinuxController::performControlOperation() { #ifdef FSFW_OSAL_LINUX readGpsDataFromGpsd(); #endif } -LocalPoolDataSetBase *GPSHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; } +LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; } -ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode, +ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode, uint32_t *msToReachTheMode) { if (not modeCommanded) { if (mode == MODE_ON or mode == MODE_OFF) { @@ -54,7 +54,7 @@ ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_ return returnvalue::OK; } -ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId, +ReturnValue_t GpsHyperionLinuxController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t *data, size_t size) { switch (actionId) { @@ -72,7 +72,7 @@ ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId, return returnvalue::OK; } -ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool( +ReturnValue_t GpsHyperionLinuxController::initializeLocalDataPool( localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(GpsHyperion::ALTITUDE, new PoolEntry({0.0})); localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry({0.0})); @@ -92,13 +92,13 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool( return returnvalue::OK; } -void GPSHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback, +void GpsHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void *args) { this->resetCallback = resetCallback; resetCallbackArgs = args; } -ReturnValue_t GPSHyperionLinuxController::initialize() { +ReturnValue_t GpsHyperionLinuxController::initialize() { ReturnValue_t result = ExtendedControllerBase::initialize(); if (result != returnvalue::OK) { return result; @@ -127,13 +127,13 @@ ReturnValue_t GPSHyperionLinuxController::initialize() { return result; } -ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *message) { +ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *message) { return ExtendedControllerBase::handleCommandMessage(message); } #ifdef FSFW_OSAL_LINUX -void GPSHyperionLinuxController::readGpsDataFromGpsd() { +void GpsHyperionLinuxController::readGpsDataFromGpsd() { auto readError = [&](int error) { if (gpsReadFailedSwitch) { gpsReadFailedSwitch = false; @@ -146,27 +146,33 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { if (readMode == ReadModes::SOCKET) { gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr); // Exit if no data is seen in 2 seconds (should not happen) - if (not gps_waiting(&gps, 2000000)) { - return; - } - int result = gps_read(&gps); - if (result == -1) { - readError(result); - return; - } - if (MODE_SET != (MODE_SET & gps.set)) { - if (noModeSetCntr >= 0) { - noModeSetCntr++; + if (gps_waiting(&gps, 2000000)) { + int result = gps_read(&gps); + while (result > 0) { + result = gps_read(&gps); } - if (noModeSetCntr == 10) { - // TODO: Trigger event here - sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: No mode could be " - "read for 10 consecutive reads" - << std::endl; - noModeSetCntr = -1; + if (result == -1) { + readError(result); + return; } + if (MODE_SET != (MODE_SET & gps.set)) { + if (mode == MODE_ON) { + if (noModeSetCntr >= 0) { + noModeSetCntr++; + } + if (noModeSetCntr == 10) { + // TODO: Trigger event here + sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: No mode could be " + "read for 10 consecutive reads" + << std::endl; + noModeSetCntr = -1; + } + // did not event get mode, nothing to see. + return; + } + } + noModeSetCntr = 0; } - noModeSetCntr = 0; } else if (readMode == ReadModes::SHM) { int result = gps_read(&gps); if (result == -1) { @@ -174,10 +180,10 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { return; } } - handleGpsRead(); + handleGpsReadData(); } -ReturnValue_t GPSHyperionLinuxController::handleGpsRead() { +ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { PoolReadGuard pg(&gpsSet); if (pg.getReadResult() != returnvalue::OK) { #if FSFW_VERBOSE_LEVEL >= 1 diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GpsHyperionLinuxController.h similarity index 92% rename from linux/devices/GPSHyperionLinuxController.h rename to linux/devices/GpsHyperionLinuxController.h index a4c12e57..e0c3dd36 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GpsHyperionLinuxController.h @@ -20,15 +20,15 @@ * This device handler can only be used on Linux system where the gpsd daemon with shared memory * export is running. */ -class GPSHyperionLinuxController : public ExtendedControllerBase { +class GpsHyperionLinuxController : public ExtendedControllerBase { public: static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 60 * 60 * 5; enum ReadModes { SHM = 0, SOCKET = 1 }; - GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId, + GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId, bool debugHyperionGps = false); - virtual ~GPSHyperionLinuxController(); + virtual ~GpsHyperionLinuxController(); using gpioResetFunction_t = ReturnValue_t (*)(const uint8_t* actionData, size_t len, void* args); @@ -49,7 +49,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase { ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; - ReturnValue_t handleGpsRead(); + ReturnValue_t handleGpsReadData(); private: GpsPrimaryDataset gpsSet; diff --git a/mission/devices/devicedefinitions/GPSDefinitions.h b/mission/devices/devicedefinitions/GPSDefinitions.h index 387d08be..0b88cfa5 100644 --- a/mission/devices/devicedefinitions/GPSDefinitions.h +++ b/mission/devices/devicedefinitions/GPSDefinitions.h @@ -63,7 +63,7 @@ class GpsPrimaryDataset : public StaticLocalDataSet<18> { lp_var_t(sid.objectId, GpsHyperion::UNIX_SECONDS, this); private: - friend class GPSHyperionLinuxController; + friend class GpsHyperionLinuxController; GpsPrimaryDataset(HasLocalDataPoolIF* hkOwner) : StaticLocalDataSet(hkOwner, GpsHyperion::DATASET_ID) {} }; diff --git a/tmtc b/tmtc index 04f5a769..5e27a22a 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 04f5a769629ae79048f68a37d0555e458c9f9a94 +Subproject commit 5e27a22a85acca321cc4ef5067c01924579d2c1e From fd7709ea81e09a176470bc47a11dc2b9467a7d04 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 09:20:20 +0100 Subject: [PATCH 27/39] bump changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02a48aed..2c843068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,12 @@ change warranting a new major release: # [unreleased] +## Fixed + +- `GpsHyperionLinuxController`: Fix `gpsd` polling by continuously calling `gps_read` in one cycle + until it does not have any data left anymore. + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/368 + # [v1.24.0] 2023-02-03 - eive-tmtc v2.10.0 From 4d6215f54624ed37b8b4c12aad04241893f00c39 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 10:20:22 +0100 Subject: [PATCH 28/39] fixes for scheduling --- bsp_q7s/core/scheduling.cpp | 78 ++++++++++---------- linux/devices/GpsHyperionLinuxController.cpp | 39 ++++++---- linux/devices/GpsHyperionLinuxController.h | 6 +- 3 files changed, 68 insertions(+), 55 deletions(-) diff --git a/bsp_q7s/core/scheduling.cpp b/bsp_q7s/core/scheduling.cpp index d8136d3a..d08bb848 100644 --- a/bsp_q7s/core/scheduling.cpp +++ b/bsp_q7s/core/scheduling.cpp @@ -173,54 +173,25 @@ void scheduling::initTasks() { } #endif - PeriodicTaskIF* acsCtrlTask = factory->createPeriodicTask( - "ACS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); #if OBSW_ADD_GPS_CTRL == 1 - result = acsCtrlTask->addComponent(objects::GPS_CONTROLLER); + PeriodicTaskIF* gpsTask = factory->createPeriodicTask( + "GPS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); + result = gpsTask->addComponent(objects::GPS_CONTROLLER); if (result != returnvalue::OK) { scheduling::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER); } #endif /* OBSW_ADD_GPS_CTRL */ + PeriodicTaskIF* acsSysTask = factory->createPeriodicTask( + "SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); + static_cast(acsSysTask); + // To be removed soon because it will be part of the ACS PST. #if OBSW_ADD_ACS_CTRL == 1 - acsCtrlTask->addComponent(objects::ACS_CONTROLLER); + gpsTask->addComponent(objects::ACS_CONTROLLER); if (result != returnvalue::OK) { scheduling::printAddObjectError("ACS_CTRL", objects::ACS_CONTROLLER); } #endif -#if OBSW_Q7S_EM == 1 - acsCtrlTask->addComponent(objects::MGM_0_LIS3_HANDLER); - acsCtrlTask->addComponent(objects::MGM_1_RM3100_HANDLER); - acsCtrlTask->addComponent(objects::MGM_2_LIS3_HANDLER); - acsCtrlTask->addComponent(objects::MGM_3_RM3100_HANDLER); - acsCtrlTask->addComponent(objects::IMTQ_HANDLER); - acsCtrlTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF); - acsCtrlTask->addComponent(objects::SUS_6_R_LOC_XFYBZM_PT_XF); - acsCtrlTask->addComponent(objects::SUS_1_N_LOC_XBYFZM_PT_XB); - acsCtrlTask->addComponent(objects::SUS_7_R_LOC_XBYBZM_PT_XB); - acsCtrlTask->addComponent(objects::SUS_2_N_LOC_XFYBZB_PT_YB); - acsCtrlTask->addComponent(objects::SUS_8_R_LOC_XBYBZB_PT_YB); - acsCtrlTask->addComponent(objects::SUS_3_N_LOC_XFYBZF_PT_YF); - acsCtrlTask->addComponent(objects::SUS_9_R_LOC_XBYBZB_PT_YF); - acsCtrlTask->addComponent(objects::SUS_4_N_LOC_XMYFZF_PT_ZF); - acsCtrlTask->addComponent(objects::SUS_10_N_LOC_XMYBZF_PT_ZF); - acsCtrlTask->addComponent(objects::SUS_5_N_LOC_XFYMZB_PT_ZB); - acsCtrlTask->addComponent(objects::SUS_11_R_LOC_XBYMZB_PT_ZB); - acsCtrlTask->addComponent(objects::GYRO_0_ADIS_HANDLER); - acsCtrlTask->addComponent(objects::GYRO_1_L3G_HANDLER); - acsCtrlTask->addComponent(objects::GYRO_2_ADIS_HANDLER); - acsCtrlTask->addComponent(objects::GYRO_3_L3G_HANDLER); - acsCtrlTask->addComponent(objects::GPS_CONTROLLER); - acsCtrlTask->addComponent(objects::STAR_TRACKER); - acsCtrlTask->addComponent(objects::RW1); - acsCtrlTask->addComponent(objects::RW2); - acsCtrlTask->addComponent(objects::RW3); - acsCtrlTask->addComponent(objects::RW4); -#endif - - PeriodicTaskIF* acsSysTask = factory->createPeriodicTask( - "SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); - static_cast(acsSysTask); #if OBSW_ADD_ACS_BOARD == 1 result = acsSysTask->addComponent(objects::ACS_BOARD_ASS); if (result != returnvalue::OK) { @@ -244,6 +215,35 @@ void scheduling::initTasks() { scheduling::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM); } +#if OBSW_Q7S_EM == 1 + acsSysTask->addComponent(objects::MGM_0_LIS3_HANDLER); + acsSysTask->addComponent(objects::MGM_1_RM3100_HANDLER); + acsSysTask->addComponent(objects::MGM_2_LIS3_HANDLER); + acsSysTask->addComponent(objects::MGM_3_RM3100_HANDLER); + acsSysTask->addComponent(objects::IMTQ_HANDLER); + acsSysTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF); + acsSysTask->addComponent(objects::SUS_6_R_LOC_XFYBZM_PT_XF); + acsSysTask->addComponent(objects::SUS_1_N_LOC_XBYFZM_PT_XB); + acsSysTask->addComponent(objects::SUS_7_R_LOC_XBYBZM_PT_XB); + acsSysTask->addComponent(objects::SUS_2_N_LOC_XFYBZB_PT_YB); + acsSysTask->addComponent(objects::SUS_8_R_LOC_XBYBZB_PT_YB); + acsSysTask->addComponent(objects::SUS_3_N_LOC_XFYBZF_PT_YF); + acsSysTask->addComponent(objects::SUS_9_R_LOC_XBYBZB_PT_YF); + acsSysTask->addComponent(objects::SUS_4_N_LOC_XMYFZF_PT_ZF); + acsSysTask->addComponent(objects::SUS_10_N_LOC_XMYBZF_PT_ZF); + acsSysTask->addComponent(objects::SUS_5_N_LOC_XFYMZB_PT_ZB); + acsSysTask->addComponent(objects::SUS_11_R_LOC_XBYMZB_PT_ZB); + acsSysTask->addComponent(objects::GYRO_0_ADIS_HANDLER); + acsSysTask->addComponent(objects::GYRO_1_L3G_HANDLER); + acsSysTask->addComponent(objects::GYRO_2_ADIS_HANDLER); + acsSysTask->addComponent(objects::GYRO_3_L3G_HANDLER); + acsSysTask->addComponent(objects::GPS_CONTROLLER); + acsSysTask->addComponent(objects::STAR_TRACKER); + acsSysTask->addComponent(objects::RW1); + acsSysTask->addComponent(objects::RW2); + acsSysTask->addComponent(objects::RW3); + acsSysTask->addComponent(objects::RW4); +#endif #if OBSW_ADD_RTD_DEVICES == 1 PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask( "TCS_POLLING_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc); @@ -414,7 +414,9 @@ void scheduling::initTasks() { strHelperTask->startTask(); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ - acsCtrlTask->startTask(); +#if OBSW_ADD_GPS_CTRL == 1 + gpsTask->startTask(); +#endif acsSysTask->startTask(); #if OBSW_ADD_RTD_DEVICES == 1 tcsPollingTask->startTask(); diff --git a/linux/devices/GpsHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp index e9832854..9f3ebbbd 100644 --- a/linux/devices/GpsHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -27,12 +27,6 @@ GpsHyperionLinuxController::~GpsHyperionLinuxController() { gps_close(&gps); } -void GpsHyperionLinuxController::performControlOperation() { -#ifdef FSFW_OSAL_LINUX - readGpsDataFromGpsd(); -#endif -} - LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; } ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode, @@ -98,6 +92,18 @@ void GpsHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallbackArgs = args; } +ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) { + while (true) { + bool noDataRead = readGpsDataFromGpsd(); + if (noDataRead) { + handleQueue(); + poolManager.performHkOperation(); + } + } + // Should never be reached. + return returnvalue::OK; +} + ReturnValue_t GpsHyperionLinuxController::initialize() { ReturnValue_t result = ExtendedControllerBase::initialize(); if (result != returnvalue::OK) { @@ -133,7 +139,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *m #ifdef FSFW_OSAL_LINUX -void GpsHyperionLinuxController::readGpsDataFromGpsd() { +bool GpsHyperionLinuxController::readGpsDataFromGpsd() { auto readError = [&](int error) { if (gpsReadFailedSwitch) { gpsReadFailedSwitch = false; @@ -145,15 +151,15 @@ void GpsHyperionLinuxController::readGpsDataFromGpsd() { currentClientBuf = gps_data(&gps); if (readMode == ReadModes::SOCKET) { gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr); - // Exit if no data is seen in 2 seconds (should not happen) - if (gps_waiting(&gps, 2000000)) { + // Perform other necessary handling if not data seen for 0.2 seconds. + if (gps_waiting(&gps, 200000)) { int result = gps_read(&gps); while (result > 0) { result = gps_read(&gps); } if (result == -1) { readError(result); - return; + return false; } if (MODE_SET != (MODE_SET & gps.set)) { if (mode == MODE_ON) { @@ -168,19 +174,20 @@ void GpsHyperionLinuxController::readGpsDataFromGpsd() { noModeSetCntr = -1; } // did not event get mode, nothing to see. - return; + return false; } } noModeSetCntr = 0; + } else { + return false; } } else if (readMode == ReadModes::SHM) { - int result = gps_read(&gps); - if (result == -1) { - readError(result); - return; - } + sif::error << "GpsHyperionLinuxController::readGpsDataFromGpsdPermanentLoop: " + "SHM read not implemented" + << std::endl; } handleGpsReadData(); + return true; } ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { diff --git a/linux/devices/GpsHyperionLinuxController.h b/linux/devices/GpsHyperionLinuxController.h index e0c3dd36..829857b2 100644 --- a/linux/devices/GpsHyperionLinuxController.h +++ b/linux/devices/GpsHyperionLinuxController.h @@ -32,6 +32,7 @@ class GpsHyperionLinuxController : public ExtendedControllerBase { using gpioResetFunction_t = ReturnValue_t (*)(const uint8_t* actionData, size_t len, void* args); + ReturnValue_t performOperation(uint8_t opCode) override; void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void* args); ReturnValue_t handleCommandMessage(CommandMessage* message) override; void performControlOperation() override; @@ -66,7 +67,10 @@ class GpsHyperionLinuxController : public ExtendedControllerBase { uint32_t timeIsConstantCounter = 0; Countdown timeUpdateCd = Countdown(60); - void readGpsDataFromGpsd(); + // Returns true if data was read and function should be called again + // immediately, and false if the gps_waiting blocked for 0.2 seconds + // without new data arriving. + bool readGpsDataFromGpsd(); }; #endif /* MISSION_DEVICES_GPSHYPERIONHANDLER_H_ */ From c49580ea5166183e0cf76b662666e430884edbf3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 10:22:28 +0100 Subject: [PATCH 29/39] bump changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c843068..c22dd4ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,8 @@ change warranting a new major release: ## Fixed - `GpsHyperionLinuxController`: Fix `gpsd` polling by continuously calling `gps_read` in one cycle - until it does not have any data left anymore. + until it does not have any data left anymore. Also, the data is now polled in a permanenty loop, + where controller handling is done on 0.2 second timeouts. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/368 # [v1.24.0] 2023-02-03 From 4d6d4dd44d59f4c364a55dfe001ad2f4ada23416 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 10:24:13 +0100 Subject: [PATCH 30/39] small tweak --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c22dd4ce..fdd57f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ change warranting a new major release: ## Fixed - `GpsHyperionLinuxController`: Fix `gpsd` polling by continuously calling `gps_read` in one cycle - until it does not have any data left anymore. Also, the data is now polled in a permanenty loop, + until it does not have any data left anymore. Also, the data is now polled in a permanent loop, where controller handling is done on 0.2 second timeouts. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/368 From 1a4dbce3503f68354d1fc8e24d56a3ecb776305b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 10:30:17 +0100 Subject: [PATCH 31/39] tweaks and logic fixes --- linux/devices/GpsHyperionLinuxController.cpp | 10 ++++------ linux/devices/GpsHyperionLinuxController.h | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/linux/devices/GpsHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp index 9f3ebbbd..e557f5c2 100644 --- a/linux/devices/GpsHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -94,8 +94,8 @@ void GpsHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) { while (true) { - bool noDataRead = readGpsDataFromGpsd(); - if (noDataRead) { + bool callAgain = readGpsDataFromGpsd(); + if (not callAgain) { handleQueue(); poolManager.performHkOperation(); } @@ -137,7 +137,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *m return ExtendedControllerBase::handleCommandMessage(message); } -#ifdef FSFW_OSAL_LINUX +void GpsHyperionLinuxController::performControlOperation() {} bool GpsHyperionLinuxController::readGpsDataFromGpsd() { auto readError = [&](int error) { @@ -159,7 +159,7 @@ bool GpsHyperionLinuxController::readGpsDataFromGpsd() { } if (result == -1) { readError(result); - return false; + return true; } if (MODE_SET != (MODE_SET & gps.set)) { if (mode == MODE_ON) { @@ -327,5 +327,3 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { } return returnvalue::OK; } - -#endif diff --git a/linux/devices/GpsHyperionLinuxController.h b/linux/devices/GpsHyperionLinuxController.h index 829857b2..d2dc91b6 100644 --- a/linux/devices/GpsHyperionLinuxController.h +++ b/linux/devices/GpsHyperionLinuxController.h @@ -67,9 +67,8 @@ class GpsHyperionLinuxController : public ExtendedControllerBase { uint32_t timeIsConstantCounter = 0; Countdown timeUpdateCd = Countdown(60); - // Returns true if data was read and function should be called again - // immediately, and false if the gps_waiting blocked for 0.2 seconds - // without new data arriving. + // Returns true if the function should be called again or false if other + // controller handling can be done. bool readGpsDataFromGpsd(); }; From ee01b6253e1aef58d45c4ca882b0029cba30b5cf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 10:39:19 +0100 Subject: [PATCH 32/39] small logic tweak --- linux/devices/GpsHyperionLinuxController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/devices/GpsHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp index e557f5c2..c1760e98 100644 --- a/linux/devices/GpsHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -159,7 +159,7 @@ bool GpsHyperionLinuxController::readGpsDataFromGpsd() { } if (result == -1) { readError(result); - return true; + return false; } if (MODE_SET != (MODE_SET & gps.set)) { if (mode == MODE_ON) { From 67835dd7f7dc1051902e85e758f41d0110d2de90 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 10:40:09 +0100 Subject: [PATCH 33/39] one regular cycle before permanent loop --- linux/devices/GpsHyperionLinuxController.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux/devices/GpsHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp index c1760e98..44038a09 100644 --- a/linux/devices/GpsHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -93,6 +93,8 @@ void GpsHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t } ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) { + handleQueue(); + poolManager.performHkOperation(); while (true) { bool callAgain = readGpsDataFromGpsd(); if (not callAgain) { From 970e018c27e38352e99d7a93a3707cce5ad041fb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 15:16:14 +0100 Subject: [PATCH 34/39] comment object ID of tmp dev which does not exist anymore --- common/config/eive/objects.h | 3 ++- tmtc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index 36cf009a..4914e6dd 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -50,7 +50,8 @@ enum commonObjects : uint32_t { TMP1075_HANDLER_PLPCDU_0 = 0x44420006, TMP1075_HANDLER_PLPCDU_1 = 0x44420007, TMP1075_HANDLER_IF_BOARD = 0x44420008, - TMP1075_HANDLER_OBC_IF_BOARD = 0x44420009, + // Does not exist anymore + // TMP1075_HANDLER_OBC_IF_BOARD = 0x44420009, PCDU_HANDLER = 0x442000A1, P60DOCK_HANDLER = 0x44250000, PDU1_HANDLER = 0x44250001, diff --git a/tmtc b/tmtc index 04f5a769..66867ad9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 04f5a769629ae79048f68a37d0555e458c9f9a94 +Subproject commit 66867ad9d2fc9cb622e7d2baccba95689cc445c3 From 9d7291eea2ceb8f93c33a9b2bd783c6c5c403437 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 18:12:41 +0100 Subject: [PATCH 35/39] this works now --- linux/devices/GpsHyperionLinuxController.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/linux/devices/GpsHyperionLinuxController.cpp b/linux/devices/GpsHyperionLinuxController.cpp index 44038a09..6bbbcfb7 100644 --- a/linux/devices/GpsHyperionLinuxController.cpp +++ b/linux/devices/GpsHyperionLinuxController.cpp @@ -1,5 +1,6 @@ #include "GpsHyperionLinuxController.h" +#include #include #include "OBSWConfig.h" @@ -96,8 +97,8 @@ ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) { handleQueue(); poolManager.performHkOperation(); while (true) { - bool callAgain = readGpsDataFromGpsd(); - if (not callAgain) { + bool callAgainImmediately = readGpsDataFromGpsd(); + if (not callAgainImmediately) { handleQueue(); poolManager.performHkOperation(); } @@ -126,6 +127,7 @@ ReturnValue_t GpsHyperionLinuxController::initialize() { if (retval != 0) { openError("Socket", retval); } + gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr); } else if (readMode == ReadModes::SHM) { int retval = gps_open(GPSD_SHARED_MEMORY, "", &gps); if (retval != 0) { @@ -142,25 +144,19 @@ ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *m void GpsHyperionLinuxController::performControlOperation() {} bool GpsHyperionLinuxController::readGpsDataFromGpsd() { - auto readError = [&](int error) { + auto readError = [&]() { if (gpsReadFailedSwitch) { gpsReadFailedSwitch = false; sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed | " "Error " - << error << " | " << gps_errstr(error) << std::endl; + << errno << " | " << gps_errstr(errno) << std::endl; } }; - currentClientBuf = gps_data(&gps); if (readMode == ReadModes::SOCKET) { - gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr); // Perform other necessary handling if not data seen for 0.2 seconds. if (gps_waiting(&gps, 200000)) { - int result = gps_read(&gps); - while (result > 0) { - result = gps_read(&gps); - } - if (result == -1) { - readError(result); + if (-1 == gps_read(&gps)) { + readError(); return false; } if (MODE_SET != (MODE_SET & gps.set)) { From 86babcf07b9521b84fd9d139cb63feacb1b8a680 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 18:23:04 +0100 Subject: [PATCH 36/39] important fix --- bsp_q7s/core/scheduling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/scheduling.cpp b/bsp_q7s/core/scheduling.cpp index d08bb848..43c50c02 100644 --- a/bsp_q7s/core/scheduling.cpp +++ b/bsp_q7s/core/scheduling.cpp @@ -187,7 +187,7 @@ void scheduling::initTasks() { static_cast(acsSysTask); // To be removed soon because it will be part of the ACS PST. #if OBSW_ADD_ACS_CTRL == 1 - gpsTask->addComponent(objects::ACS_CONTROLLER); + acsSysTask->addComponent(objects::ACS_CONTROLLER); if (result != returnvalue::OK) { scheduling::printAddObjectError("ACS_CTRL", objects::ACS_CONTROLLER); } From 8ffd10cacc80cd44999a74b5f2d12a8945cbb3f4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 20:15:45 +0100 Subject: [PATCH 37/39] update subsystem mode IDs --- CHANGELOG.md | 4 ++++ mission/acsDefs.h | 14 +++++++------- mission/comDefs.h | 10 +++++----- mission/system/objects/definitions.h | 9 ++++++++- mission/system/tree/payloadModeTree.cpp | 13 ++++++------- tmtc | 2 +- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdd57f46..fb56320b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ change warranting a new major release: # [unreleased] +## Changed + +- Updated Subsystem mode IDs to avoid clashes with regular device handler modes. + ## Fixed - `GpsHyperionLinuxController`: Fix `gpsd` polling by continuously calling `gps_read` in one cycle diff --git a/mission/acsDefs.h b/mission/acsDefs.h index 2bb536f2..8869d6ff 100644 --- a/mission/acsDefs.h +++ b/mission/acsDefs.h @@ -8,13 +8,13 @@ namespace acs { enum CtrlSubmode { OFF = HasModesIF::MODE_OFF, - SAFE = 2, - DETUMBLE = 3, - IDLE = 4, - PTG_TARGET_NADIR = 5, - PTG_TARGET = 6, - PTG_TARGET_GS = 7, - PTG_TARGET_INERTIAL = 8, + SAFE = 10, + DETUMBLE = 11, + IDLE = 12, + PTG_TARGET_NADIR = 13, + PTG_TARGET = 14, + PTG_TARGET_GS = 15, + PTG_TARGET_INERTIAL = 16, }; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::ACS_SUBSYSTEM; diff --git a/mission/comDefs.h b/mission/comDefs.h index 5538b166..dd254263 100644 --- a/mission/comDefs.h +++ b/mission/comDefs.h @@ -10,11 +10,11 @@ enum class Datarate : uint8_t { }; enum Submode : uint8_t { - RX_ONLY, - RX_AND_TX_DEFAULT_DATARATE, - RX_AND_TX_LOW_DATARATE, - RX_AND_TX_HIGH_DATARATE, - RX_AND_TX_CW, + RX_ONLY = 10, + RX_AND_TX_DEFAULT_DATARATE = 11, + RX_AND_TX_LOW_DATARATE = 12, + RX_AND_TX_HIGH_DATARATE = 13, + RX_AND_TX_CW = 14, NUM_SUBMODES }; diff --git a/mission/system/objects/definitions.h b/mission/system/objects/definitions.h index f2b491ca..80f30641 100644 --- a/mission/system/objects/definitions.h +++ b/mission/system/objects/definitions.h @@ -18,7 +18,14 @@ enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 }; namespace payload { -enum Mode { OFF = 0, SUPV_ONLY = 1, MPSOC_STREAM = 2, CAM_STREAM = 3, EARTH_OBSV = 4, SCEX = 5 }; +enum Mode { + OFF = 0, + SUPV_ONLY = 10, + MPSOC_STREAM = 11, + CAM_STREAM = 12, + EARTH_OBSV = 13, + SCEX = 14 +}; namespace ploc { diff --git a/mission/system/tree/payloadModeTree.cpp b/mission/system/tree/payloadModeTree.cpp index a53ad462..ccb3dd2c 100644 --- a/mission/system/tree/payloadModeTree.cpp +++ b/mission/system/tree/payloadModeTree.cpp @@ -27,7 +27,7 @@ static const auto OFF = HasModesIF::MODE_OFF; static const auto ON = HasModesIF::MODE_ON; static const auto NML = DeviceHandlerIF::MODE_NORMAL; -auto PL_SEQUENCE_OFF = std::make_pair(payload::Mode::OFF << 24, FixedArrayList()); +auto PL_SEQUENCE_OFF = std::make_pair(payload::Mode::OFF, FixedArrayList()); auto PL_TABLE_OFF_TGT = std::make_pair((payload::Mode::OFF << 24) | 1, FixedArrayList()); auto PL_TABLE_OFF_TRANS_0 = @@ -36,7 +36,7 @@ auto PL_TABLE_OFF_TRANS_1 = std::make_pair((payload::Mode::OFF << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_MPSOC_STREAM = - std::make_pair(payload::Mode::MPSOC_STREAM << 24, FixedArrayList()); + std::make_pair(payload::Mode::MPSOC_STREAM, FixedArrayList()); auto PL_TABLE_MPSOC_STREAM_TGT = std::make_pair((payload::Mode::MPSOC_STREAM << 24) | 1, FixedArrayList()); auto PL_TABLE_MPSOC_STREAM_TRANS_0 = @@ -45,7 +45,7 @@ auto PL_TABLE_MPSOC_STREAM_TRANS_1 = std::make_pair((payload::Mode::MPSOC_STREAM << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_CAM_STREAM = - std::make_pair(payload::Mode::CAM_STREAM << 24, FixedArrayList()); + std::make_pair(payload::Mode::CAM_STREAM, FixedArrayList()); auto PL_TABLE_CAM_STREAM_TGT = std::make_pair((payload::Mode::CAM_STREAM << 24) | 1, FixedArrayList()); auto PL_TABLE_CAM_STREAM_TRANS_0 = @@ -54,7 +54,7 @@ auto PL_TABLE_CAM_STREAM_TRANS_1 = std::make_pair((payload::Mode::CAM_STREAM << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_SUPV_ONLY = - std::make_pair(payload::Mode::SUPV_ONLY << 24, FixedArrayList()); + std::make_pair(payload::Mode::SUPV_ONLY, FixedArrayList()); auto PL_TABLE_SUPV_ONLY_TGT = std::make_pair((payload::Mode::SUPV_ONLY << 24) | 1, FixedArrayList()); auto PL_TABLE_SUPV_ONLY_TRANS_0 = @@ -63,7 +63,7 @@ auto PL_TABLE_SUPV_ONLY_TRANS_1 = std::make_pair((payload::Mode::SUPV_ONLY << 24) | 3, FixedArrayList()); auto PL_SEQUENCE_EARTH_OBSV = - std::make_pair(payload::Mode::EARTH_OBSV << 24, FixedArrayList()); + std::make_pair(payload::Mode::EARTH_OBSV, FixedArrayList()); auto PL_TABLE_EARTH_OBSV_TGT = std::make_pair((payload::Mode::EARTH_OBSV << 24) | 1, FixedArrayList()); auto PL_TABLE_EARTH_OBSV_TRANS_0 = @@ -71,8 +71,7 @@ auto PL_TABLE_EARTH_OBSV_TRANS_0 = auto PL_TABLE_EARTH_OBSV_TRANS_1 = std::make_pair((payload::Mode::EARTH_OBSV << 24) | 3, FixedArrayList()); -auto PL_SEQUENCE_SCEX = - std::make_pair(payload::Mode::SCEX << 24, FixedArrayList()); +auto PL_SEQUENCE_SCEX = std::make_pair(payload::Mode::SCEX, FixedArrayList()); auto PL_TABLE_SCEX_TGT = std::make_pair((payload::Mode::SCEX << 24) | 1, FixedArrayList()); auto PL_TABLE_SCEX_TRANS_0 = diff --git a/tmtc b/tmtc index 66867ad9..cab0aa02 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 66867ad9d2fc9cb622e7d2baccba95689cc445c3 +Subproject commit cab0aa027ab3169bc2f224fa9cd9ccd524e42ae4 From 7ae2b44806b9e99dea4e08cd1a765ca5ae383373 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 20:19:08 +0100 Subject: [PATCH 38/39] prep v1.25.0 --- CHANGELOG.md | 4 ++++ CMakeLists.txt | 2 +- tmtc | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb56320b..c5eceb87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ change warranting a new major release: # [unreleased] +# [v1.25.0] 2023-02-06 + +eive-tmtc version: v2.12.0 + ## Changed - Updated Subsystem mode IDs to avoid clashes with regular device handler modes. diff --git a/CMakeLists.txt b/CMakeLists.txt index cf44cd86..97b1b2a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 1) -set(OBSW_VERSION_MINOR_IF_GIT_FAILS 24) +set(OBSW_VERSION_MINOR_IF_GIT_FAILS 25) set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0) # set(CMAKE_VERBOSE TRUE) diff --git a/tmtc b/tmtc index cab0aa02..8aec6c48 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit cab0aa027ab3169bc2f224fa9cd9ccd524e42ae4 +Subproject commit 8aec6c48a0b352709c99e7482eaee71497d591dd From 5f81b0866ace7823122082c2cc263cde7830fcc5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Feb 2023 20:22:52 +0100 Subject: [PATCH 39/39] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 8aec6c48..d6445d38 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8aec6c48a0b352709c99e7482eaee71497d591dd +Subproject commit d6445d38a8eb644a5e1bd27f0fc56d29e93c030d