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,41 @@
#ifndef SAMPLERATEESTIMATOR_H
#define SAMPLERATEESTIMATOR_H
#include "../../data/Timestamp.h"
class SampleRateEstimator {
private:
const double a = 0.99;
double curHz = 0;
Timestamp tsLast;
public:
float update(const Timestamp ts) {
// first
if (tsLast.isZero()) {
tsLast = ts;
return 0;
}
const double diffSec = static_cast<double>((ts-tsLast).sec());
tsLast = ts;
if (diffSec != 0) {
curHz = a*curHz + (1-a) * (1.0/diffSec);
}
return static_cast<float>(curHz);
}
float getCurHz() const {
return static_cast<float>(curHz);
}
};
#endif // SAMPLERATEESTIMATOR_H