add: GravityFilter

This commit is contained in:
2026-05-20 00:10:37 +02:00
parent b333712d9c
commit 2371d16af8
4 changed files with 57 additions and 0 deletions

View File

@@ -44,6 +44,8 @@ namespace pd_signal {
double mean(const std::vector<double>& in);
void diff(std::vector<double>& out, const std::vector<double>& in);
std::vector<double> gauss(size_t N, double mu, double sigma);
/**
* Convolution of two polynomials given in ASCENDING power order.
* If <c>p = p_0 + p_1 x + ... + p_{P-1} x^{P-1}</c> and likewise for q,

View File

@@ -48,4 +48,17 @@ public:
void primeFilters(double fps, std::vector<double> sig);
};
/** mean-filter the gravity vector, then take acceleration downwards */
class GravityFilter {
size_t N;
std::vector<double> gauss_taps;
Filt gx;
Filt gy;
Filt gz;
public:
// 5 secs buffer, prime y with direction of gravity (for tests & faster init)
GravityFilter(double fps);
double filter(std::vector<float> values);
};
#endif //PASADASUPERPROJECT_STEP_DETECTOR_H