fix: remove high-pass prefilter (ssf is already a high-pass)
This commit is contained in:
@@ -24,7 +24,6 @@ public:
|
|||||||
class StepDetector {
|
class StepDetector {
|
||||||
protected:
|
protected:
|
||||||
StepListener *listener;
|
StepListener *listener;
|
||||||
IirFilter f_highpass;
|
|
||||||
Filt f_neg;
|
Filt f_neg;
|
||||||
SsfFilter f_ssf;
|
SsfFilter f_ssf;
|
||||||
SsfStepDetector f_ssd;
|
SsfStepDetector f_ssd;
|
||||||
|
|||||||
@@ -4,24 +4,8 @@
|
|||||||
|
|
||||||
#include "step_detector.h"
|
#include "step_detector.h"
|
||||||
|
|
||||||
// TODO: we are hardcoding filter coefficients for 60 Hz
|
|
||||||
// TODO: this is tolerable for 50 Hz
|
|
||||||
|
|
||||||
// TODO: check if we can do with floats instead of doubles
|
|
||||||
// (check how much the [already bad] accuracy of filtering suffers)
|
|
||||||
|
|
||||||
// TODO: in Java, check if delta timestamps effectively match FPS
|
|
||||||
// TODO: FPS constant should be passed as argument to C++ (but we keep an FPS define to validate the coefficients)
|
|
||||||
|
|
||||||
// Butterworth filter: order=5, fc=0.5, fs=60, btype='highpass'
|
|
||||||
static std::vector<double> hpf_taps_b {0.91875845, -4.59379227, 9.18758454, -9.18758454, 4.59379227, -0.91875845};
|
|
||||||
static std::vector<double> hpf_taps_a {1. , -4.83056552, 9.33652742, -9.02545247, 4.36360803, -0.8441171};
|
|
||||||
static size_t upslope_width = 4;
|
|
||||||
const size_t len_refr = (size_t) (FPS / (MAX_BPM / 60));
|
|
||||||
|
|
||||||
StepDetector::StepDetector(double fps, StepListener *listener, bool debug) :
|
StepDetector::StepDetector(double fps, StepListener *listener, bool debug) :
|
||||||
listener(listener),
|
listener(listener),
|
||||||
f_highpass(hpf_taps_b, hpf_taps_a),
|
|
||||||
f_neg(1, 0, 0, std::vector<double> {-1.0}),
|
f_neg(1, 0, 0, std::vector<double> {-1.0}),
|
||||||
f_ssf(fps),
|
f_ssf(fps),
|
||||||
f_ssd(fps),
|
f_ssd(fps),
|
||||||
@@ -35,8 +19,7 @@ StepDetector::StepDetector(double fps, StepListener *listener, bool debug) :
|
|||||||
|
|
||||||
void StepDetector::filter(std::vector<float> values) {
|
void StepDetector::filter(std::vector<float> values) {
|
||||||
// TODO: later on, we should use a vector projection towards gravity
|
// TODO: later on, we should use a vector projection towards gravity
|
||||||
auto s0 = (double) values[1]; // take y-axis value for now
|
auto s1 = (double) values[1]; // take y-axis value for now
|
||||||
auto s1 = f_highpass.filter(s0);
|
|
||||||
auto s2 = f_neg.filter(s1);
|
auto s2 = f_neg.filter(s1);
|
||||||
auto s3 = f_ssf.filter(s2);
|
auto s3 = f_ssf.filter(s2);
|
||||||
auto s4 = f_ssd.filter(s3);
|
auto s4 = f_ssd.filter(s3);
|
||||||
|
|||||||
Reference in New Issue
Block a user