|
bitsim
Model, simulate, estimate and control robots in C++
|
An Arduino that drives DC motors with encoders and talks over MQTT. More...
#include <dc_arduino_board_impl.h>


Classes | |
| struct | Config |
Public Types | |
| using | Clock = std::chrono::steady_clock |
Public Member Functions | |
| DCArduinoBoardImpl (const Config &config) | |
| void | connect () override |
| Connect to the board. | |
| uint_t | n_motors () const noexcept override |
| void | set_target_speed (uint_t channel, real_t speed) override |
| Set the target speed of the output shaft of a motor [rad/s]. | |
| void | update () override |
| Exchange messages with the board: send the targets when it is time and read what has arrived. Cheap, so it is safe to call it often. | |
| std::optional< MotorChannelState > | motor_state (uint_t channel) const override |
| bool | is_alive () const override |
| bool | wait_for_board (std::chrono::milliseconds timeout) |
| Wait until the board reports, for at most timeout. | |
| const Config & | config () const noexcept |
| real_t | round_trip () const noexcept |
| real_t | mean_round_trip () const noexcept |
| real_t | max_round_trip () const noexcept |
| uint_t | n_sent () const noexcept |
| uint_t | n_received () const noexcept |
| Public Member Functions inherited from bitsim::boards::DCMotorBoardBase | |
| virtual | ~DCMotorBoardBase ()=default |
Additional Inherited Members | |
| Protected Member Functions inherited from bitsim::boards::DCMotorBoardBase | |
| DCMotorBoardBase ()=default | |
An Arduino that drives DC motors with encoders and talks over MQTT.
The application publishes the target speeds on the command topic, and the board publishes the distance each wheel has covered on the state topic:
Speeds are wheel speeds in rad/s and distances are in m. The board turns encoder counts into distance with its wheel radius, so wheel_radius here must match the one in the sketch. ack is the number of the last command the board received, which gives the round trip of the messages.
| using bitsim::boards::arduino::DCArduinoBoardImpl::Clock = std::chrono::steady_clock |
|
explicit |
|
inlinenoexcept |
|
overridevirtual |
Connect to the board.
Implements bitsim::boards::DCMotorBoardBase.
|
overridevirtual |
Implements bitsim::boards::DCMotorBoardBase.
|
inlinenoexcept |
|
inlinenoexcept |
|
overridevirtual |
Implements bitsim::boards::DCMotorBoardBase.
|
inlineoverridevirtualnoexcept |
Implements bitsim::boards::DCMotorBoardBase.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
overridevirtual |
Set the target speed of the output shaft of a motor [rad/s].
Implements bitsim::boards::DCMotorBoardBase.
|
overridevirtual |
Exchange messages with the board: send the targets when it is time and read what has arrived. Cheap, so it is safe to call it often.
Implements bitsim::boards::DCMotorBoardBase.
| bool bitsim::boards::arduino::DCArduinoBoardImpl::wait_for_board | ( | std::chrono::milliseconds | timeout | ) |
Wait until the board reports, for at most timeout.