#ifndef COMPLIB_SERVER_ENCODERS_HPP #define COMPLIB_SERVER_ENCODERS_HPP #include #include #include "include/Cache.hpp" #include "include/Robot.hpp" class Encoders { public: static Encoders &getInstance() { static Encoders instance; return instance; } Encoders(Encoders const &) = delete; void operator=(Encoders const &) = delete; std::array get_positions(); std::array get_velocities_ms(); private: Encoders() = default; Cache position_cache{ROBOT_ENCODER_RATE_HZ}; Cache velocity_cache{ROBOT_ENCODER_RATE_HZ}; std::array cached_positions = {0}; std::array cached_velocities_ms = {0}; }; #endif //COMPLIB_SERVER_ENCODERS_HPP