Branch data Line data Source code
1 : : #pragma once
2 : :
3 : : #include "i_us_processor.hpp"
4 : : #include "us_types.hpp"
5 : : #include <cstddef>
6 : :
7 : : /**
8 : : * @brief Concrete implementation of IUsProcessor for statistical filtering of ultrasonic samples.
9 : : * @internal
10 : : */
11 : : class UsProcessor : public IUsProcessor
12 : : {
13 : : public:
14 : : /** @internal */
15 : 3 : UsProcessor() = default;
16 : 17 : ~UsProcessor() override = default;
17 : :
18 : : /** @copydoc IUsProcessor::process() */
19 : : Reading process(const Reading *pings, uint8_t total_pings, const UsConfig &cfg) override;
20 : :
21 : : private:
22 : : /** @internal */
23 : : float reduce_median(float *v, std::size_t n);
24 : :
25 : : /** @internal */
26 : : float reduce_dominant_cluster(float *v, std::size_t n);
27 : :
28 : : /** @internal */
29 : : float get_std_dev(const float *samples, uint8_t count);
30 : : };
|