AC_AttitudeControl: Add minimum angle limit for get_althold_lean_angle_max

This commit is contained in:
Leonard Hall 2018-09-11 23:21:08 +09:30 committed by Randy Mackay
parent 313baec2fd
commit aa0d8cb386
2 changed files with 2 additions and 1 deletions

View File

@ -903,7 +903,7 @@ void AC_AttitudeControl::accel_limiting(bool enable_limits)
float AC_AttitudeControl::get_althold_lean_angle_max() const
{
// convert to centi-degrees for public interface
return ToDeg(_althold_lean_angle_max) * 100.0f;
return MAX(ToDeg(_althold_lean_angle_max), AC_ATTITUDE_CONTROL_ANGLE_LIMIT_MIN) * 100.0f;
}
// Proportional controller with piecewise sqrt sections to constrain second derivative

View File

@ -34,6 +34,7 @@
#define AC_ATTITUDE_CONTROL_ANGLE_LIMIT_TC_DEFAULT 1.0f // Time constant used to limit lean angle so that vehicle does not lose altitude
#define AC_ATTITUDE_CONTROL_ANGLE_LIMIT_THROTTLE_MAX 0.8f // Max throttle used to limit lean angle so that vehicle does not lose altitude
#define AC_ATTITUDE_CONTROL_ANGLE_LIMIT_MIN 10.0f // Min lean angle so that vehicle can maintain limited control
#define AC_ATTITUDE_CONTROL_MIN_DEFAULT 0.1f // minimum throttle mix default
#define AC_ATTITUDE_CONTROL_MAN_DEFAULT 0.5f // manual throttle mix default