diff --git a/include/control_toolbox/pid.hpp b/include/control_toolbox/pid.hpp index e08b901..c213706 100644 --- a/include/control_toolbox/pid.hpp +++ b/include/control_toolbox/pid.hpp @@ -548,6 +548,7 @@ class CONTROL_TOOLBOX_PUBLIC Pid double i_error_; /**< Integral of position error. */ double d_error_; /**< Derivative of position error. */ double cmd_; /**< Command to send. */ + // TODO(christophfroehlich) remove this -> breaks ABI [[deprecated("Use d_error_")]] double error_dot_; /**< Derivative error */ }; diff --git a/src/pid.cpp b/src/pid.cpp index 732387a..8aed6a3 100644 --- a/src/pid.cpp +++ b/src/pid.cpp @@ -44,6 +44,9 @@ #include "control_toolbox/pid.hpp" +// Disable deprecated warnings +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" namespace control_toolbox { Pid::Pid(double p, double i, double d, double i_max, double i_min, bool antiwindup) @@ -66,6 +69,9 @@ Pid::Pid(const Pid & source) reset(); } +// Enable deprecated warnings again +#pragma GCC diagnostic pop + Pid::~Pid() {} void Pid::initialize(double p, double i, double d, double i_max, double i_min, bool antiwindup) @@ -81,7 +87,13 @@ void Pid::reset() p_error_ = 0.0; i_error_ = 0.0; d_error_ = 0.0; + + // Disable deprecated warnings + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" error_dot_ = 0.0; // deprecated + #pragma GCC diagnostic pop + cmd_ = 0.0; } @@ -168,7 +180,11 @@ double Pid::compute_command(double error, double error_dot, const double & dt_s) double p_term, d_term, i_term; p_error_ = error; // this is error = target - state d_error_ = error_dot; + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" error_dot_ = error_dot; // deprecated + #pragma GCC diagnostic pop if ( dt_s <= 0.0 || !std::isfinite(error) || !std::isfinite(error_dot)) {