mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 22:23:35 +08:00
cmake standalone build
This commit is contained in:
@@ -39,13 +39,9 @@
|
||||
*/
|
||||
|
||||
#include "ecl_yaw_controller.h"
|
||||
#include <stdint.h>
|
||||
#include <float.h>
|
||||
#include <geo/geo.h>
|
||||
#include <ecl/ecl.h>
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <systemlib/err.h>
|
||||
#include <ecl/ecl.h>
|
||||
|
||||
ECL_YawController::ECL_YawController() :
|
||||
ECL_Controller("yaw"),
|
||||
@@ -65,10 +61,10 @@ float ECL_YawController::control_attitude(const struct ECL_ControlData &ctl_data
|
||||
return control_attitude_impl_accclosedloop(ctl_data);
|
||||
|
||||
default:
|
||||
static hrt_abstime last_print = 0;
|
||||
static ecl_abstime last_print = 0;
|
||||
|
||||
if (ecl_elapsed_time(&last_print) > 5e6) {
|
||||
warnx("invalid param setting FW_YCO_METHOD");
|
||||
ECL_WARN("invalid param setting FW_YCO_METHOD");
|
||||
last_print = ecl_absolute_time();
|
||||
}
|
||||
}
|
||||
@@ -79,10 +75,10 @@ float ECL_YawController::control_attitude(const struct ECL_ControlData &ctl_data
|
||||
float ECL_YawController::control_attitude_impl_openloop(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.roll_rate_setpoint) &&
|
||||
PX4_ISFINITE(ctl_data.pitch_rate_setpoint))) {
|
||||
if (!(ISFINITE(ctl_data.roll) &&
|
||||
ISFINITE(ctl_data.pitch) &&
|
||||
ISFINITE(ctl_data.roll_rate_setpoint) &&
|
||||
ISFINITE(ctl_data.pitch_rate_setpoint))) {
|
||||
return _rate_setpoint;
|
||||
}
|
||||
|
||||
@@ -118,8 +114,8 @@ float ECL_YawController::control_attitude_impl_openloop(const struct ECL_Control
|
||||
ctl_data.airspeed_min : ctl_data.airspeed);
|
||||
}
|
||||
|
||||
if (!PX4_ISFINITE(_rate_setpoint)) {
|
||||
warnx("yaw rate sepoint not finite");
|
||||
if (!ISFINITE(_rate_setpoint)) {
|
||||
ECL_WARN("yaw rate sepoint not finite");
|
||||
_rate_setpoint = 0.0f;
|
||||
}
|
||||
|
||||
@@ -129,10 +125,10 @@ float ECL_YawController::control_attitude_impl_openloop(const struct ECL_Control
|
||||
float ECL_YawController::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.pitch_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.pitch_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);
|
||||
}
|
||||
|
||||
@@ -151,7 +147,7 @@ float ECL_YawController::control_bodyrate(const struct ECL_ControlData &ctl_data
|
||||
/* input conditioning */
|
||||
float airspeed = ctl_data.airspeed;
|
||||
|
||||
if (!PX4_ISFINITE(airspeed)) {
|
||||
if (!ISFINITE(airspeed)) {
|
||||
/* airspeed is NaN, +- INF or not available, pick center of band */
|
||||
airspeed = 0.5f * (ctl_data.airspeed_min + ctl_data.airspeed_max);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user