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 17:56:46 +01:00
committed by Matthias Grob
parent 3941b19968
commit d7904b5f2c
@@ -87,16 +87,19 @@ public:
const float tmp2 = b * b / (4.f * a * a); const float tmp2 = b * b / (4.f * a * a);
for (int i = 0; i < num_values; ++i) { for (int i = 0; i < num_values; ++i) {
float control = values[i]; float control = values[i];
if (control > 0.f) { if (PX4_ISFINITE(control)) {
values[i] = -tmp1 + sqrtf(tmp2 + (control / a)); if (control > 0.f) {
values[i] = -tmp1 + sqrtf(tmp2 + (control / a));
} else if (control < -0.f) { } else if (control < -0.f) {
values[i] = tmp1 - sqrtf(tmp2 - (control / a)); values[i] = tmp1 - sqrtf(tmp2 - (control / a));
} else { } else {
values[i] = 0.f; values[i] = 0.f;
}
} }
} }
} }