From ad5282ca4afd72fbd0d242351a37dca23514e3c3 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 13 Mar 2024 16:59:37 +0100 Subject: [PATCH 01/15] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 47b21caf..27c8a97d 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 47b21caf5fa2a27c7ace89f960141b3f24c329ee +Subproject commit 27c8a97d45ca631fade540daf30b3645a36a003e From 346f4ff9de5aa3f45ad464ff29b3ade7d892587f Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 13 Mar 2024 16:59:55 +0100 Subject: [PATCH 02/15] prevent sign jump --- mission/controller/acs/Guidance.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mission/controller/acs/Guidance.cpp b/mission/controller/acs/Guidance.cpp index 4406a224..a6559db3 100644 --- a/mission/controller/acs/Guidance.cpp +++ b/mission/controller/acs/Guidance.cpp @@ -244,6 +244,8 @@ void Guidance::limitReferenceRotation(const double xAxisIX[3], double quatIX[4]) return; } + QuaternionOperations::preventSignJump(quatIX, quatIXprev); + // check required rotation and return if below limit double quatXprevX[4] = {0, 0, 0, 0}, quatXprevI[4] = {0, 0, 0, 0}; QuaternionOperations::inverse(quatIXprev, quatXprevI); From 6c9a7c3ee5f0cce33fb790ada9950f463085418f Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 13 Mar 2024 17:01:17 +0100 Subject: [PATCH 03/15] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1086a9f..3ad5a54a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- Added prevention of sign jump for target quaternion of GS pointing, which would reduce the + performance of the controller. + # [v7.7.2] 2024-03-06 ## Fixed From c4680f85bba93217b413b64b18355fd31b9d884e Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 15 Mar 2024 13:16:38 +0100 Subject: [PATCH 04/15] added param to disable str input for mekf --- mission/controller/AcsController.cpp | 3 ++- mission/controller/acs/AcsParameters.cpp | 3 +++ mission/controller/acs/AcsParameters.h | 2 ++ mission/controller/acs/MultiplicativeKalmanFilter.cpp | 6 +++--- mission/controller/acs/MultiplicativeKalmanFilter.h | 2 +- mission/controller/acs/Navigation.cpp | 5 +++-- mission/controller/acs/Navigation.h | 3 ++- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index f9a04c46..d3bbfcd8 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -180,7 +180,8 @@ void AcsController::performAttitudeControl() { mode, &susDataProcessed, &mgmDataProcessed, &gyrDataProcessed, &sensorValues, &attitudeEstimationData, timeDelta, &fusedRotRateSourcesData, &fusedRotRateData); result = navigation.useMekf(&sensorValues, &gyrDataProcessed, &mgmDataProcessed, - &susDataProcessed, timeDelta, &attitudeEstimationData); + &susDataProcessed, timeDelta, &attitudeEstimationData, + acsParameters.kalmanFilterParameters.allowStr); if (result != MultiplicativeKalmanFilter::MEKF_RUNNING and result != MultiplicativeKalmanFilter::MEKF_INITIALIZED) { diff --git a/mission/controller/acs/AcsParameters.cpp b/mission/controller/acs/AcsParameters.cpp index f8fb759b..3a7aa726 100644 --- a/mission/controller/acs/AcsParameters.cpp +++ b/mission/controller/acs/AcsParameters.cpp @@ -734,6 +734,9 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, case 0x5: parameterWrapper->set(kalmanFilterParameters.sensorNoiseGyrBs); break; + case 0x6: + parameterWrapper->set(kalmanFilterParameters.allowStr); + break; default: return INVALID_IDENTIFIER_ID; } diff --git a/mission/controller/acs/AcsParameters.h b/mission/controller/acs/AcsParameters.h index 467c0740..965878e7 100644 --- a/mission/controller/acs/AcsParameters.h +++ b/mission/controller/acs/AcsParameters.h @@ -947,6 +947,8 @@ class AcsParameters : public HasParametersIF { double sensorNoiseGyrArw = 3. * 0.0043 / sqrt(10) * DEG2RAD; // Angular Random Walk double sensorNoiseGyrBs = 3. / 3600. * DEG2RAD; // Bias Stability + + uint8_t allowStr = false; } kalmanFilterParameters; struct MagnetorquerParameter { diff --git a/mission/controller/acs/MultiplicativeKalmanFilter.cpp b/mission/controller/acs/MultiplicativeKalmanFilter.cpp index 5dce2a84..b66f0531 100644 --- a/mission/controller/acs/MultiplicativeKalmanFilter.cpp +++ b/mission/controller/acs/MultiplicativeKalmanFilter.cpp @@ -626,11 +626,11 @@ void MultiplicativeKalmanFilter::updateDataSet( } } -void MultiplicativeKalmanFilter::setStrData(double qX, double qY, double qZ, double qW, - bool valid) { +void MultiplicativeKalmanFilter::setStrData(double qX, double qY, double qZ, double qW, bool valid, + bool allowStr) { strData.strQuat.value[0] = qX; strData.strQuat.value[1] = qY; strData.strQuat.value[2] = qZ; strData.strQuat.value[3] = qW; - strData.strQuat.valid = valid; + strData.strQuat.valid = (valid and allowStr); } diff --git a/mission/controller/acs/MultiplicativeKalmanFilter.h b/mission/controller/acs/MultiplicativeKalmanFilter.h index 6d475912..d26b6dd8 100644 --- a/mission/controller/acs/MultiplicativeKalmanFilter.h +++ b/mission/controller/acs/MultiplicativeKalmanFilter.h @@ -38,7 +38,7 @@ class MultiplicativeKalmanFilter { void updateStandardDeviations(const AcsParameters *acsParameters); void setStrData(const double qX, const double qY, const double qZ, const double qW, - const bool valid); + const bool valid, const bool allowStr); static constexpr uint8_t IF_MEKF_ID = CLASS_ID::ACS_MEKF; static constexpr ReturnValue_t MEKF_UNINITIALIZED = returnvalue::makeCode(IF_MEKF_ID, 2); diff --git a/mission/controller/acs/Navigation.cpp b/mission/controller/acs/Navigation.cpp index 038abfdd..113a6ccb 100644 --- a/mission/controller/acs/Navigation.cpp +++ b/mission/controller/acs/Navigation.cpp @@ -9,11 +9,12 @@ ReturnValue_t Navigation::useMekf(const ACS::SensorValues *sensorValues, const acsctrl::MgmDataProcessed *mgmDataProcessed, const acsctrl::SusDataProcessed *susDataProcessed, const double timeDelta, - acsctrl::AttitudeEstimationData *attitudeEstimationData) { + acsctrl::AttitudeEstimationData *attitudeEstimationData, + const bool allowStr) { multiplicativeKalmanFilter.setStrData( sensorValues->strSet.caliQx.value, sensorValues->strSet.caliQy.value, sensorValues->strSet.caliQz.value, sensorValues->strSet.caliQw.value, - sensorValues->strSet.caliQx.isValid()); + sensorValues->strSet.caliQx.isValid(), allowStr); if (mekfStatus == MultiplicativeKalmanFilter::MEKF_UNINITIALIZED) { mekfStatus = multiplicativeKalmanFilter.init(susDataProcessed, mgmDataProcessed, diff --git a/mission/controller/acs/Navigation.h b/mission/controller/acs/Navigation.h index b944073d..230ce79e 100644 --- a/mission/controller/acs/Navigation.h +++ b/mission/controller/acs/Navigation.h @@ -17,7 +17,8 @@ class Navigation { const acsctrl::GyrDataProcessed *gyrDataProcessed, const acsctrl::MgmDataProcessed *mgmDataProcessed, const acsctrl::SusDataProcessed *susDataProcessed, const double timeDelta, - acsctrl::AttitudeEstimationData *attitudeEstimationData); + acsctrl::AttitudeEstimationData *attitudeEstimationData, + const bool allowStr); void resetMekf(acsctrl::AttitudeEstimationData *mekfData); ReturnValue_t useSpg4(timeval now, acsctrl::GpsDataProcessed *gpsDataProcessed); From dade2d519aa01661da8c814558606f41da095e69 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 15 Mar 2024 13:21:01 +0100 Subject: [PATCH 05/15] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1086a9f..43e914a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Added + +- Added parameter to disable STR input for MEKF. + # [v7.7.2] 2024-03-06 ## Fixed From 1c93f51f69c657ddf406646f8f0fc279f2781e93 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 16 Mar 2024 13:48:49 +0100 Subject: [PATCH 06/15] prevent switching of heaters in external control --- mission/controller/ThermalController.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 2729cec0..7d8d99a0 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1792,7 +1792,8 @@ void ThermalController::heaterMaxDurationControl( for (unsigned i = 0; i < heater::Switch::NUMBER_OF_SWITCHES; i++) { // Right now, we only track the maximum duration for heater which were commanded by the TCS // controller. - if (currentHeaterStates[i] == heater::SwitchState::ON and + if (heaterHandler.getHealth(static_cast(i)) != HasHealthIF::EXTERNAL_CONTROL and + currentHeaterStates[i] == heater::SwitchState::ON and heaterStates[i].trackHeaterMaxBurnTime and heaterStates[i].heaterOnMaxBurnTime.hasTimedOut()) { heaterStates[i].switchTransition = false; From c65e813e94a40801cf621179f3b7fee044941090 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 16 Mar 2024 13:53:22 +0100 Subject: [PATCH 07/15] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1086a9f..b9fd085c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- Heaters set to `EXTERNAL CONTROL` no longer can be switched off by the `TCS Controller`, if + they violate the maximum burn duration of the controller. + # [v7.7.2] 2024-03-06 ## Fixed From 36edd3e3241d77c8a6fa25ba45ccb1a98a6b29c9 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 10:33:51 +0100 Subject: [PATCH 08/15] changed lower op limits for ploc --- mission/controller/ThermalController.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 1062fe97..6b6d9cde 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -197,9 +197,9 @@ class ThermalController : public ExtendedControllerBase { tcsCtrl::TempLimits pcduAcuLimits = tcsCtrl::TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0); tcsCtrl::TempLimits pcduPduLimits = tcsCtrl::TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0); tcsCtrl::TempLimits plPcduBoardLimits = tcsCtrl::TempLimits(-55.0, -40.0, 80.0, 85.0, 125.0); - tcsCtrl::TempLimits plocMissionBoardLimits = tcsCtrl::TempLimits(-30.0, -10.0, 40.0, 45.0, 60); + tcsCtrl::TempLimits plocMissionBoardLimits = tcsCtrl::TempLimits(-30.0, -5.0, 40.0, 45.0, 60); tcsCtrl::TempLimits plocProcessingBoardLimits = - tcsCtrl::TempLimits(-30.0, -10.0, 40.0, 45.0, 60.0); + tcsCtrl::TempLimits(-30.0, -5.0, 40.0, 45.0, 60.0); tcsCtrl::TempLimits dacLimits = tcsCtrl::TempLimits(-65.0, -40.0, 113.0, 118.0, 150.0); tcsCtrl::TempLimits cameraLimits = tcsCtrl::TempLimits(-40.0, -30.0, 60.0, 65.0, 85.0); tcsCtrl::TempLimits droLimits = tcsCtrl::TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0); From 096328aadca7d839b7721739bffba6878715ec74 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 10:34:21 +0100 Subject: [PATCH 09/15] backup heater will not be chosen if heater is on ext ctrl and on --- mission/controller/ThermalController.cpp | 26 ++++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 7d8d99a0..31c5f663 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1641,21 +1641,25 @@ bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch re bool heaterAvailable = true; HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr); + heater::SwitchState mainState = heaterHandler.getSwitchState(switchNr); HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr); - if (mainHealth != HasHealthIF::HEALTHY) { - if (redHealth == HasHealthIF::HEALTHY) { - switchNr = redSwitchNr; - ctrlCtx.redSwitchNrInUse = true; - } else { - heaterAvailable = false; - // Special case: Ground might command/do something with the heaters, so prevent spam. - if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) { - triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); + if (not(mainHealth == HasHealthIF::EXTERNAL_CONTROL and mainState == heater::SwitchState::ON)) { + if (mainHealth != HasHealthIF::HEALTHY) { + if (redHealth == HasHealthIF::HEALTHY) { + switchNr = redSwitchNr; + ctrlCtx.redSwitchNrInUse = true; + } else { + heaterAvailable = false; + // Special case: Ground might command/do something with the heaters, so prevent spam. + if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) { + triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); + } } + } else { + ctrlCtx.redSwitchNrInUse = false; } - } else { - ctrlCtx.redSwitchNrInUse = false; } + return heaterAvailable; } From 950e86ce4bc4fa540c82061c1c81a7cd94cc8654 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 10:56:57 +0100 Subject: [PATCH 10/15] cleaner solution --- mission/controller/ThermalController.cpp | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 31c5f663..ef21f2d9 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1643,21 +1643,22 @@ bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch re HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr); heater::SwitchState mainState = heaterHandler.getSwitchState(switchNr); HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr); - if (not(mainHealth == HasHealthIF::EXTERNAL_CONTROL and mainState == heater::SwitchState::ON)) { - if (mainHealth != HasHealthIF::HEALTHY) { - if (redHealth == HasHealthIF::HEALTHY) { - switchNr = redSwitchNr; - ctrlCtx.redSwitchNrInUse = true; - } else { - heaterAvailable = false; - // Special case: Ground might command/do something with the heaters, so prevent spam. - if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) { - triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); - } - } + if (mainHealth == HasHealthIF::EXTERNAL_CONTROL and mainState == heater::SwitchState::ON) { + return false; + } + if (mainHealth != HasHealthIF::HEALTHY) { + if (redHealth == HasHealthIF::HEALTHY) { + switchNr = redSwitchNr; + ctrlCtx.redSwitchNrInUse = true; } else { - ctrlCtx.redSwitchNrInUse = false; + heaterAvailable = false; + // Special case: Ground might command/do something with the heaters, so prevent spam. + if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) { + triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); + } } + } else { + ctrlCtx.redSwitchNrInUse = false; } return heaterAvailable; @@ -1714,7 +1715,8 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) { if (thermalStates[ctrlCtx.thermalComponent].heating) { // We are already in a heating cycle, so need to check whether heating task is complete. if (ctrlCtx.sensorTemp >= htrCtx.tempLimit.opLowerLimit + TEMP_OFFSET and - heaterCtrlAllowed()) { + heaterCtrlAllowed() /*and + heaterHandler.getHealth(htrCtx.switchNr) != HasHealthIF::EXTERNAL_CONTROL*/) { sif::info << "TCS: Heater " << static_cast(ctrlCtx.thermalComponent) << " OFF" << std::endl; heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, ctrlCtx.thermalComponent); From 311ecd7fd23b186fcd2acac2d845e16c0146b1c3 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 10:58:19 +0100 Subject: [PATCH 11/15] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9fd085c..68bb84a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,12 @@ will consitute of a breaking change warranting a new major release: - Heaters set to `EXTERNAL CONTROL` no longer can be switched off by the `TCS Controller`, if they violate the maximum burn duration of the controller. +## Changed + +- If a primary heater is set to `EXTERNAL CONTROL` and `ON`, the `TCS Controller` will no + try to control the temperature of that object. +- Set lower OP limit of `PLOC` to -5°C. + # [v7.7.2] 2024-03-06 ## Fixed From 67e6ccf4aef23bbb87ea42a06a9f44897f61eda5 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 11:00:29 +0100 Subject: [PATCH 12/15] cleanup --- mission/controller/ThermalController.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index ef21f2d9..c406a5be 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1715,8 +1715,7 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) { if (thermalStates[ctrlCtx.thermalComponent].heating) { // We are already in a heating cycle, so need to check whether heating task is complete. if (ctrlCtx.sensorTemp >= htrCtx.tempLimit.opLowerLimit + TEMP_OFFSET and - heaterCtrlAllowed() /*and - heaterHandler.getHealth(htrCtx.switchNr) != HasHealthIF::EXTERNAL_CONTROL*/) { + heaterCtrlAllowed()) { sif::info << "TCS: Heater " << static_cast(ctrlCtx.thermalComponent) << " OFF" << std::endl; heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, ctrlCtx.thermalComponent); From 3b521966a97911df150015d7a4d37400164afbf1 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 11:03:44 +0100 Subject: [PATCH 13/15] bumped fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 27c8a97d..43ea29cb 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 27c8a97d45ca631fade540daf30b3645a36a003e +Subproject commit 43ea29cb845d4a7d190c87df490eb53c4992618b From 97408317559a6f17970b2a826671eb03eb168ce5 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 11:14:00 +0100 Subject: [PATCH 14/15] bumped version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48d0c333..54d804b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR 7) set(OBSW_VERSION_MINOR 7) -set(OBSW_VERSION_REVISION 2) +set(OBSW_VERSION_REVISION 3) # set(CMAKE_VERBOSE TRUE) From 80ea0b341bb0556642f99826590d86b66b140613 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 11:14:10 +0100 Subject: [PATCH 15/15] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1ff3ead..dfa460bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v7.7.3] 2024-03-18 + - Bumped `eive-fsfw` ## Added