bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
dc_motor_board_base.h
Go to the documentation of this file.
1#ifndef BITSIM_BOARDS_DC_MOTOR_BOARD_BASE_H
2#define BITSIM_BOARDS_DC_MOTOR_BOARD_BASE_H
3
5
6#include <chrono>
7#include <optional>
8
9namespace bitsim
10{
11namespace boards
12{
13
18{
23
28
32 std::chrono::steady_clock::time_point received_at{};
33};
34
44{
45 public:
46 virtual ~DCMotorBoardBase() = default;
47
51 virtual void connect() = 0;
52
56 virtual uint_t n_motors() const noexcept = 0;
57
61 virtual void set_target_speed(uint_t channel, real_t speed) = 0;
62
67 virtual void update() = 0;
68
73 virtual std::optional<MotorChannelState> motor_state(uint_t channel) const = 0;
74
78 virtual bool is_alive() const = 0;
79
80 protected:
81 DCMotorBoardBase() = default;
82};
83
84} // namespace boards
85} // namespace bitsim
86
87#endif // BITSIM_BOARDS_DC_MOTOR_BOARD_BASE_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
virtual void set_target_speed(uint_t channel, real_t speed)=0
Set the target speed of the output shaft of a motor [rad/s].
virtual void connect()=0
Connect to the board.
virtual bool is_alive() const =0
virtual void update()=0
Exchange messages with the board: send the targets when it is time and read what has arrived....
virtual uint_t n_motors() const noexcept=0
virtual std::optional< MotorChannelState > motor_state(uint_t channel) const =0
virtual ~DCMotorBoardBase()=default
Definition arduino_connector_base.h:15
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20
What a board last reported about one of its motors.
Definition dc_motor_board_base.h:18
real_t angle
The angle of the output shaft [rad], since the board started.
Definition dc_motor_board_base.h:22
real_t speed
The speed of the output shaft [rad/s].
Definition dc_motor_board_base.h:27
std::chrono::steady_clock::time_point received_at
When the report arrived.
Definition dc_motor_board_base.h:32