From acba821afd3f3b1adc42444626d1d3476dfd1db5 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Tue, 31 Jan 2023 19:12:39 +0100 Subject: [PATCH 1/4] 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; -- 2.43.0 From 4bed0fd563ddf584b8001e273c064f2b513a90af Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 2 Feb 2023 10:47:58 +0100 Subject: [PATCH 2/4] 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: -- 2.43.0 From 8c03b2ec95171b8eefdd8f6e91f571f74034ba59 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 2 Feb 2023 10:56:14 +0100 Subject: [PATCH 3/4] 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 -- 2.43.0 From a9bd792194ff5ace31450d6cd81949dd22a642c8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Feb 2023 16:11:28 +0100 Subject: [PATCH 4/4] 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 -- 2.43.0