From 412dc10353dfcbc338aa1d55b93fa274cc602e3f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 6 May 2016 14:43:12 +1000 Subject: [PATCH] AC_PID: expose parameters as AP_Float this enables full tuning capability --- libraries/AC_PID/AC_P.h | 2 +- libraries/AC_PID/AC_PID.h | 6 +++--- libraries/AC_PID/AC_PI_2D.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/AC_PID/AC_P.h b/libraries/AC_PID/AC_P.h index 4534f471fa..09d0252fd3 100644 --- a/libraries/AC_PID/AC_P.h +++ b/libraries/AC_PID/AC_P.h @@ -57,7 +57,7 @@ public: void operator() (const float p) { _kp = p; } // accessors - float kP() const { return _kp.get(); } + AP_Float &kP() { return _kp; } void kP(const float v) { _kp.set(v); } static const struct AP_Param::GroupInfo var_info[]; diff --git a/libraries/AC_PID/AC_PID.h b/libraries/AC_PID/AC_PID.h index ec6192b61b..d511fcfe4a 100644 --- a/libraries/AC_PID/AC_PID.h +++ b/libraries/AC_PID/AC_PID.h @@ -57,9 +57,9 @@ public: void operator() (float p, float i, float d, float imaxval, float input_filt_hz, float dt ); // get accessors - float kP() const { return _kp.get(); } - float kI() const { return _ki.get(); } - float kD() const { return _kd.get(); } + AP_Float &kP() { return _kp; } + AP_Float &kI() { return _ki; } + AP_Float &kD() { return _kd; } float imax() const { return _imax.get(); } float filt_hz() const { return _filt_hz.get(); } float get_filt_alpha() const; diff --git a/libraries/AC_PID/AC_PI_2D.h b/libraries/AC_PID/AC_PI_2D.h index 46a47990b1..c0632e08e3 100644 --- a/libraries/AC_PID/AC_PI_2D.h +++ b/libraries/AC_PID/AC_PI_2D.h @@ -51,8 +51,8 @@ public: void operator() (float p, float i, float imaxval, float input_filt_hz, float dt); // get accessors - float kP() const { return _kp.get(); } - float kI() const { return _ki.get(); } + AP_Float &kP() { return _kp; } + AP_Float &kI() { return _ki; } float imax() const { return _imax.get(); } float filt_hz() const { return _filt_hz.get(); } float get_filt_alpha() const { return _filt_alpha; }