fixed rw torque scaling
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
@ -14,17 +14,14 @@ ActuatorCmd::ActuatorCmd() {}
|
||||
|
||||
ActuatorCmd::~ActuatorCmd() {}
|
||||
|
||||
void ActuatorCmd::scalingTorqueRws(const double *rwTrq, double *rwTrqScaled, double maxTorque) {
|
||||
double maxValue = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (abs(rwTrq[i]) > maxValue) {
|
||||
maxValue = abs(rwTrq[i]);
|
||||
}
|
||||
}
|
||||
void ActuatorCmd::scalingTorqueRws(double *rwTrq, double maxTorque) {
|
||||
uint8_t maxIdx = 0;
|
||||
VectorOperations<double>::maxAbsValue(rwTrq, 4, &maxIdx);
|
||||
double maxValue = rwTrq[maxIdx];
|
||||
|
||||
if (maxValue > maxTorque) {
|
||||
double scalingFactor = maxTorque / maxValue;
|
||||
VectorOperations<double>::mulScalar(rwTrq, scalingFactor, rwTrqScaled, 4);
|
||||
VectorOperations<double>::mulScalar(rwTrq, scalingFactor, rwTrq, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user