From 81311770e836fedeb46b4dbb26c910e1d57561d3 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 2 Aug 2023 16:26:57 +0200 Subject: [PATCH 1/5] this might be the fix --- mission/controller/acs/FusedRotationEstimation.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mission/controller/acs/FusedRotationEstimation.cpp b/mission/controller/acs/FusedRotationEstimation.cpp index 20f12d05..6653f4d1 100644 --- a/mission/controller/acs/FusedRotationEstimation.cpp +++ b/mission/controller/acs/FusedRotationEstimation.cpp @@ -22,6 +22,10 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe( } if (not susDataProcessed->susVecTot.isValid()) { estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData); + // store for calculation of angular acceleration + if (gyrDataProcessed->gyrVecTot.isValid()) { + std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double)); + } return; } @@ -42,6 +46,10 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe( fusedRotRateParallel, 3); } else { estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData); + // store for calculation of angular acceleration + if (gyrDataProcessed->gyrVecTot.isValid()) { + std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double)); + } return; } -- 2.43.0 From acc50ca7aae7e75a02aef027d25b8c4548e36615 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 3 Aug 2023 10:09:43 +0200 Subject: [PATCH 2/5] fused rotation rate calculation during eclipse can be disabled --- mission/controller/acs/AcsParameters.cpp | 3 +++ mission/controller/acs/AcsParameters.h | 1 + mission/controller/acs/FusedRotationEstimation.cpp | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mission/controller/acs/AcsParameters.cpp b/mission/controller/acs/AcsParameters.cpp index 9b0755cd..bcb1a7f4 100644 --- a/mission/controller/acs/AcsParameters.cpp +++ b/mission/controller/acs/AcsParameters.cpp @@ -26,6 +26,9 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, case 0x1: parameterWrapper->set(onBoardParams.mekfViolationTimer); break; + case 0x2: + parameterWrapper->set(onBoardParams.fusedRateSafeDuringEclipse); + break; default: return INVALID_IDENTIFIER_ID; } diff --git a/mission/controller/acs/AcsParameters.h b/mission/controller/acs/AcsParameters.h index cdaf4899..0f2b53c9 100644 --- a/mission/controller/acs/AcsParameters.h +++ b/mission/controller/acs/AcsParameters.h @@ -19,6 +19,7 @@ class AcsParameters : public HasParametersIF { struct OnBoardParams { double sampleTime = 0.4; // [s] uint16_t mekfViolationTimer = 750; + uint8_t fusedRateSafeDuringEclipse = true; } onBoardParams; struct InertiaEIVE { diff --git a/mission/controller/acs/FusedRotationEstimation.cpp b/mission/controller/acs/FusedRotationEstimation.cpp index 6653f4d1..a818536f 100644 --- a/mission/controller/acs/FusedRotationEstimation.cpp +++ b/mission/controller/acs/FusedRotationEstimation.cpp @@ -83,7 +83,8 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe( void FusedRotationEstimation::estimateFusedRotationRateEclipse( acsctrl::GyrDataProcessed *gyrDataProcessed, acsctrl::FusedRotRateData *fusedRotRateData) { - if (not gyrDataProcessed->gyrVecTot.isValid() or + if (not acsParameters->onBoardParams.fusedRateSafeDuringEclipse or + not gyrDataProcessed->gyrVecTot.isValid() or VectorOperations::norm(fusedRotRateData->rotRateTotal.value, 3) == 0) { { PoolReadGuard pg(fusedRotRateData); -- 2.43.0 From 8f0b0f47c9cec9f6a826eb2ce56b0602d9708415 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 3 Aug 2023 11:32:08 +0200 Subject: [PATCH 3/5] not sure if we need it here but doesnot matter --- mission/controller/acs/FusedRotationEstimation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mission/controller/acs/FusedRotationEstimation.cpp b/mission/controller/acs/FusedRotationEstimation.cpp index a818536f..bca5f190 100644 --- a/mission/controller/acs/FusedRotationEstimation.cpp +++ b/mission/controller/acs/FusedRotationEstimation.cpp @@ -18,6 +18,10 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe( std::memcpy(fusedRotRateData->rotRateTotal.value, ZERO_VEC, 3 * sizeof(double)); fusedRotRateData->setValidity(false, true); } + // store for calculation of angular acceleration + if (gyrDataProcessed->gyrVecTot.isValid()) { + std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double)); + } return; } if (not susDataProcessed->susVecTot.isValid()) { -- 2.43.0 From e25819371331b260abb6df15691e44600364f7a8 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 3 Aug 2023 11:32:16 +0200 Subject: [PATCH 4/5] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5fbe994..cb8cb983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ will consitute of a breaking change warranting a new major release: - ACS Controller strategy is now actually written to the dataset for detumbling. - During detumble the fused rotation rate is now calculated. - Detumbling is now exited when its exit value is undercut and not its entry value. +- Rotation rate of last cycle is now stored in all cases for the fused rotational rate + calculation. +- Fused rotation rate estimation during eclipse can be disabled. This will also prevent + detumbling during eclipse, as no relevant rotational rate is available for now. - `EiveSystem`: Add a small delay between triggering an event for FDIR reboots and sending the command to the core controller. -- 2.43.0 From 5958560d00d50b26b7edee2029452fbcc729be1c Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 3 Aug 2023 11:34:29 +0200 Subject: [PATCH 5/5] cleanup --- mission/controller/acs/FusedRotationEstimation.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mission/controller/acs/FusedRotationEstimation.cpp b/mission/controller/acs/FusedRotationEstimation.cpp index bca5f190..4f1dad45 100644 --- a/mission/controller/acs/FusedRotationEstimation.cpp +++ b/mission/controller/acs/FusedRotationEstimation.cpp @@ -70,11 +70,6 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe( double fusedRotRateTotal[3] = {0, 0, 0}; VectorOperations::add(fusedRotRateParallel, fusedRotRateOrthogonal, fusedRotRateTotal); - // store for calculation of angular acceleration - if (gyrDataProcessed->gyrVecTot.isValid()) { - std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double)); - } - { PoolReadGuard pg(fusedRotRateData); std::memcpy(fusedRotRateData->rotRateOrthogonal.value, fusedRotRateOrthogonal, @@ -83,6 +78,11 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe( std::memcpy(fusedRotRateData->rotRateTotal.value, fusedRotRateTotal, 3 * sizeof(double)); fusedRotRateData->setValidity(true, true); } + + // store for calculation of angular acceleration + if (gyrDataProcessed->gyrVecTot.isValid()) { + std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double)); + } } void FusedRotationEstimation::estimateFusedRotationRateEclipse( -- 2.43.0