This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
YASMIN/sensors/android/GyroscopeSensorAndroid.h
kazu 075d8bb633 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
2016-09-16 19:30:04 +02:00

60 lines
959 B
C++

#ifndef GYROSCOPESENSORANDROID_H
#define GYROSCOPESENSORANDROID_H
#ifdef ANDROID
#include <sstream>
#include "../GyroscopeSensor.h"
#include <QtSensors/QGyroscope>
#include "../AccelerometerSensor.h"
class GyroscopeSensorAndroid : public GyroscopeSensor {
private:
QGyroscope gyro;
/** hidden ctor. use singleton */
GyroscopeSensorAndroid() {
;
}
public:
/** singleton access */
static GyroscopeSensorAndroid& get() {
static GyroscopeSensorAndroid gyro;
return gyro;
}
float degToRad(const float deg) {
return deg / 180.0f * M_PI;
}
void start() override {
auto onSensorData = [&] () {
GyroscopeData data(degToRad(gyro.reading()->x()), degToRad(gyro.reading()->y()), degToRad(gyro.reading()->z()));
informListeners(data);
};
gyro.connect(&gyro, &QGyroscope::readingChanged, onSensorData);
gyro.start();
}
void stop() override {
throw "TODO";
}
};
#endif // ANDROID
#endif // GYROSCOPESENSORANDROID_H