diff --git a/libraries/AP_TECS/AP_TECS.cpp b/libraries/AP_TECS/AP_TECS.cpp index 785e6bd8bf..62698902fc 100644 --- a/libraries/AP_TECS/AP_TECS.cpp +++ b/libraries/AP_TECS/AP_TECS.cpp @@ -176,6 +176,14 @@ const AP_Param::GroupInfo AP_TECS::var_info[] PROGMEM = { // @User: Advanced AP_GROUPINFO("LAND_DAMP", 19, AP_TECS, _landDamp, 0.5f), + // @Param: LAND_PMAX + // @DisplayName: Maximum pitch during final stage of landing + // @Description: This limits the pitch used during the final stage of automatic landing. During the final landing stage most planes need to keep their pitch small to avoid stalling. A maximum of 10 degrees is usually good. A value of zero means to use the normal pitch limits. + // @Range: 0 40 + // @Increment: 1 + // @User: Advanced + AP_GROUPINFO("LAND_PMAX", 20, AP_TECS, _land_pitch_max, 10), + AP_GROUPEND }; @@ -802,6 +810,11 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm, // in flare use min pitch from LAND_PITCH_CD _PITCHminf = max(_PITCHminf, aparm.land_pitch_cd * 0.01f); + // and use max pitch from TECS_LAND_PMAX + if (_land_pitch_max > 0) { + _PITCHmaxf = min(_PITCHmaxf, _land_pitch_max); + } + // and allow zero throttle _THRminf = 0; } else if (flight_stage == FLIGHT_LAND_APPROACH && (-_climb_rate) > _land_sink) { @@ -824,6 +837,7 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm, _PITCHminf = max(_PITCHminf, pitch_limit_cd*0.01f); } } + // convert to radians _PITCHmaxf = radians(_PITCHmaxf); _PITCHminf = radians(_PITCHminf); diff --git a/libraries/AP_TECS/AP_TECS.h b/libraries/AP_TECS/AP_TECS.h index 5770299206..79b3cba636 100644 --- a/libraries/AP_TECS/AP_TECS.h +++ b/libraries/AP_TECS/AP_TECS.h @@ -132,6 +132,7 @@ private: AP_Float _land_sink; AP_Int8 _pitch_max; AP_Int8 _pitch_min; + AP_Int8 _land_pitch_max; // throttle demand in the range from 0.0 to 1.0 float _throttle_dem;