mixer: FunctionMotors: leave NAN control values at NAN with non-zero THR_MDL_FAC

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer 2024-12-13 16:32:47 +01:00 committed by Matthias Grob
parent 3941b19968
commit d7904b5f2c

View File

@ -87,16 +87,19 @@ public:
const float tmp2 = b * b / (4.f * a * a);
for (int i = 0; i < num_values; ++i) {
float control = values[i];
if (control > 0.f) {
values[i] = -tmp1 + sqrtf(tmp2 + (control / a));
if (PX4_ISFINITE(control)) {
if (control > 0.f) {
values[i] = -tmp1 + sqrtf(tmp2 + (control / a));
} else if (control < -0.f) {
values[i] = tmp1 - sqrtf(tmp2 - (control / a));
} else if (control < -0.f) {
values[i] = tmp1 - sqrtf(tmp2 - (control / a));
} else {
values[i] = 0.f;
} else {
values[i] = 0.f;
}
}
}
}