bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
dc_motor_backend_base.h
Go to the documentation of this file.
1#ifndef BITSIM_ACTUATORS_BACKENDS_DC_MOTOR_BACKEND_BASE_H
2#define BITSIM_ACTUATORS_BACKENDS_DC_MOTOR_BACKEND_BASE_H
3
5
6#include <string>
7
8namespace bitsim
9{
10namespace actuators
11{
12
17{
20};
21
22namespace backends
23{
24
38{
39 public:
40 enum class OutputType
41 {
44 };
45
46 virtual ~DCMotorBackendBase() = default;
47
51 virtual OutputType output_type() const noexcept = 0;
52
56 virtual void set_target_speed(real_t speed) = 0;
57
61 virtual void step(real_t dt) = 0;
62
67 virtual void step(real_t dt, const ShaftState &shaft) = 0;
68
72 virtual real_t angle() const = 0;
73
77 virtual real_t speed() const = 0;
78
84 virtual real_t encoder_angle() const { return angle(); }
85
90 virtual real_t torque() const { return 0.0; }
91
96 virtual bool is_ready() const { return true; }
97
101 const std::string &backend_type_str() const noexcept { return backend_type_; }
102
103 protected:
104 explicit DCMotorBackendBase(const std::string &backend_type) : backend_type_(backend_type) {}
105
106 private:
107 const std::string backend_type_;
108};
109
110} // namespace backends
111} // namespace actuators
112} // namespace bitsim
113
114#endif // BITSIM_ACTUATORS_BACKENDS_DC_MOTOR_BACKEND_BASE_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
const std::string & backend_type_str() const noexcept
Definition dc_motor_backend_base.h:101
virtual bool is_ready() const
Definition dc_motor_backend_base.h:96
virtual real_t torque() const
Definition dc_motor_backend_base.h:90
OutputType
Definition dc_motor_backend_base.h:41
@ ANGLE
Definition dc_motor_backend_base.h:43
@ TORQUE
Definition dc_motor_backend_base.h:42
DCMotorBackendBase(const std::string &backend_type)
Definition dc_motor_backend_base.h:104
virtual OutputType output_type() const noexcept=0
virtual void step(real_t dt)=0
Advance the backend by dt. A model moves its own shaft.
virtual real_t encoder_angle() const
Definition dc_motor_backend_base.h:84
virtual void set_target_speed(real_t speed)=0
Set the target speed of the output shaft [rad/s].
Definition dc_motor_backend_base.h:23
Definition dc_motor_backend_base.h:11
Definition dc_motor_backend_base.h:9
double real_t
real_t
Definition bitsim_types.h:20
The state of the output shaft of a motor, as a simulator sees it.
Definition dc_motor_backend_base.h:17
real_t speed
[rad/s]
Definition dc_motor_backend_base.h:19
real_t angle
[rad]
Definition dc_motor_backend_base.h:18