-
Notifications
You must be signed in to change notification settings - Fork 1
/
RCFilter.h
38 lines (31 loc) · 823 Bytes
/
RCFilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Created by robosam2003 on 26/08/2022.
//
#ifndef RCFILTER_H
#define RCFILTER_H
class RCFilter {
private:
double RC; //equal to R*C
double prev_value;
unsigned long prev_update_time_us;
public:
/**
* @brief Construct a new RC Filter object
* @param cuttoff_freq (Hz)
*/
explicit RCFilter(double cuttoff_freq);
/**
* @brief Update the filter with new input
* @param input
* @param current_time_us
* @return The filtered output.
*/
double update(double input, unsigned long current_time_us);
// copy constructors
RCFilter(const RCFilter& other);
RCFilter& operator=(const RCFilter& other);
// move constructors
RCFilter(RCFilter&& other) noexcept ;
RCFilter& operator=(RCFilter&& other) noexcept ;
};
#endif //RCFILTER_H