diff --git a/include/control_toolbox/low_pass_filter.hpp b/include/control_toolbox/low_pass_filter.hpp index df214d09..8c8acded 100644 --- a/include/control_toolbox/low_pass_filter.hpp +++ b/include/control_toolbox/low_pass_filter.hpp @@ -101,30 +101,16 @@ class LowPassFilter */ bool update(const T & data_in, T & data_out); - bool set_params( - const double sampling_frequency, - const double damping_frequency, - const double damping_intensity) - { - // TODO(roncapat): parameters validation - this->sampling_frequency = sampling_frequency; - this->damping_frequency = damping_frequency; - this->damping_intensity = damping_intensity; - compute_internal_params(); - return true; - } - bool is_configured() const { return configured_; } -protected: /*! * \brief Internal computation of the feedforward and feedbackward coefficients * according to the LowPassFilter parameters. */ - void compute_internal_params() + void set_params(double sampling_frequency, double damping_frequency, double damping_intensity) { a1_ = exp( -1.0 / sampling_frequency * (2.0 * M_PI * damping_frequency) / @@ -134,13 +120,12 @@ class LowPassFilter private: // Filter parameters + double a1_; /** feedbackward coefficient. */ + double b1_; /** feedforward coefficient. */ /** internal data storage (double). */ double filtered_value, filtered_old_value, old_value; /** internal data storage (wrench). */ Eigen::Matrix msg_filtered, msg_filtered_old, msg_old; - double sampling_frequency, damping_frequency, damping_intensity; - double a1_; /** feedbackward coefficient. */ - double b1_; /** feedforward coefficient. */ bool configured_ = false; }; @@ -157,8 +142,6 @@ LowPassFilter::~LowPassFilter() template bool LowPassFilter::configure() { - compute_internal_params(); - // Initialize storage Vectors filtered_value = filtered_old_value = old_value = 0; // TODO(destogl): make the size parameterizable and more intelligent is using complex types