MedianFilteredLinearConvertedValue.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 // TODO: Should not depend on the whole ethercat library.
7 
8 
10 {
11  template <typename T>
13  {
14  public:
22 
23  void
24  init(T* raw,
25  const DefaultRapidXmlReaderNode& node,
26  float defaultValue = std::nan("1"),
27  bool offsetBeforeFactor = true,
28  const char* nameForDebugging = "")
29  {
30  lcv.init(raw, node, defaultValue, offsetBeforeFactor, nameForDebugging);
31  median = RtMedianFilter{node.attribute_as<std::size_t>("median_filter_width")};
32  }
33 
34  void
35  read()
36  {
37  lcv.read();
38  value = median.update(lcv.value);
39  }
40 
43  float value = 0;
44  };
45 
46 } // namespace armarx::control::rt_filters
armarx::control::rt_filters::MedianFilteredLinearConvertedValue::lcv
ethercat::LinearConvertedValue< T > lcv
Definition: MedianFilteredLinearConvertedValue.h:41
armarx::DefaultRapidXmlReaderNode
Definition: DefaultRapidXmlReader.h:36
armarx::control::ethercat::LinearConvertedValue
Brief description of class LinearConvertedValue.
Definition: LinearConvertedValue.h:43
armarx::control::rt_filters
Definition: AverageFilter.cpp:3
DataInterface.h
armarx::control::rt_filters::MedianFilteredLinearConvertedValue::init
void init(T *raw, const DefaultRapidXmlReaderNode &node, float defaultValue=std::nan("1"), bool offsetBeforeFactor=true, const char *nameForDebugging="")
Definition: MedianFilteredLinearConvertedValue.h:24
armarx::control::rt_filters::MedianFilteredLinearConvertedValue::MedianFilteredLinearConvertedValue
MedianFilteredLinearConvertedValue()=default
armarx::control::rt_filters::MedianFilteredLinearConvertedValue::value
float value
Definition: MedianFilteredLinearConvertedValue.h:43
RtMedianFilter.h
armarx::control::rt_filters::MedianFilteredLinearConvertedValue
Definition: MedianFilteredLinearConvertedValue.h:12
armarx::control::rt_filters::MedianFilteredLinearConvertedValue::read
void read()
Definition: MedianFilteredLinearConvertedValue.h:35
T
float T
Definition: UnscentedKalmanFilterTest.cpp:35
armarx::DefaultRapidXmlReaderNode::attribute_as
void attribute_as(const std::string &attrName, T &value) const
Definition: DefaultRapidXmlReader.h:201
armarx::control::rt_filters::MedianFilteredLinearConvertedValue::operator=
MedianFilteredLinearConvertedValue & operator=(MedianFilteredLinearConvertedValue &&)=default
armarx::control::rt_filters::MedianFilteredLinearConvertedValue::median
RtMedianFilter median
Definition: MedianFilteredLinearConvertedValue.h:42
armarx::control::rt_filters::RtMedianFilter::update
float update(float value)
Definition: RtMedianFilter.cpp:15
armarx::control::rt_filters::RtMedianFilter
Definition: RtMedianFilter.h:14