ACS Ptg Ctrl Fixes #643

Merged
muellerr merged 35 commits from acs-ptg-ctrl-fixes-2 into v3.0.0-dev 2023-06-07 11:49:10 +02:00
Showing only changes of commit 3750f1ac57 - Show all commits

View File

@ -57,8 +57,8 @@ void ActuatorCmd::cmdDipoleMtq(const double *inverseAlignment, const double maxD
const double *dipoleMoment, int16_t *dipoleMomentActuator) {
// convert to actuator frame
double dipoleMomentActuatorDouble[3] = {0, 0, 0};
MatrixOperations<double>::multiply(inverseAlignment, dipoleMoment, dipoleMomentActuatorDouble, 3, 3,
1);
MatrixOperations<double>::multiply(inverseAlignment, dipoleMoment, dipoleMomentActuatorDouble, 3,
3, 1);
// scaling along largest element if dipole exceeds maximum
uint8_t maxIdx = 0;
VectorOperations<double>::maxAbsValue(dipoleMomentActuatorDouble, 3, &maxIdx);
@ -69,7 +69,8 @@ void ActuatorCmd::cmdDipoleMtq(const double *inverseAlignment, const double maxD
dipoleMomentActuatorDouble, 3);
}
// scale dipole from 1 Am^2 to 1e^-4 Am^2
VectorOperations<double>::mulScalar(dipoleMomentActuatorDouble, 1e4, dipoleMomentActuatorDouble, 3);
VectorOperations<double>::mulScalar(dipoleMomentActuatorDouble, 1e4, dipoleMomentActuatorDouble,
3);
for (int i = 0; i < 3; i++) {
dipoleMomentActuator[i] = std::round(dipoleMomentActuatorDouble[i]);
}