mc_att_control: remove time constant parameter

Because the parameter does not make sense from a control theory
perspective. Either you have a gain with the unit 1/s or an inverse
gain or time constant with the unit s. But the time constant parameter
was neither bound to any exact unit nor did it apply instead of a gain.
Rather it adjusted multiple gains from rate and attitude control
according to an arbitrary scale. This can only by accident lead to
good tuning.
This commit is contained in:
Matthias Grob 2018-03-03 20:57:32 +00:00
parent ba5f2254cd
commit 6317d36ec9
3 changed files with 12 additions and 54 deletions

View File

@ -17,17 +17,15 @@ set PWM_OUT 1234
if [ $AUTOCNF == yes ]
then
param set MC_ROLL_P 2.0
param set MC_ROLLRATE_P 0.05
param set MC_ROLL_P 2.2
param set MC_ROLLRATE_P 0.06
param set MC_ROLLRATE_I 0.2
param set MC_ROLLRATE_D 0.0015
param set MC_ROLL_TC 0.18
param set MC_ROLLRATE_D 0.0017
param set MC_PITCH_P 2.0
param set MC_PITCHRATE_P 0.05
param set MC_PITCH_P 2.2
param set MC_PITCHRATE_P 0.06
param set MC_PITCHRATE_I 0.2
param set MC_PITCHRATE_D 0.0015
param set MC_PITCH_TC 0.18
param set MC_PITCHRATE_D 0.0017
param set MC_YAW_P 1.0
param set MC_YAWRATE_P 0.15

View File

@ -93,7 +93,6 @@ extern "C" __EXPORT int mc_att_control_main(int argc, char *argv[]);
#define MIN_TAKEOFF_THRUST 0.2f
#define TPA_RATE_LOWER_LIMIT 0.05f
#define ATTITUDE_TC_DEFAULT 0.2f
#define AXIS_INDEX_ROLL 0
#define AXIS_INDEX_PITCH 1
@ -223,9 +222,6 @@ private:
param_t acro_superexpo;
param_t rattitude_thres;
param_t roll_tc;
param_t pitch_tc;
param_t vtol_type;
param_t vtol_opt_recovery_enabled;
param_t vtol_wv_yaw_rate_scale;
@ -469,9 +465,6 @@ _loop_update_rate_hz(initial_update_rate_hz)
_params_handles.rattitude_thres = param_find("MC_RATT_TH");
_params_handles.roll_tc = param_find("MC_ROLL_TC");
_params_handles.pitch_tc = param_find("MC_PITCH_TC");
_params_handles.bat_scale_en = param_find("MC_BAT_SCALE_EN");
/* rotations */
@ -525,36 +518,31 @@ MulticopterAttitudeControl::parameters_update()
{
float v;
float roll_tc, pitch_tc;
param_get(_params_handles.roll_tc, &roll_tc);
param_get(_params_handles.pitch_tc, &pitch_tc);
/* roll gains */
param_get(_params_handles.roll_p, &v);
_params.att_p(0) = v * (ATTITUDE_TC_DEFAULT / roll_tc);
_params.att_p(0) = v;
param_get(_params_handles.roll_rate_p, &v);
_params.rate_p(0) = v * (ATTITUDE_TC_DEFAULT / roll_tc);
_params.rate_p(0) = v;
param_get(_params_handles.roll_rate_i, &v);
_params.rate_i(0) = v;
param_get(_params_handles.roll_rate_integ_lim, &v);
_params.rate_int_lim(0) = v;
param_get(_params_handles.roll_rate_d, &v);
_params.rate_d(0) = v * (ATTITUDE_TC_DEFAULT / roll_tc);
_params.rate_d(0) = v;
param_get(_params_handles.roll_rate_ff, &v);
_params.rate_ff(0) = v;
/* pitch gains */
param_get(_params_handles.pitch_p, &v);
_params.att_p(1) = v * (ATTITUDE_TC_DEFAULT / pitch_tc);
_params.att_p(1) = v;
param_get(_params_handles.pitch_rate_p, &v);
_params.rate_p(1) = v * (ATTITUDE_TC_DEFAULT / pitch_tc);
_params.rate_p(1) = v;
param_get(_params_handles.pitch_rate_i, &v);
_params.rate_i(1) = v;
param_get(_params_handles.pitch_rate_integ_lim, &v);
_params.rate_int_lim(1) = v;
param_get(_params_handles.pitch_rate_d, &v);
_params.rate_d(1) = v * (ATTITUDE_TC_DEFAULT / pitch_tc);
_params.rate_d(1) = v;
param_get(_params_handles.pitch_rate_ff, &v);
_params.rate_ff(1) = v;

View File

@ -39,34 +39,6 @@
* @author Anton Babushkin <anton@px4.io>
*/
/**
* Roll time constant
*
* Reduce if the system is too twitchy, increase if the response is too slow and sluggish.
*
* @unit s
* @min 0.15
* @max 0.25
* @decimal 2
* @increment 0.01
* @group Multicopter Attitude Control
*/
PARAM_DEFINE_FLOAT(MC_ROLL_TC, 0.2f);
/**
* Pitch time constant
*
* Reduce if the system is too twitchy, increase if the response is too slow and sluggish.
*
* @unit s
* @min 0.15
* @max 0.25
* @decimal 2
* @increment 0.01
* @group Multicopter Attitude Control
*/
PARAM_DEFINE_FLOAT(MC_PITCH_TC, 0.2f);
/**
* Roll P gain
*