mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-17 06:10:35 +08:00
TECS: Update logging struct
This commit is contained in:
@@ -399,7 +399,7 @@ private:
|
||||
bool climbout_mode, float climbout_pitch_min_rad,
|
||||
float altitude,
|
||||
const math::Vector<3> &ground_speed,
|
||||
tecs_mode mode = TECS_MODE_NORMAL,
|
||||
unsigned mode = tecs_status_s::TECS_MODE_NORMAL,
|
||||
bool pitch_max_special = false);
|
||||
|
||||
};
|
||||
@@ -1093,7 +1093,7 @@ FixedwingPositionControl::control_position(const math::Vector<2> ¤t_positi
|
||||
0.0f, throttle_max, throttle_land,
|
||||
false, land_motor_lim ? math::radians(_parameters.land_flare_pitch_min_deg) : math::radians(_parameters.pitch_limit_min),
|
||||
_global_pos.alt, ground_speed,
|
||||
land_motor_lim ? TECS_MODE_LAND_THROTTLELIM : TECS_MODE_LAND);
|
||||
land_motor_lim ? tecs_status_s::TECS_MODE_LAND_THROTTLELIM : tecs_status_s::TECS_MODE_LAND);
|
||||
|
||||
if (!land_noreturn_vertical) {
|
||||
mavlink_log_info(_mavlink_fd, "#audio: Landing, flaring");
|
||||
@@ -1198,7 +1198,7 @@ FixedwingPositionControl::control_position(const math::Vector<2> ¤t_positi
|
||||
math::radians(10.0f)),
|
||||
_global_pos.alt,
|
||||
ground_speed,
|
||||
TECS_MODE_TAKEOFF,
|
||||
tecs_status_s::TECS_MODE_TAKEOFF,
|
||||
takeoff_pitch_max_deg != _parameters.pitch_limit_max);
|
||||
|
||||
/* limit roll motion to ensure enough lift */
|
||||
@@ -1303,7 +1303,7 @@ FixedwingPositionControl::control_position(const math::Vector<2> ¤t_positi
|
||||
math::radians(_parameters.pitch_limit_min),
|
||||
_global_pos.alt,
|
||||
ground_speed,
|
||||
TECS_MODE_NORMAL);
|
||||
tecs_status_s::TECS_MODE_NORMAL);
|
||||
} else {
|
||||
_control_mode_current = FW_POSCTRL_MODE_OTHER;
|
||||
|
||||
@@ -1521,7 +1521,7 @@ void FixedwingPositionControl::tecs_update_pitch_throttle(float alt_sp, float v_
|
||||
bool climbout_mode, float climbout_pitch_min_rad,
|
||||
float altitude,
|
||||
const math::Vector<3> &ground_speed,
|
||||
tecs_mode mode, bool pitch_max_special)
|
||||
unsigned mode, bool pitch_max_special)
|
||||
{
|
||||
if (_mTecs.getEnabled()) {
|
||||
/* Using mtecs library: prepare arguments for mtecs call */
|
||||
@@ -1559,7 +1559,7 @@ void FixedwingPositionControl::tecs_update_pitch_throttle(float alt_sp, float v_
|
||||
}
|
||||
|
||||
/* No underspeed protection in landing mode */
|
||||
_tecs.set_detect_underspeed_enabled(!(mode == TECS_MODE_LAND || mode == TECS_MODE_LAND_THROTTLELIM));
|
||||
_tecs.set_detect_underspeed_enabled(!(mode == tecs_status_s::TECS_MODE_LAND || mode == tecs_status_s::TECS_MODE_LAND_THROTTLELIM));
|
||||
|
||||
/* Using tecs library */
|
||||
_tecs.update_pitch_throttle(_R_nb, _att.pitch, altitude, alt_sp, v_sp,
|
||||
@@ -1577,16 +1577,16 @@ void FixedwingPositionControl::tecs_update_pitch_throttle(float alt_sp, float v_
|
||||
|
||||
switch (s.mode) {
|
||||
case TECS::ECL_TECS_MODE_NORMAL:
|
||||
t.mode = TECS_MODE_NORMAL;
|
||||
t.mode = tecs_status_s::TECS_MODE_NORMAL;
|
||||
break;
|
||||
case TECS::ECL_TECS_MODE_UNDERSPEED:
|
||||
t.mode = TECS_MODE_UNDERSPEED;
|
||||
t.mode = tecs_status_s::TECS_MODE_UNDERSPEED;
|
||||
break;
|
||||
case TECS::ECL_TECS_MODE_BAD_DESCENT:
|
||||
t.mode = TECS_MODE_BAD_DESCENT;
|
||||
t.mode = tecs_status_s::TECS_MODE_BAD_DESCENT;
|
||||
break;
|
||||
case TECS::ECL_TECS_MODE_CLIMBOUT:
|
||||
t.mode = TECS_MODE_CLIMBOUT;
|
||||
t.mode = tecs_status_s::TECS_MODE_CLIMBOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ mTecs::~mTecs()
|
||||
}
|
||||
|
||||
int mTecs::updateAltitudeSpeed(float flightPathAngle, float altitude, float altitudeSp, float airspeed,
|
||||
float airspeedSp, tecs_mode mode, LimitOverride limitOverride)
|
||||
float airspeedSp, unsigned mode, LimitOverride limitOverride)
|
||||
{
|
||||
/* check if all input arguments are numbers and abort if not so */
|
||||
if (!isfinite(flightPathAngle) || !isfinite(altitude) ||
|
||||
@@ -118,7 +118,7 @@ int mTecs::updateAltitudeSpeed(float flightPathAngle, float altitude, float alti
|
||||
}
|
||||
|
||||
int mTecs::updateFlightPathAngleSpeed(float flightPathAngle, float flightPathAngleSp, float airspeed,
|
||||
float airspeedSp, tecs_mode mode, LimitOverride limitOverride)
|
||||
float airspeedSp, unsigned mode, LimitOverride limitOverride)
|
||||
{
|
||||
/* check if all input arguments are numbers and abort if not so */
|
||||
if (!isfinite(flightPathAngle) || !isfinite(flightPathAngleSp) ||
|
||||
@@ -154,7 +154,7 @@ int mTecs::updateFlightPathAngleSpeed(float flightPathAngle, float flightPathAng
|
||||
}
|
||||
|
||||
int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flightPathAngleSp, float airspeedFiltered,
|
||||
float accelerationLongitudinalSp, tecs_mode mode, LimitOverride limitOverride)
|
||||
float accelerationLongitudinalSp, unsigned mode, LimitOverride limitOverride)
|
||||
{
|
||||
/* check if all input arguments are numbers and abort if not so */
|
||||
if (!isfinite(flightPathAngle) || !isfinite(flightPathAngleSp) ||
|
||||
@@ -200,23 +200,23 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight
|
||||
}
|
||||
|
||||
/* Check airspeed: if below safe value switch to underspeed mode (if not in land or takeoff mode) */
|
||||
if (mode != TECS_MODE_LAND && mode != TECS_MODE_TAKEOFF && airspeedFiltered < _airspeedMin.get()) {
|
||||
mode = TECS_MODE_UNDERSPEED;
|
||||
if (mode != tecs_status_s::TECS_MODE_LAND && mode != tecs_status_s::TECS_MODE_TAKEOFF && airspeedFiltered < _airspeedMin.get()) {
|
||||
mode = tecs_status_s::TECS_MODE_UNDERSPEED;
|
||||
}
|
||||
|
||||
/* Set special ouput limiters if we are not in TECS_MODE_NORMAL */
|
||||
BlockOutputLimiter *outputLimiterThrottle = &_controlTotalEnergy.getOutputLimiter();
|
||||
BlockOutputLimiter *outputLimiterPitch = &_controlEnergyDistribution.getOutputLimiter();
|
||||
if (mode == TECS_MODE_TAKEOFF) {
|
||||
if (mode == tecs_status_s::TECS_MODE_TAKEOFF) {
|
||||
outputLimiterThrottle = &_BlockOutputLimiterTakeoffThrottle;
|
||||
outputLimiterPitch = &_BlockOutputLimiterTakeoffPitch;
|
||||
} else if (mode == TECS_MODE_LAND) {
|
||||
} else if (mode == tecs_status_s::TECS_MODE_LAND) {
|
||||
// only limit pitch but do not limit throttle
|
||||
outputLimiterPitch = &_BlockOutputLimiterLandPitch;
|
||||
} else if (mode == TECS_MODE_LAND_THROTTLELIM) {
|
||||
} else if (mode == tecs_status_s::TECS_MODE_LAND_THROTTLELIM) {
|
||||
outputLimiterThrottle = &_BlockOutputLimiterLandThrottle;
|
||||
outputLimiterPitch = &_BlockOutputLimiterLandPitch;
|
||||
} else if (mode == TECS_MODE_UNDERSPEED) {
|
||||
} else if (mode == tecs_status_s::TECS_MODE_UNDERSPEED) {
|
||||
outputLimiterThrottle = &_BlockOutputLimiterUnderspeedThrottle;
|
||||
outputLimiterPitch = &_BlockOutputLimiterUnderspeedPitch;
|
||||
}
|
||||
|
||||
@@ -65,19 +65,19 @@ public:
|
||||
* Control in altitude setpoint and speed mode
|
||||
*/
|
||||
int updateAltitudeSpeed(float flightPathAngle, float altitude, float altitudeSp, float airspeed,
|
||||
float airspeedSp, tecs_mode mode, LimitOverride limitOverride);
|
||||
float airspeedSp, unsigned mode, LimitOverride limitOverride);
|
||||
|
||||
/*
|
||||
* Control in flightPathAngle setpoint (flollow a slope etc.) and speed mode
|
||||
*/
|
||||
int updateFlightPathAngleSpeed(float flightPathAngle, float flightPathAngleSp, float airspeed,
|
||||
float airspeedSp, tecs_mode mode, LimitOverride limitOverride);
|
||||
float airspeedSp, unsigned mode, LimitOverride limitOverride);
|
||||
|
||||
/*
|
||||
* Control in flightPathAngle setpoint (flollow a slope etc.) and acceleration mode (base case)
|
||||
*/
|
||||
int updateFlightPathAngleAcceleration(float flightPathAngle, float flightPathAngleSp, float airspeedFiltered,
|
||||
float accelerationLongitudinalSp, tecs_mode mode, LimitOverride limitOverride);
|
||||
float accelerationLongitudinalSp, unsigned mode, LimitOverride limitOverride);
|
||||
|
||||
/*
|
||||
* Reset all integrators
|
||||
|
||||
Reference in New Issue
Block a user