mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 14:53:33 +08:00
cmake standalone build
This commit is contained in:
@@ -40,12 +40,9 @@
|
||||
|
||||
#include "ecl_pitch_controller.h"
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <float.h>
|
||||
#include <geo/geo.h>
|
||||
#include <ecl/ecl.h>
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
ECL_PitchController::ECL_PitchController() :
|
||||
ECL_Controller("pitch"),
|
||||
@@ -58,11 +55,11 @@ float ECL_PitchController::control_attitude(const struct ECL_ControlData &ctl_da
|
||||
{
|
||||
|
||||
/* Do not calculate control signal with bad inputs */
|
||||
if (!(PX4_ISFINITE(ctl_data.pitch_setpoint) &&
|
||||
PX4_ISFINITE(ctl_data.roll) &&
|
||||
PX4_ISFINITE(ctl_data.pitch) &&
|
||||
PX4_ISFINITE(ctl_data.airspeed))) {
|
||||
warnx("not controlling pitch");
|
||||
if (!(ISFINITE(ctl_data.pitch_setpoint) &&
|
||||
ISFINITE(ctl_data.roll) &&
|
||||
ISFINITE(ctl_data.pitch) &&
|
||||
ISFINITE(ctl_data.airspeed))) {
|
||||
ECL_WARN("not controlling pitch");
|
||||
return _rate_setpoint;
|
||||
}
|
||||
|
||||
@@ -78,14 +75,14 @@ float ECL_PitchController::control_attitude(const struct ECL_ControlData &ctl_da
|
||||
float ECL_PitchController::control_bodyrate(const struct ECL_ControlData &ctl_data)
|
||||
{
|
||||
/* Do not calculate control signal with bad inputs */
|
||||
if (!(PX4_ISFINITE(ctl_data.roll) &&
|
||||
PX4_ISFINITE(ctl_data.pitch) &&
|
||||
PX4_ISFINITE(ctl_data.body_y_rate) &&
|
||||
PX4_ISFINITE(ctl_data.body_z_rate) &&
|
||||
PX4_ISFINITE(ctl_data.yaw_rate_setpoint) &&
|
||||
PX4_ISFINITE(ctl_data.airspeed_min) &&
|
||||
PX4_ISFINITE(ctl_data.airspeed_max) &&
|
||||
PX4_ISFINITE(ctl_data.scaler))) {
|
||||
if (!(ISFINITE(ctl_data.roll) &&
|
||||
ISFINITE(ctl_data.pitch) &&
|
||||
ISFINITE(ctl_data.body_y_rate) &&
|
||||
ISFINITE(ctl_data.body_z_rate) &&
|
||||
ISFINITE(ctl_data.yaw_rate_setpoint) &&
|
||||
ISFINITE(ctl_data.airspeed_min) &&
|
||||
ISFINITE(ctl_data.airspeed_max) &&
|
||||
ISFINITE(ctl_data.scaler))) {
|
||||
return math::constrain(_last_output, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user