mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-23 16:06:36 +08:00
fixed elevator wobbling at low airspeed.
Removed not applicable if conditions.
This commit is contained in:
committed by
Friedemann Ludwig
parent
9574c6dd2a
commit
32012e8aac
@@ -49,6 +49,7 @@
|
||||
#include "ecl_controller.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mathlib/mathlib.h>
|
||||
|
||||
ECL_Controller::ECL_Controller(const char *name) :
|
||||
_last_run(0),
|
||||
@@ -126,3 +127,14 @@ float ECL_Controller::get_desired_bodyrate()
|
||||
{
|
||||
return _bodyrate_setpoint;
|
||||
}
|
||||
|
||||
float ECL_Controller::constrain_airspeed(float airspeed, float minspeed, float maxspeed) {
|
||||
float airspeed_result = airspeed;
|
||||
if (!isfinite(airspeed)) {
|
||||
/* airspeed is NaN, +- INF or not available, pick center of band */
|
||||
airspeed = 0.5f * (minspeed + maxspeed);
|
||||
} else if (airspeed < minspeed) {
|
||||
airspeed = minspeed;
|
||||
}
|
||||
return airspeed_result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user