From c83da810dadb670244f48d0c3e8d92fe292e86cd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 30 Nov 2021 14:16:02 +1100 Subject: [PATCH] APM_Control: tweaks from review feedback --- libraries/APM_Control/AP_YawController.cpp | 3 ++- libraries/APM_Control/AP_YawController.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/APM_Control/AP_YawController.cpp b/libraries/APM_Control/AP_YawController.cpp index 7e833edc26..621d251c0b 100644 --- a/libraries/APM_Control/AP_YawController.cpp +++ b/libraries/APM_Control/AP_YawController.cpp @@ -269,7 +269,7 @@ float AP_YawController::get_rate_out(float desired_rate, float scaler, bool disa const float dt = AP::scheduler().get_loop_period_s(); const float eas2tas = _ahrs.get_EAS2TAS(); - bool limit_I = fabsf(_last_out) >= 45; + bool limit_I = fabsf(_last_out) >= 45 || disable_integrator; float rate_z = _ahrs.get_gyro().z; float aspeed; float old_I = rate_pid.get_i(); @@ -314,6 +314,7 @@ float AP_YawController::get_rate_out(float desired_rate, float scaler, bool disa pinfo.P *= deg_scale; pinfo.I *= deg_scale; pinfo.D *= deg_scale; + pinfo.limit = limit_I; // fix the logged target and actual values to not have the scalers applied pinfo.target = desired_rate; diff --git a/libraries/APM_Control/AP_YawController.h b/libraries/APM_Control/AP_YawController.h index 4ff955f846..c0039ec707 100644 --- a/libraries/APM_Control/AP_YawController.h +++ b/libraries/APM_Control/AP_YawController.h @@ -55,7 +55,7 @@ private: AP_Float _K_FF; AP_Int16 _imax; AP_Int8 _rate_enable; - AC_PID rate_pid{0.08, 0.3, 0, 0.3, 0.666, 3, 0, 12, 0.02, 150, 1}; + AC_PID rate_pid{0.04, 0.15, 0, 0.15, 0.666, 3, 0, 12, 0.02, 150, 1}; uint32_t _last_t; float _last_out;