Merge pull request 'MTQ Commanding from ACS Ctrl fixes' (#363) from eggert/mtq-cmd-fixes into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #363
Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
This commit is contained in:
Robin Müller 2023-02-03 16:12:31 +01:00
commit 47f998b493
4 changed files with 16 additions and 12 deletions

View File

@ -26,6 +26,9 @@ change warranting a new major release:
- Set GPS set entries to invalid on MODE_OFF command. - Set GPS set entries to invalid on MODE_OFF command.
- Bump FSFW for bugfix in `setNormalDatapoolEntriesInvalid` where the validity was not set to false - Bump FSFW for bugfix in `setNormalDatapoolEntriesInvalid` where the validity was not set to false
properly 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 - 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. future fix, the calibration matrices of SUS0 and SUS6 will be swapped.

View File

@ -54,21 +54,22 @@ void ActuatorCmd::cmdSpeedToRws(const int32_t *speedRw0, const int32_t *speedRw1
VectorOperations<double>::add(speedRws, deltaSpeed, rwCmdSpeed, 4); VectorOperations<double>::add(speedRws, deltaSpeed, rwCmdSpeed, 4);
} }
void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, double *dipolMomentUnits) { void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, double *dipolMomentActuator) {
// Convert to Unit frame // Convert to actuator frame
MatrixOperations<double>::multiply(*acsParameters.magnetorquesParameter.inverseAlignment, MatrixOperations<double>::multiply(*acsParameters.magnetorquesParameter.inverseAlignment,
dipolMoment, dipolMomentUnits, 3, 3, 1); dipolMoment, dipolMomentActuator, 3, 3, 1);
// Scaling along largest element if dipol exceeds maximum // Scaling along largest element if dipol exceeds maximum
double maxDipol = acsParameters.magnetorquesParameter.DipolMax; double maxDipol = acsParameters.magnetorquesParameter.DipolMax;
double maxValue = 0; double maxValue = 0;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (abs(dipolMomentUnits[i]) > maxDipol) { if (abs(dipolMomentActuator[i]) > maxDipol) {
maxValue = abs(dipolMomentUnits[i]); maxValue = abs(dipolMomentActuator[i]);
} }
} }
if (maxValue > maxDipol) { if (maxValue > maxDipol) {
double scalingFactor = maxDipol / maxValue; double scalingFactor = maxDipol / maxValue;
VectorOperations<double>::mulScalar(dipolMomentUnits, scalingFactor, dipolMomentUnits, 3); VectorOperations<double>::mulScalar(dipolMomentActuator, scalingFactor, dipolMomentActuator, 3);
} }
// scale dipole from 1 Am^2 to 1e^-4 Am^2
VectorOperations<double>::mulScalar(dipolMomentActuator, 1e4, dipolMomentActuator, 3);
} }

View File

@ -35,9 +35,9 @@ class ActuatorCmd {
* @brief: cmdDipolMtq() gives the commanded dipol moment for the magnetorques * @brief: cmdDipolMtq() gives the commanded dipol moment for the magnetorques
* *
* @param: dipolMoment given dipol moment in spacecraft frame * @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: protected:
private: private:

View File

@ -489,7 +489,7 @@ class DipoleActuationSet : public StaticLocalDataSet<4> {
// Refresh torque command without changing any of the set dipoles. // Refresh torque command without changing any of the set dipoles.
void refreshTorqueing(uint16_t durationMs_) { currentTorqueDurationMs = durationMs_; } 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_) { uint16_t currentTorqueDurationMs_) {
if (xDipole.value != xDipole_) { if (xDipole.value != xDipole_) {
} }
@ -503,7 +503,7 @@ class DipoleActuationSet : public StaticLocalDataSet<4> {
currentTorqueDurationMs = currentTorqueDurationMs_; 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; xDipole_ = xDipole.value;
yDipole_ = yDipole.value; yDipole_ = yDipole.value;
zDipole_ = zDipole.value; zDipole_ = zDipole.value;