Rework library without unix sockets for now

This commit is contained in:
Konstantin Lampalzer 2022-05-21 23:29:55 +02:00
parent e9ae1a320a
commit 0bef6035ae
30 changed files with 987 additions and 136 deletions

View file

@ -0,0 +1,46 @@
#ifndef COMPLIB_SERVER_ODOMETRYCONTROLLER_HPP
#define COMPLIB_SERVER_ODOMETRYCONTROLLER_HPP
#include <thread>
#include <chrono>
#include "include/Odometry.hpp"
class OdometryController {
public:
static OdometryController &getInstance() {
static OdometryController instance;
return instance;
}
OdometryController(OdometryController const &) = delete;
void operator=(OdometryController const &) = delete;
void enable();
void disable();
void reset();
Odometry get();
private:
typedef std::chrono::steady_clock clock;
OdometryController();
std::thread odometry_thread;
[[noreturn]] void odometry_loop();
Odometry current_odometry{};
bool enabled = false;
double last_position_left{0};
double last_position_right{0};
std::chrono::time_point<clock> last_run;
};
#endif //COMPLIB_SERVER_ODOMETRYCONTROLLER_HPP