fixed use of c abs which will truncate the value

This commit is contained in:
Marius Eggert 2023-05-26 13:51:24 +02:00
parent 93cf6bab01
commit 335394b863

View File

@ -61,7 +61,7 @@ void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentAct
// Scaling along largest element if dipol exceeds maximum // Scaling along largest element if dipol exceeds maximum
uint8_t maxIdx = 0; uint8_t maxIdx = 0;
VectorOperations<double>::maxAbsValue(dipolMomentActuatorDouble, 3, &maxIdx); VectorOperations<double>::maxAbsValue(dipolMomentActuatorDouble, 3, &maxIdx);
double maxAbsValue = abs(dipolMomentActuatorDouble[maxIdx]); double maxAbsValue = std::abs(dipolMomentActuatorDouble[maxIdx]);
if (maxAbsValue > maxDipol) { if (maxAbsValue > maxDipol) {
double scalingFactor = maxDipol / maxAbsValue; double scalingFactor = maxDipol / maxAbsValue;
VectorOperations<double>::mulScalar(dipolMomentActuatorDouble, scalingFactor, VectorOperations<double>::mulScalar(dipolMomentActuatorDouble, scalingFactor,