diff --git a/libraries/AC_PID/AC_PID.cpp b/libraries/AC_PID/AC_PID.cpp index c09478c3fa..a02c54ce57 100755 --- a/libraries/AC_PID/AC_PID.cpp +++ b/libraries/AC_PID/AC_PID.cpp @@ -7,10 +7,10 @@ #include "AC_PID.h" const AP_Param::GroupInfo AC_PID::var_info[] PROGMEM = { - AP_GROUPINFO("P", 0, AC_PID, _kp), - AP_GROUPINFO("I", 1, AC_PID, _ki), - AP_GROUPINFO("D", 2, AC_PID, _kd), - AP_GROUPINFO("IMAX", 3, AC_PID, _imax), + AP_GROUPINFO("P", 0, AC_PID, _kp, 0), + AP_GROUPINFO("I", 1, AC_PID, _ki, 0), + AP_GROUPINFO("D", 2, AC_PID, _kd, 0), + AP_GROUPINFO("IMAX", 3, AC_PID, _imax, 0), AP_GROUPEND }; diff --git a/libraries/AC_PID/AC_PID.h b/libraries/AC_PID/AC_PID.h index 536317335b..62dcd60254 100755 --- a/libraries/AC_PID/AC_PID.h +++ b/libraries/AC_PID/AC_PID.h @@ -28,14 +28,12 @@ public: const float &initial_p = 0.0, const float &initial_i = 0.0, const float &initial_d = 0.0, - const int16_t &initial_imax = 0.0) : - - _kp (initial_p), - _ki (initial_i), - _kd (initial_d), - _imax(abs(initial_imax)) + const int16_t &initial_imax = 0.0) { - // no need for explicit load, assuming that the main code uses AP_Param::load_all. + _kp = initial_p; + _ki = initial_i; + _kd = initial_d; + _imax = abs(initial_imax); } /// Iterate the PID, return the new control value diff --git a/libraries/APM_PI/APM_PI.cpp b/libraries/APM_PI/APM_PI.cpp index ed4bbd64de..14354c7df2 100644 --- a/libraries/APM_PI/APM_PI.cpp +++ b/libraries/APM_PI/APM_PI.cpp @@ -8,9 +8,9 @@ #include "APM_PI.h" const AP_Param::GroupInfo APM_PI::var_info[] PROGMEM = { - AP_GROUPINFO("P", 0, APM_PI, _kp), - AP_GROUPINFO("I", 1, APM_PI, _ki), - AP_GROUPINFO("IMAX", 2, APM_PI, _imax), + AP_GROUPINFO("P", 0, APM_PI, _kp, 0), + AP_GROUPINFO("I", 1, APM_PI, _ki, 0), + AP_GROUPINFO("IMAX", 2, APM_PI, _imax, 0), AP_GROUPEND }; diff --git a/libraries/APM_PI/APM_PI.h b/libraries/APM_PI/APM_PI.h index e1e36144d4..cc8f8721bc 100644 --- a/libraries/APM_PI/APM_PI.h +++ b/libraries/APM_PI/APM_PI.h @@ -25,12 +25,11 @@ public: /// APM_PI(const float &initial_p = 0.0, const float &initial_i = 0.0, - const int16_t &initial_imax = 0.0) : - _kp (initial_p), - _ki (initial_i), - _imax(initial_imax) + const int16_t &initial_imax = 0.0) { - // no need for explicit load, assuming that the main code uses AP_Var::load_all. + _kp = initial_p; + _ki = initial_i; + _imax = initial_imax; } /// Iterate the PI, return the new control value diff --git a/libraries/PID/PID.cpp b/libraries/PID/PID.cpp index 931cc52872..47a03ebf5d 100644 --- a/libraries/PID/PID.cpp +++ b/libraries/PID/PID.cpp @@ -8,10 +8,10 @@ #include "PID.h" const AP_Param::GroupInfo PID::var_info[] PROGMEM = { - AP_GROUPINFO("P", 0, PID, _kp), - AP_GROUPINFO("I", 1, PID, _ki), - AP_GROUPINFO("D", 2, PID, _kd), - AP_GROUPINFO("IMAX", 3, PID, _imax), + AP_GROUPINFO("P", 0, PID, _kp, 0), + AP_GROUPINFO("I", 1, PID, _ki, 0), + AP_GROUPINFO("D", 2, PID, _kd, 0), + AP_GROUPINFO("IMAX", 3, PID, _imax, 0), AP_GROUPEND }; diff --git a/libraries/PID/PID.h b/libraries/PID/PID.h index 9de654f8e1..9b0fbd5b52 100644 --- a/libraries/PID/PID.h +++ b/libraries/PID/PID.h @@ -17,12 +17,12 @@ public: PID(const float &initial_p = 0.0, const float &initial_i = 0.0, const float &initial_d = 0.0, - const int16_t &initial_imax = 0) : - _kp (initial_p), - _ki (initial_i), - _kd (initial_d), - _imax(initial_imax) + const int16_t &initial_imax = 0) { + _kp = initial_p; + _ki = initial_i; + _kd = initial_d; + _imax = initial_imax; } /// Iterate the PID, return the new control value