a lot!!! of changes
added main menu added debug display many debug widgets for plotting live data worked on android live sensors added offline-data sensor feeding some dummy data sensors worked on the map display added ui debug for grid-points, particles and weights added a cool dude to display the estimation added real filtering based on the Indoor components c++11 fixes for android compilation online and offline filtering support new resampling technique for testing map loading via dialog
This commit is contained in:
@@ -1,66 +1,46 @@
|
||||
#ifndef STEPSENSOR_H
|
||||
#define STEPSENSOR_H
|
||||
|
||||
|
||||
#include "../misc/fixc11.h"
|
||||
#include <Indoor/sensors/imu/StepDetection.h>
|
||||
#include "AccelerometerSensor.h"
|
||||
#include "Sensor.h"
|
||||
|
||||
|
||||
struct StepData {
|
||||
;
|
||||
const int stepsSinceLastEvent = 0;
|
||||
StepData(const int stepsSinceLastEvent) : stepsSinceLastEvent(stepsSinceLastEvent) {;}
|
||||
};
|
||||
|
||||
class StepSensor : public Sensor<StepData>, public SensorListener<AccelerometerData> {
|
||||
/**
|
||||
* step-sensor detects steps from the accelerometer
|
||||
*/
|
||||
class StepSensor : public SensorListener<AccelerometerData>, public Sensor<StepData> {
|
||||
|
||||
private:
|
||||
|
||||
AccelerometerSensor& acc;
|
||||
StepDetection sd;
|
||||
|
||||
public:
|
||||
|
||||
/** hidden ctor. use singleton */
|
||||
StepSensor(AccelerometerSensor& acc) : acc(acc) {
|
||||
;
|
||||
}
|
||||
|
||||
void start() override {
|
||||
StepSensor(AccelerometerSensor& acc) {
|
||||
acc.addListener(this);
|
||||
acc.start();
|
||||
}
|
||||
|
||||
void stop() override {
|
||||
throw "todo";
|
||||
virtual void start() override {
|
||||
//
|
||||
}
|
||||
|
||||
virtual void onSensorData(const AccelerometerData& data) override {
|
||||
parse(data);
|
||||
virtual void stop() override {
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
const float threshold = 11.0;
|
||||
const int blockTime = 25;
|
||||
int block = 0;
|
||||
|
||||
void parse(const AccelerometerData& data) {
|
||||
|
||||
const float x = data.x;
|
||||
const float y = data.y;
|
||||
const float z = data.z;
|
||||
|
||||
const float mag = std::sqrt( (x*x) + (y*y) + (z*z) );
|
||||
|
||||
if (block > 0) {
|
||||
--block;
|
||||
} else if (mag > threshold) {
|
||||
informListeners(StepData());
|
||||
block = blockTime;
|
||||
virtual void onSensorData(Sensor<AccelerometerData>* sensor, const Timestamp ts, const AccelerometerData& data) override {
|
||||
(void) sensor;
|
||||
const bool step = sd.add(ts, data);
|
||||
if (step) {
|
||||
informListeners(ts, StepData(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // STEPSENSOR_H
|
||||
|
||||
Reference in New Issue
Block a user