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:
56
sensors/dummy/RandomSensor.h
Normal file
56
sensors/dummy/RandomSensor.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef RANDOMSENSOR_H
|
||||
#define RANDOMSENSOR_H
|
||||
|
||||
#include <thread>
|
||||
#include <Indoor/data/Timestamp.h>
|
||||
#include <Indoor/Assertions.h>
|
||||
|
||||
template <typename Element, typename BaseClass> class RandomSensor : public BaseClass {
|
||||
|
||||
private:
|
||||
|
||||
std::thread thread;
|
||||
bool running = false;
|
||||
Timestamp interval;
|
||||
|
||||
public:
|
||||
|
||||
RandomSensor(const Timestamp interval) : interval(interval) {
|
||||
;
|
||||
}
|
||||
|
||||
void start() override {
|
||||
Assert::isFalse(running, "sensor allready running!");
|
||||
running = true;
|
||||
thread = std::thread(&RandomSensor::run, this);
|
||||
}
|
||||
|
||||
void stop() override {
|
||||
Assert::isTrue(running, "sensor not yet running!");
|
||||
running = false;
|
||||
thread.join();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/** subclasses must provide a random entry here */
|
||||
virtual Element getRandomEntry() = 0;
|
||||
|
||||
private:
|
||||
|
||||
void run() {
|
||||
|
||||
while(running) {
|
||||
|
||||
const Element rnd = getRandomEntry();
|
||||
Sensor<Element>::informListeners(rnd);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(interval.ms()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // RANDOMSENSOR_H
|
||||
Reference in New Issue
Block a user