13 if (alpha < 0 || alpha > 1)
14 throw std::invalid_argument(
"alpha must be between 0 and 1");
19 void add(
const Eigen::Vector<double, dims>& value) {
20 if (current_value_.has_value())
21 current_value_ = alpha_ * current_value_.value() + (1 - alpha_) * value;
23 current_value_ = value;
26 Eigen::Vector<double, dims>
current_value()
const {
return current_value_.value(); }
28 Eigen::Vector<double, dims>
operator()(
const Eigen::Vector<double, dims>& value) {
34 std::optional<Eigen::Vector<double, dims>> current_value_;
Definition exponential_filter.hpp:10
ExponentialFilter(double alpha)
Definition exponential_filter.hpp:12
Eigen::Vector< double, dims > current_value() const
Definition exponential_filter.hpp:26
ExponentialFilter(const ExponentialFilter &)=default
Eigen::Vector< double, dims > operator()(const Eigen::Vector< double, dims > &value)
Definition exponential_filter.hpp:28
void add(const Eigen::Vector< double, dims > &value)
Definition exponential_filter.hpp:19
Definition dynamics_limit.cpp:8