Plane: removed controller error in transmitter tuning

This commit is contained in:
Andrew Tridgell 2022-02-19 17:08:16 +11:00
parent 9eab217081
commit b444420329
2 changed files with 0 additions and 72 deletions

View File

@ -299,74 +299,3 @@ void AP_Tuning_Plane::reload_value(uint8_t parm)
}
}
/*
return current controller error
*/
float AP_Tuning_Plane::controller_error(uint8_t parm)
{
#if HAL_QUADPLANE_ENABLED
if (!plane.quadplane.available()) {
return 0;
}
// in general a good tune will have rmsP significantly greater
// than rmsD. Otherwise it is too easy to push D too high while
// tuning a quadplane and end up with D dominating
const float max_P_D_ratio = 3.0f;
if (plane.quadplane.motors->get_throttle() < 0.1f) {
// don't report stale errors if not running VTOL motors
return 0;
}
switch(parm) {
// special handling of dual-parameters
case TUNING_RATE_ROLL_PI:
case TUNING_RATE_ROLL_P:
case TUNING_RATE_ROLL_I:
case TUNING_RATE_ROLL_FF:
return plane.quadplane.attitude_control->control_monitor_rms_output_roll();
case TUNING_RATE_ROLL_D: {
// special case for D term to keep it well below P
float rms_P = plane.quadplane.attitude_control->control_monitor_rms_output_roll_P();
float rms_D = plane.quadplane.attitude_control->control_monitor_rms_output_roll_D();
if (rms_P < rms_D * max_P_D_ratio) {
return max_P_D_ratio;
}
return rms_P+rms_D;
}
case TUNING_RATE_PITCH_PI:
case TUNING_RATE_PITCH_P:
case TUNING_RATE_PITCH_I:
case TUNING_RATE_PITCH_FF:
return plane.quadplane.attitude_control->control_monitor_rms_output_pitch();
case TUNING_RATE_PITCH_D: {
// special case for D term to keep it well below P
float rms_P = plane.quadplane.attitude_control->control_monitor_rms_output_pitch_P();
float rms_D = plane.quadplane.attitude_control->control_monitor_rms_output_pitch_D();
if (rms_P < rms_D * max_P_D_ratio) {
return max_P_D_ratio;
}
return rms_P+rms_D;
}
case TUNING_RATE_YAW_PI:
case TUNING_RATE_YAW_P:
case TUNING_RATE_YAW_I:
case TUNING_RATE_YAW_D:
case TUNING_RATE_YAW_FF:
return plane.quadplane.attitude_control->control_monitor_rms_output_yaw();
default:
// no special handler
return 0;
}
#else
// no special handler
return 0;
#endif // HAL_QUADPLANE_ENABLED
}

View File

@ -89,7 +89,6 @@ private:
void save_value(uint8_t parm) override;
void reload_value(uint8_t parm) override;
void set_value(uint8_t parm, float value) override;
float controller_error(uint8_t parm) override;
// tuning set arrays
static const uint8_t tuning_set_rate_roll_pitch[];