Rework library without unix sockets for now
This commit is contained in:
parent
e9ae1a320a
commit
0bef6035ae
30 changed files with 987 additions and 136 deletions
35
server_v2/include/Encoders.hpp
Normal file
35
server_v2/include/Encoders.hpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef COMPLIB_SERVER_ENCODERS_HPP
|
||||
#define COMPLIB_SERVER_ENCODERS_HPP
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#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<int32_t, ROBOT_MOTOR_COUNT> get_positions();
|
||||
|
||||
std::array<double, ROBOT_MOTOR_COUNT> get_velocities_rpm();
|
||||
|
||||
private:
|
||||
Encoders() = default;
|
||||
|
||||
Cache position_cache{ROBOT_ENCODER_RATE_HZ};
|
||||
Cache velocity_cache{ROBOT_ENCODER_RATE_HZ};
|
||||
|
||||
std::array<int32_t, ROBOT_MOTOR_COUNT> cached_positions = {0};
|
||||
std::array<double, ROBOT_MOTOR_COUNT> cached_velocities_rpm = {0};
|
||||
};
|
||||
|
||||
|
||||
#endif //COMPLIB_SERVER_ENCODERS_HPP
|
Reference in a new issue