|
bitsim
Model, simulate, estimate and control robots in C++
|
A model of a DC gear motor, its encoder and its speed controller. More...
#include <sim_dc_motor_backend.h>


Public Member Functions | |
| SIM_DCMotorBackend (const DCMotorParameters ¶meters=DCMotorParameters()) | |
| OutputType | output_type () const noexcept override |
| void | set_target_speed (real_t speed) override |
| Set the target speed of the output shaft [rad/s]. | |
| void | step (real_t dt) override |
| Advance the backend by dt. A model moves its own shaft. | |
| void | step (real_t dt, const ShaftState &shaft) override |
| Advance the backend by dt, with the shaft moved by a physics engine. Backends with OutputType::ANGLE ignore the shaft. | |
| real_t | angle () const override |
| real_t | speed () const override |
| real_t | torque () const override |
| void | set_load_torque (real_t torque) noexcept |
| The load on the output shaft when the motor moves its own rotor [N m]. It opposes positive rotation. | |
| real_t | encoder_angle () const override |
| real_t | measured_speed () const noexcept |
| real_t | current () const noexcept |
| real_t | voltage () const noexcept |
| real_t | target_speed () const noexcept |
| const DCMotorParameters & | parameters () const noexcept |
| Public Member Functions inherited from bitsim::actuators::backends::DCMotorBackendBase | |
| virtual | ~DCMotorBackendBase ()=default |
| virtual bool | is_ready () const |
| const std::string & | backend_type_str () const noexcept |
Static Public Attributes | |
| static const std::string | BACKEND_TYPE = "SIMULATION" |
Additional Inherited Members | |
| Public Types inherited from bitsim::actuators::backends::DCMotorBackendBase | |
| enum class | OutputType { TORQUE , ANGLE } |
| Protected Member Functions inherited from bitsim::actuators::backends::DCMotorBackendBase | |
| DCMotorBackendBase (const std::string &backend_type) | |
A model of a DC gear motor, its encoder and its speed controller.
The electrical part is \( L \, di/dt = V - R i - K_e \omega_r \), with the rotor speed \( \omega_r = N \omega \). The motor puts the torque \( N K_e i \) on the output shaft. The controller runs every control_period: it measures the speed from the encoder counts, filters it, and sets the duty cycle of the voltage with a PI controller and a back-EMF feedforward, as a board would.
step(dt) moves the rotor with its own inertia and an optional load torque. step(dt, shaft) takes the shaft from a physics engine instead, which then applies torque() to it.
|
explicit |
|
inlineoverridevirtual |
Implements bitsim::actuators::backends::DCMotorBackendBase.
|
inlinenoexcept |
|
overridevirtual |
Reimplemented from bitsim::actuators::backends::DCMotorBackendBase.
|
inlinenoexcept |
|
inlineoverridevirtualnoexcept |
Implements bitsim::actuators::backends::DCMotorBackendBase.
|
inlinenoexcept |
|
inlinenoexcept |
The load on the output shaft when the motor moves its own rotor [N m]. It opposes positive rotation.
|
inlineoverridevirtual |
Set the target speed of the output shaft [rad/s].
Implements bitsim::actuators::backends::DCMotorBackendBase.
|
inlineoverridevirtual |
Implements bitsim::actuators::backends::DCMotorBackendBase.
|
overridevirtual |
Advance the backend by dt. A model moves its own shaft.
Implements bitsim::actuators::backends::DCMotorBackendBase.
|
overridevirtual |
Advance the backend by dt, with the shaft moved by a physics engine. Backends with OutputType::ANGLE ignore the shaft.
Implements bitsim::actuators::backends::DCMotorBackendBase.
|
inlinenoexcept |
|
overridevirtual |
Reimplemented from bitsim::actuators::backends::DCMotorBackendBase.
|
inlinenoexcept |
|
static |