ZotBins Core
Loading...
Searching...
No Matches
FullnessMetric.hpp
Go to the documentation of this file.
1
8
9#ifndef FULLNESS_HPP
10#define FULLNESS_HPP
11
12#include "Distance.hpp"
13#include <array>
14#include <cstddef>
15#include <cstdint>
16
17namespace Fullness
18{
24 {
25 public:
32 FullnessMetric(uint32_t binHeight, Distance &distanceSensor);
33
39 float getFullness();
40
47 bool isValidDistance(uint32_t distance);
48
49 private:
50 static constexpr size_t mDistanceBufferSize = 8;
51
52 float IQM(std::array<int32_t, mDistanceBufferSize> &distanceBuffer); // interquartile mean, a statistical "average" across multiple values. i assume iqm uses shell sort to sort the values, then creates the iqm using standard formulas, then passes that into (is called by) getFullness to calculate a final percentage value. otherwise the iqm could be of fullness values but that would likely be slower requiring multiple calls to getFullness
53
54 void shellSort(std::array<int32_t, mDistanceBufferSize> &arr);
55
60 uint32_t mBinHeight;
61
66 Distance &mDistanceSensor;
67 };
68}
69#endif
Header file for ultrasonic distance class.
Definition Distance.hpp:24
FullnessMetric(uint32_t binHeight, Distance &distanceSensor)
Construct a new FullnessMetric object.
Definition FullnessMetric.cpp:13
float getFullness()
Returns the fullness percentage of the bin.
Definition FullnessMetric.cpp:17
bool isValidDistance(uint32_t distance)
Checks if distance is valid.
Definition FullnessMetric.cpp:34