This commit is contained in:
Oleg Kalachev 2025-07-29 18:22:38 +03:00
parent 3d72224b32
commit f46842f341
2 changed files with 8 additions and 1 deletions

View File

@ -29,7 +29,6 @@ void autoFailsafe() {
if (roll != controlRoll || pitch != controlPitch || yaw != controlYaw || abs(throttle - controlThrottle) > 0.05) {
if (mode == AUTO && !isfinite(controlMode)) {
print("Failsafe: regain control to pilot\n");
mode = STAB; // regain control to the pilot
}
}

View File

@ -19,6 +19,14 @@ float mapff(float x, float in_min, float in_max, float out_min, float out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
bool invalid(float x) {
return !isfinite(x);
}
bool valid(float x) {
return isfinite(x);
}
// Wrap angle to [-PI, PI)
float wrapAngle(float angle) {
angle = fmodf(angle, 2 * PI);