fixed some issues

added new pose/turn detections
new helper classes
define-flags for libEigen
This commit is contained in:
2018-09-04 10:49:00 +02:00
parent f990485d44
commit 857d7a1553
51 changed files with 2149 additions and 207 deletions

View File

@@ -0,0 +1,74 @@
#ifndef COMPLEMENTARY_H
#define COMPLEMENTARY_H
#include "../dsp/iir/BiQuad.h"
#include "../../math/stats/SampleRateEstimator.h"
namespace Filter {
template <typename T> class Complementary {
private:
const float fLo;
const float fHi;
IIR::BiQuad<T> lp;
IIR::BiQuad<T> hp;
SampleRateEstimator slp;
SampleRateEstimator shp;
T slow;
T fast;
public:
/** ctor with transition frequency and sample-rate */
Complementary(const float fLo, const float fHi) : fLo(fLo), fHi(fHi), slow(), fast() {
//adjust();
}
void addSlow(const Timestamp ts, const T& slow) {
slp.update(ts);
this->slow = lp.filter(slow);
adjustLP();
}
void addFast(const Timestamp ts, const T& fast) {
shp.update(ts);
this->fast = hp.filter(fast);
adjustHP();
}
T get() const {
return slow+fast;
}
T getLo() const {
return slow;
}
T getHi() const {
return fast;
}
private:
void adjustLP() {
const float freqLP = slp.getCurHz();
//std::cout << freqLP << ":" << freqHP << std::endl;
if (freqLP > fLo*2) {lp.setLowPass(fLo, 0.707, freqLP);}
}
void adjustHP() {
const float freqHP = slp.getCurHz();
//std::cout << freqLP << ":" << freqHP << std::endl;
if (freqHP > fHi*2) {hp.setHighPass(fHi, 0.707, freqHP);}
}
};
}
#endif // COMPLEMENTARY_H