|
|
|
@ -185,6 +185,8 @@ private:
@@ -185,6 +185,8 @@ private:
|
|
|
|
|
param_t pitch_rate_i; |
|
|
|
|
param_t pitch_rate_d; |
|
|
|
|
param_t pitch_rate_ff; |
|
|
|
|
param_t tpa_breakpoint; |
|
|
|
|
param_t tpa_slope; |
|
|
|
|
param_t yaw_p; |
|
|
|
|
param_t yaw_rate_p; |
|
|
|
|
param_t yaw_rate_i; |
|
|
|
@ -217,6 +219,9 @@ private:
@@ -217,6 +219,9 @@ private:
|
|
|
|
|
math::Vector<3> rate_ff; /**< Feedforward gain for desired rates */ |
|
|
|
|
float yaw_ff; /**< yaw control feed-forward */ |
|
|
|
|
|
|
|
|
|
float tpa_breakpoint; /**< Throttle PID Attenuation breakpoint */ |
|
|
|
|
float tpa_slope; /**< Throttle PID Attenuation slope */ |
|
|
|
|
|
|
|
|
|
float roll_rate_max; |
|
|
|
|
float pitch_rate_max; |
|
|
|
|
float yaw_rate_max; |
|
|
|
@ -381,6 +386,8 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
@@ -381,6 +386,8 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
|
|
|
|
|
_params_handles.pitch_rate_i = param_find("MC_PITCHRATE_I"); |
|
|
|
|
_params_handles.pitch_rate_d = param_find("MC_PITCHRATE_D"); |
|
|
|
|
_params_handles.pitch_rate_ff = param_find("MC_PITCHRATE_FF"); |
|
|
|
|
_params_handles.tpa_breakpoint = param_find("MC_TPA_BREAK"); |
|
|
|
|
_params_handles.tpa_slope = param_find("MC_TPA_SLOPE"); |
|
|
|
|
_params_handles.yaw_p = param_find("MC_YAW_P"); |
|
|
|
|
_params_handles.yaw_rate_p = param_find("MC_YAWRATE_P"); |
|
|
|
|
_params_handles.yaw_rate_i = param_find("MC_YAWRATE_I"); |
|
|
|
@ -477,6 +484,11 @@ MulticopterAttitudeControl::parameters_update()
@@ -477,6 +484,11 @@ MulticopterAttitudeControl::parameters_update()
|
|
|
|
|
param_get(_params_handles.pitch_rate_ff, &v); |
|
|
|
|
_params.rate_ff(1) = v; |
|
|
|
|
|
|
|
|
|
param_get(_params_handles.tpa_breakpoint, &v); |
|
|
|
|
_params.tpa_breakpoint = v; |
|
|
|
|
param_get(_params_handles.tpa_slope, &v); |
|
|
|
|
_params.tpa_slope = v; |
|
|
|
|
|
|
|
|
|
/* yaw gains */ |
|
|
|
|
param_get(_params_handles.yaw_p, &v); |
|
|
|
|
_params.att_p(2) = v; |
|
|
|
@ -772,7 +784,7 @@ MulticopterAttitudeControl::control_attitude_rates(float dt)
@@ -772,7 +784,7 @@ MulticopterAttitudeControl::control_attitude_rates(float dt)
|
|
|
|
|
rates(2) = _ctrl_state.yaw_rate; |
|
|
|
|
|
|
|
|
|
/* throttle pid attenuation factor */ |
|
|
|
|
float tpa = fminf(1.0f, 1.5f - fabsf(_v_rates_sp.thrust)); |
|
|
|
|
float tpa = fmaxf(0.0f, fminf(1.0f, 1.0f - _params.tpa_slope * (fabsf(_v_rates_sp.thrust) - _params.tpa_breakpoint))); |
|
|
|
|
|
|
|
|
|
/* angular rates error */ |
|
|
|
|
math::Vector<3> rates_err = _rates_sp - rates; |
|
|
|
|