diff --git a/lbr_fri_ros2/include/lbr_fri_ros2/utils.hpp b/lbr_fri_ros2/include/lbr_fri_ros2/utils.hpp index fbbf8478..e71fd236 100644 --- a/lbr_fri_ros2/include/lbr_fri_ros2/utils.hpp +++ b/lbr_fri_ros2/include/lbr_fri_ros2/utils.hpp @@ -46,7 +46,9 @@ class ExponentialFilter { * @param[in] previous The previous smoothed value. * @return double The returned smoothed value. */ - inline double compute(const double ¤t, const double &previous); + inline double compute(const double ¤t, const double &previous) { + return filters::exponentialSmoothing(current, previous, alpha_); + }; /** * @brief Set the cutoff frequency object. Internally computes the new #alpha_. @@ -61,14 +63,14 @@ class ExponentialFilter { * * @return const double& */ - inline const double &get_sample_time() const; + inline const double &get_sample_time() const { return sample_time_; }; /** * @brief Get #alpha_. * * @return const double& */ - inline const double &get_alpha() const; + inline const double &get_alpha() const { return alpha_; }; protected: /** diff --git a/lbr_fri_ros2/src/utils.cpp b/lbr_fri_ros2/src/utils.cpp index 54d4afd6..4d278f14 100644 --- a/lbr_fri_ros2/src/utils.cpp +++ b/lbr_fri_ros2/src/utils.cpp @@ -7,10 +7,6 @@ ExponentialFilter::ExponentialFilter(const double &cutoff_frequency, const doubl set_cutoff_frequency(cutoff_frequency, sample_time); } -inline double ExponentialFilter::compute(const double ¤t, const double &previous) { - return filters::exponentialSmoothing(current, previous, alpha_); -} - void ExponentialFilter::set_cutoff_frequency(const double &cutoff_frequency, const double &sample_time) { cutoff_frequency_ = cutoff_frequency; @@ -24,10 +20,6 @@ void ExponentialFilter::set_cutoff_frequency(const double &cutoff_frequency, } } -inline const double &ExponentialFilter::get_sample_time() const { return sample_time_; } - -inline const double &ExponentialFilter::get_alpha() const { return alpha_; } - double ExponentialFilter::compute_alpha_(const double &cutoff_frequency, const double &sample_time) { double omega_3db = 2.0 * M_PI * sample_time * cutoff_frequency;