1#ifndef BITSIM_ACTUATORS_BACKENDS_SIM_DC_MOTOR_BACKEND_H
2#define BITSIM_ACTUATORS_BACKENDS_SIM_DC_MOTOR_BACKEND_H
6#include "bitsim/extern/nlohmann/json/json.hpp"
41 void read(
const nlohmann::json &j);
114 void advance_(
real_t dt,
bool own_rotor);
118 real_t target_speed_{0.0};
129 real_t measured_speed_{0.0};
130 long last_counts_{0};
131 real_t since_control_{0.0};
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
OutputType
Definition dc_motor_backend_base.h:41
@ TORQUE
Definition dc_motor_backend_base.h:42
DCMotorBackendBase(const std::string &backend_type)
Definition dc_motor_backend_base.h:104
real_t angle() const override
Definition sim_dc_motor_backend.h:85
real_t encoder_angle() const override
Definition sim_dc_motor_backend.cpp:71
const DCMotorParameters & parameters() const noexcept
Definition sim_dc_motor_backend.h:110
real_t current() const noexcept
Definition sim_dc_motor_backend.h:107
static const std::string BACKEND_TYPE
Definition sim_dc_motor_backend.h:73
void set_target_speed(real_t speed) override
Set the target speed of the output shaft [rad/s].
Definition sim_dc_motor_backend.h:79
real_t speed() const override
Definition sim_dc_motor_backend.h:87
real_t measured_speed() const noexcept
Definition sim_dc_motor_backend.h:105
SIM_DCMotorBackend(const DCMotorParameters ¶meters=DCMotorParameters())
Definition sim_dc_motor_backend.cpp:53
real_t voltage() const noexcept
Definition sim_dc_motor_backend.h:108
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.
Definition sim_dc_motor_backend.h:95
void step(real_t dt) override
Advance the backend by dt. A model moves its own shaft.
Definition sim_dc_motor_backend.cpp:77
real_t torque() const override
Definition sim_dc_motor_backend.cpp:65
OutputType output_type() const noexcept override
Definition sim_dc_motor_backend.h:77
real_t target_speed() const noexcept
Definition sim_dc_motor_backend.h:109
Definition dc_motor_backend_base.h:23
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
The state of the output shaft of a motor, as a simulator sees it.
Definition dc_motor_backend_base.h:17
The constants of a brushed DC gear motor with an encoder, and of the speed controller that runs it....
Definition sim_dc_motor_backend.h:21
real_t friction
viscous friction at the rotor [N m s/rad]
Definition sim_dc_motor_backend.h:26
real_t speed_ki
duty cycle per rad of error
Definition sim_dc_motor_backend.h:32
real_t control_period
[s]
Definition sim_dc_motor_backend.h:34
real_t gear_ratio
rotor turns per output turn
Definition sim_dc_motor_backend.h:27
void read(const nlohmann::json &j)
Read the parameters that are in the JSON object. The others keep their defaults.
Definition sim_dc_motor_backend.cpp:34
real_t resistance
armature resistance [Ohm]
Definition sim_dc_motor_backend.h:22
real_t speed_filter
time constant of the speed filter [s]
Definition sim_dc_motor_backend.h:33
real_t no_load_speed() const
Definition sim_dc_motor_backend.h:46
real_t supply_voltage
[V]
Definition sim_dc_motor_backend.h:28
real_t speed_kp
duty cycle per rad/s of error
Definition sim_dc_motor_backend.h:31
real_t inductance
armature inductance [H]
Definition sim_dc_motor_backend.h:23
real_t stall_torque() const
Definition sim_dc_motor_backend.h:51
real_t emf_constant
back-EMF and torque constant, at the rotor [V s/rad]
Definition sim_dc_motor_backend.h:24
uint_t encoder_counts
counts per output turn
Definition sim_dc_motor_backend.h:35
real_t rotor_inertia
[kg m^2]
Definition sim_dc_motor_backend.h:25