#ifndef GYROSCOPESENSORDUMMY_H #define GYROSCOPESENSORDUMMY_H #include "../GyroscopeSensor.h" #include "RandomSensor.h" #include class GyroscopeSensorDummy : public RandomSensor { private: /** hidden ctor */ GyroscopeSensorDummy() : RandomSensor(Timestamp::fromMS(10)) { ; } public: /** singleton access */ static GyroscopeSensorDummy& get() { static GyroscopeSensorDummy gyro; return gyro; } protected: std::minstd_rand gen; std::uniform_real_distribution distNoise = std::uniform_real_distribution(-0.1, +0.1); GyroscopeData getRandomEntry() override { const Timestamp ts = Timestamp::fromRunningTime(); const float Hz = 0.1; const float intensity = 0.35; const float x = distNoise(gen); const float y = distNoise(gen); const float z = std::sin(ts.sec()*2*M_PI*Hz) * intensity + distNoise(gen); return GyroscopeData(x,y,z); } }; #endif // GYROSCOPESENSORDUMMY_H