libalmath  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
digitalfilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2014 Aldebaran Robotics. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the COPYING file.
5  */
6 
7 #pragma once
8 
9 #ifndef _LIB_ALMATH_ALMATH_DSP_DIGITALFILTER_H_
10 #define _LIB_ALMATH_ALMATH_DSP_DIGITALFILTER_H_
11 
12 #include <vector>
13 #include <almath/api.h>
14 #include <boost/version.hpp>
15 #if (BOOST_VERSION < 106200) && !defined(BOOST_CB_DISABLE_DEBUG)
16 # define BOOST_CB_DISABLE_DEBUG
17 #endif
18 #include <boost/circular_buffer.hpp>
19 
20 namespace AL
21 {
22 namespace Math
23 {
24 namespace DSP
25 {
26 
27 class ALMATH_API DigitalFilter
28 {
29 public:
30  DigitalFilter(void);
31  ~DigitalFilter(void);
32 
42  void configureFilter(const std::vector<float> & pWeightsIn,
43  const std::vector<float> & pWeightsOut,
44  float pDcGain);
45 
49  void resetFilter();
50 
55  float processFilter(float pInputData);
56 
57 private:
58  boost::circular_buffer<float> fFilterBufferIn;
59  boost::circular_buffer<float> fFilterBufferOut;
60 
61  float fFilterDcGain;
62 
63  std::vector<float> fFilterWeightsIn;
64  std::vector<float> fFilterWeightsOut;
65 };
66 }
67 }
68 }
69 
70 
71 
72 
73 
74 #endif // _LIB_ALMATH_ALMATH_DSP_DIGITALFILTER_H_