|
|
|
@ -190,6 +190,7 @@ private:
@@ -190,6 +190,7 @@ private:
|
|
|
|
|
param_t roll_rate_max; |
|
|
|
|
param_t pitch_rate_max; |
|
|
|
|
param_t yaw_rate_max; |
|
|
|
|
param_t yaw_auto_max; |
|
|
|
|
|
|
|
|
|
param_t acro_roll_max; |
|
|
|
|
param_t acro_pitch_max; |
|
|
|
@ -214,8 +215,9 @@ private:
@@ -214,8 +215,9 @@ private:
|
|
|
|
|
float roll_rate_max; |
|
|
|
|
float pitch_rate_max; |
|
|
|
|
float yaw_rate_max; |
|
|
|
|
float yaw_auto_max; |
|
|
|
|
math::Vector<3> mc_rate_max; /**< attitude rate limits in stabilized modes */ |
|
|
|
|
|
|
|
|
|
math::Vector<3> auto_rate_max; /**< attitude rate limits in auto modes */ |
|
|
|
|
math::Vector<3> acro_rate_max; /**< max attitude rates in acro mode */ |
|
|
|
|
float rattitude_thres; |
|
|
|
|
int vtol_type; /**< 0 = Tailsitter, 1 = Tiltrotor, 2 = Standard airframe */ |
|
|
|
@ -347,6 +349,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
@@ -347,6 +349,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
|
|
|
|
|
_params.pitch_rate_max = 0.0f; |
|
|
|
|
_params.yaw_rate_max = 0.0f; |
|
|
|
|
_params.mc_rate_max.zero(); |
|
|
|
|
_params.auto_rate_max.zero(); |
|
|
|
|
_params.acro_rate_max.zero(); |
|
|
|
|
_params.rattitude_thres = 1.0f; |
|
|
|
|
_params.vtol_opt_recovery_enabled = false; |
|
|
|
@ -379,6 +382,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
@@ -379,6 +382,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
|
|
|
|
|
_params_handles.roll_rate_max = param_find("MC_ROLLRATE_MAX"); |
|
|
|
|
_params_handles.pitch_rate_max = param_find("MC_PITCHRATE_MAX"); |
|
|
|
|
_params_handles.yaw_rate_max = param_find("MC_YAWRATE_MAX"); |
|
|
|
|
_params_handles.yaw_auto_max = param_find("MC_YAWRAUTO_MAX"); |
|
|
|
|
_params_handles.acro_roll_max = param_find("MC_ACRO_R_MAX"); |
|
|
|
|
_params_handles.acro_pitch_max = param_find("MC_ACRO_P_MAX"); |
|
|
|
|
_params_handles.acro_yaw_max = param_find("MC_ACRO_Y_MAX"); |
|
|
|
@ -482,6 +486,14 @@ MulticopterAttitudeControl::parameters_update()
@@ -482,6 +486,14 @@ MulticopterAttitudeControl::parameters_update()
|
|
|
|
|
param_get(_params_handles.yaw_rate_max, &_params.yaw_rate_max); |
|
|
|
|
_params.mc_rate_max(2) = math::radians(_params.yaw_rate_max); |
|
|
|
|
|
|
|
|
|
/* auto angular rate limits */ |
|
|
|
|
param_get(_params_handles.roll_rate_max, &_params.roll_rate_max); |
|
|
|
|
_params.auto_rate_max(0) = math::radians(_params.roll_rate_max); |
|
|
|
|
param_get(_params_handles.pitch_rate_max, &_params.pitch_rate_max); |
|
|
|
|
_params.auto_rate_max(1) = math::radians(_params.pitch_rate_max); |
|
|
|
|
param_get(_params_handles.yaw_auto_max, &_params.yaw_auto_max); |
|
|
|
|
_params.auto_rate_max(2) = math::radians(_params.yaw_auto_max); |
|
|
|
|
|
|
|
|
|
/* manual rate control scale and auto mode roll/pitch rate limits */ |
|
|
|
|
param_get(_params_handles.acro_roll_max, &v); |
|
|
|
|
_params.acro_rate_max(0) = math::radians(v); |
|
|
|
@ -705,7 +717,11 @@ MulticopterAttitudeControl::control_attitude(float dt)
@@ -705,7 +717,11 @@ MulticopterAttitudeControl::control_attitude(float dt)
|
|
|
|
|
|
|
|
|
|
/* limit rates */ |
|
|
|
|
for (int i = 0; i < 3; i++) { |
|
|
|
|
_rates_sp(i) = math::constrain(_rates_sp(i), -_params.mc_rate_max(i), _params.mc_rate_max(i)); |
|
|
|
|
if (_v_control_mode.flag_control_velocity_enabled) { |
|
|
|
|
_rates_sp(i) = math::constrain(_rates_sp(i), -_params.auto_rate_max(i), _params.auto_rate_max(i)); |
|
|
|
|
} else { |
|
|
|
|
_rates_sp(i) = math::constrain(_rates_sp(i), -_params.mc_rate_max(i), _params.mc_rate_max(i)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* feed forward yaw setpoint rate */ |
|
|
|
|