![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Fertige Version mit geschwindigkeit 100
Dependencies: mbed
Fork of Micromouse_alpha_copy_copy by
LowpassFilter.h@0:a9fe4ef404bf, 2018-03-07 (annotated)
- Committer:
- ruesipat
- Date:
- Wed Mar 07 14:06:19 2018 +0000
- Revision:
- 0:a9fe4ef404bf
- Child:
- 1:d9e840c48b1e
hallo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ruesipat | 0:a9fe4ef404bf | 1 | /* |
ruesipat | 0:a9fe4ef404bf | 2 | * LowpassFilter.h |
ruesipat | 0:a9fe4ef404bf | 3 | * Copyright (c) 2018, ZHAW |
ruesipat | 0:a9fe4ef404bf | 4 | * All rights reserved. |
ruesipat | 0:a9fe4ef404bf | 5 | */ |
ruesipat | 0:a9fe4ef404bf | 6 | |
ruesipat | 0:a9fe4ef404bf | 7 | #ifndef LOWPASS_FILTER_H_ |
ruesipat | 0:a9fe4ef404bf | 8 | #define LOWPASS_FILTER_H_ |
ruesipat | 0:a9fe4ef404bf | 9 | |
ruesipat | 0:a9fe4ef404bf | 10 | #include <cstdlib> |
ruesipat | 0:a9fe4ef404bf | 11 | |
ruesipat | 0:a9fe4ef404bf | 12 | /** |
ruesipat | 0:a9fe4ef404bf | 13 | * This class implements a time-discrete 2nd order lowpass filter for a series of data values. |
ruesipat | 0:a9fe4ef404bf | 14 | * This filter can typically be used within a periodic task that takes measurements that need |
ruesipat | 0:a9fe4ef404bf | 15 | * to be filtered, like speed or position values. |
ruesipat | 0:a9fe4ef404bf | 16 | */ |
ruesipat | 0:a9fe4ef404bf | 17 | class LowpassFilter { |
ruesipat | 0:a9fe4ef404bf | 18 | |
ruesipat | 0:a9fe4ef404bf | 19 | public: |
ruesipat | 0:a9fe4ef404bf | 20 | |
ruesipat | 0:a9fe4ef404bf | 21 | LowpassFilter(); |
ruesipat | 0:a9fe4ef404bf | 22 | virtual ~LowpassFilter(); |
ruesipat | 0:a9fe4ef404bf | 23 | void reset(); |
ruesipat | 0:a9fe4ef404bf | 24 | void reset(float value); |
ruesipat | 0:a9fe4ef404bf | 25 | void setPeriod(float period); |
ruesipat | 0:a9fe4ef404bf | 26 | void setFrequency(float frequency); |
ruesipat | 0:a9fe4ef404bf | 27 | float getFrequency(); |
ruesipat | 0:a9fe4ef404bf | 28 | float filter(float value); |
ruesipat | 0:a9fe4ef404bf | 29 | |
ruesipat | 0:a9fe4ef404bf | 30 | private: |
ruesipat | 0:a9fe4ef404bf | 31 | |
ruesipat | 0:a9fe4ef404bf | 32 | float period; |
ruesipat | 0:a9fe4ef404bf | 33 | float frequency; |
ruesipat | 0:a9fe4ef404bf | 34 | float a11, a12, a21, a22, b1, b2; |
ruesipat | 0:a9fe4ef404bf | 35 | float x1, x2; |
ruesipat | 0:a9fe4ef404bf | 36 | }; |
ruesipat | 0:a9fe4ef404bf | 37 | |
ruesipat | 0:a9fe4ef404bf | 38 | #endif /* LOWPASS_FILTER_H_ */ |