atune: remove yaw D-term and add separate yaw max input freq

We usually don't want the high frequency response in our reduced order
model
This commit is contained in:
bresch 2024-01-03 11:10:50 +01:00
parent 7edfb870ac
commit 936caafc06
3 changed files with 25 additions and 2 deletions

View File

@ -198,6 +198,11 @@ void McAutotuneAttitudeControl::Run()
_kid(2) = 0.f;
}
// Do not use derivative on the yaw axis as it often only amplifies noise
if ((_state == state::yaw) || (_state == state::yaw_pause)) {
_kid(2) = 0.f;
}
// To compute the attitude gain, use the following empirical rule:
// "An error of 60 degrees should produce the maximum control output"
// or K_att * K_rate * rad(60) = 1
@ -564,11 +569,13 @@ const Vector3f McAutotuneAttitudeControl::getIdentificationSignal(hrt_abstime no
float signal;
if (_param_mc_at_sysid_type.get() == static_cast<int32_t>(SignalType::kLinearSineSweep)) {
signal = signal_generator::getLinearSineSweep(_param_mc_at_sysid_f0.get(), _param_mc_at_sysid_f1.get(),
const float f_max = (_state == state::yaw) ? _param_mc_at_sysid_fyaw.get() : _param_mc_at_sysid_f1.get();
signal = signal_generator::getLinearSineSweep(_param_mc_at_sysid_f0.get(), f_max,
_param_mc_at_sysid_time.get(), t);
} else if (_param_mc_at_sysid_type.get() == static_cast<int32_t>(SignalType::kLogSineSweep)) {
signal = signal_generator::getLogSineSweep(_param_mc_at_sysid_f0.get(), _param_mc_at_sysid_f1.get(),
const float f_max = (_state == state::yaw) ? _param_mc_at_sysid_fyaw.get() : _param_mc_at_sysid_f1.get();
signal = signal_generator::getLogSineSweep(_param_mc_at_sysid_f0.get(), f_max,
_param_mc_at_sysid_time.get(), t);
} else {

View File

@ -174,6 +174,7 @@ private:
(ParamFloat<px4::params::MC_AT_SYSID_AMP>) _param_mc_at_sysid_amp,
(ParamFloat<px4::params::MC_AT_SYSID_F0>) _param_mc_at_sysid_f0,
(ParamFloat<px4::params::MC_AT_SYSID_F1>) _param_mc_at_sysid_f1,
(ParamFloat<px4::params::MC_AT_SYSID_FYAW>) _param_mc_at_sysid_fyaw,
(ParamFloat<px4::params::MC_AT_SYSID_TIME>) _param_mc_at_sysid_time,
(ParamInt<px4::params::MC_AT_SYSID_TYPE>) _param_mc_at_sysid_type,
(ParamInt<px4::params::MC_AT_APPLY>) _param_mc_at_apply,

View File

@ -102,6 +102,21 @@ PARAM_DEFINE_FLOAT(MC_AT_SYSID_F0, 1.f);
*/
PARAM_DEFINE_FLOAT(MC_AT_SYSID_F1, 20.f);
/**
* Yaw axis maximum frequency
*
* End frequency of the identification for the yaw axis.
* This is usually set lower than the roll and pitch axes
* to only consider the yaw actuation produced by propeller drag.
*
* @min 0.1
* @max 30.0
* @decimal 1
* @unit Hz
* @group Autotune
*/
PARAM_DEFINE_FLOAT(MC_AT_SYSID_FYAW, 5.f);
/**
* Maneuver time for each axis
*