30 #ifndef FILTERS_MEAN_HPP_
31 #define FILTERS_MEAN_HPP_
67 virtual bool update(
const T & data_in, T& data_out);
80 number_of_observations_(0)
90 ROS_ERROR(
"MeanFilter did not find param number_of_observations");
105 template <
typename T>
109 if (last_updated_row_ >= number_of_observations_ - 1)
110 last_updated_row_ = 0;
114 data_storage_->push_back(data_in);
117 unsigned int length = data_storage_->size();
120 for (uint32_t row = 0; row < length; row ++)
122 data_out += data_storage_->at(row);
133 template <
typename T>
150 virtual bool update(
const std::vector<T> & data_in, std::vector<T>& data_out);
166 template <
typename T>
168 number_of_observations_(0)
172 template <
typename T>
178 ROS_ERROR(
"MultiChannelMeanFilter did not find param number_of_observations");
182 temp.resize(number_of_channels_);
188 template <
typename T>
194 template <
typename T>
197 if (data_in.size() != number_of_channels_ || data_out.size() != number_of_channels_)
199 ROS_ERROR(
"Configured with wrong size config:%d in:%d out:%d", number_of_channels_, (
int)data_in.size(), (
int)data_out.size());
204 if (last_updated_row_ >= number_of_observations_ - 1)
205 last_updated_row_ = 0;
209 data_storage_->push_back(data_in);
212 unsigned int length = data_storage_->size();
215 for (uint32_t i = 0; i < number_of_channels_; i++)
218 for (uint32_t row = 0; row < length; row ++)
220 data_out[i] += data_storage_->at(row)[i];
222 data_out[i] /= length;
229 #endif// FILTERS_MEAN_HPP_