#ifndef COMPLIB_SERVER_ENCODER_HPP #define COMPLIB_SERVER_ENCODER_HPP #include #include #include #define ENCODER_COUNT 4 #define ENCODER_CACHE_DURATION_MS 4 // 200 HZ class Encoder { public: std::vector read_all(); std::vector read_all_cached(); static Encoder& get_instance() { static Encoder instance; return instance; } Encoder(Encoder const&) = delete; void operator=(Encoder const&) = delete; private: Encoder(); int32_t encoder_cache[ENCODER_COUNT] = {0}; std::chrono::time_point last_read = std::chrono::system_clock::now(); }; #endif // COMPLIB_SERVER_ENCODER_HPP