AC_AttControl: add ANGLE_BOOST param

This commit is contained in:
Randy Mackay 2016-01-07 12:11:27 +09:00
parent 2046271da4
commit 01518ad1ab
3 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,13 @@ const AP_Param::GroupInfo AC_AttitudeControl::var_info[] PROGMEM = {
// @User: Advanced
AP_GROUPINFO("ACCEL_P_MAX", 7, AC_AttitudeControl, _accel_pitch_max, AC_ATTITUDE_CONTROL_ACCEL_RP_MAX_DEFAULT),
// @Param: ANGLE_BOOST
// @DisplayName: Angle Boost
// @Description: Angle Boost increases output throttle as the vehicle leans to reduce loss of altitude
// @Values: 0:Disabled, 1:Enabled
// @User: Advanced
AP_GROUPINFO("ANGLE_BOOST", 12, AC_AttitudeControl, _angle_boost_enabled, 1),
AP_GROUPEND
};

View File

@ -286,6 +286,7 @@ protected:
AP_Float _accel_pitch_max; // maximum rotation acceleration for earth-frame pitch axis
AP_Float _accel_yaw_max; // maximum rotation acceleration for earth-frame yaw axis
AP_Int8 _rate_bf_ff_enabled; // Enable/Disable body frame rate feed forward
AP_Int8 _angle_boost_enabled; // Enable/Disable angle boost
// internal variables
// To-Do: make rate targets a typedef instead of Vector3f?

View File

@ -8,6 +8,10 @@
// throttle value should be 0 ~ 1000
float AC_AttitudeControl_Multi::get_boosted_throttle(float throttle_in)
{
if (!_angle_boost_enabled) {
return throttle_in;
_angle_boost = 0;
}
// inverted_factor is 1 for tilt angles below 60 degrees
// reduces as a function of angle beyond 60 degrees
// becomes zero at 90 degrees