blmc_drivers
|
Public Member Functions | |
SpiMotorBoard (std::shared_ptr< SpiBus > spi_bus, const size_t udriver_id) | |
Construct a new SpiMotorBoard object. More... | |
~SpiMotorBoard () | |
Destroy the SpiMotorBoard object. More... | |
virtual std::shared_ptr< const MotorInterface::ScalarTimeseries > | get_measurement (const int &index) const |
Output and status. More... | |
virtual std::shared_ptr< const MotorBoardInterface::StatusTimeseries > | get_status () const |
Get the status of the motor board. More... | |
virtual std::shared_ptr< const MotorInterface::ScalarTimeseries > | get_control (const int &index) const |
input logs More... | |
virtual std::shared_ptr< const MotorBoardInterface::CommandTimeseries > | get_command () const |
Get the commands to be send. More... | |
virtual std::shared_ptr< const MotorInterface::ScalarTimeseries > | get_sent_control (const int &index) const |
Get the sent controls. More... | |
virtual std::shared_ptr< const MotorBoardInterface::CommandTimeseries > | get_sent_command () const |
Get the sent commands. More... | |
virtual void | set_control (const double &control, const int &index) |
Setters. More... | |
virtual void | set_command (const MotorBoardCommand &command) |
set_command save the command internally. More... | |
virtual void | send_if_input_changed () |
Actually send the commands and the controls. More... | |
bool | is_ready () |
return s only once board and motors are ready. | |
![]() | |
virtual | ~MotorBoardInterface () |
Destroy the MotorBoardInterface object. | |
Private Attributes | |
std::shared_ptr< SpiBus > | spi_bus_ |
Communication related attributes. More... | |
size_t | udriver_id_ |
udriver_id_ is the index of the udriver controlled by the master board. More... | |
Additional Inherited Members | |
![]() | |
enum | MeasurementIndex { current_0, current_1, position_0, position_1, velocity_0, velocity_1, analog_0, analog_1, encoder_index_0, encoder_index_1, measurement_count } |
This is the list of the measurement we can access. | |
enum | ControlIndex { current_target_0, current_target_1, control_count } |
This is the list of the controls we can send. | |
typedef real_time_tools::ThreadsafeTimeseries< double > | ScalarTimeseries |
A useful shortcut. | |
typedef ScalarTimeseries::Index | Index |
A useful shortcut. | |
typedef real_time_tools::ThreadsafeTimeseries< Index > | IndexTimeseries |
A useful shortcut. | |
typedef real_time_tools::ThreadsafeTimeseries< MotorBoardStatus > | StatusTimeseries |
A useful shortcut. | |
typedef real_time_tools::ThreadsafeTimeseries< MotorBoardCommand > | CommandTimeseries |
A useful shortcut. | |
template<typename Type > | |
using | Ptr = std::shared_ptr< Type > |
A useful shortcut. | |
template<typename Type > | |
using | Vector = std::vector< Type > |
A useful shortcut. | |
blmc_drivers::SpiMotorBoard::SpiMotorBoard | ( | std::shared_ptr< SpiBus > | spi_bus, |
const size_t | udriver_id | ||
) |
Construct a new SpiMotorBoard object.
The constructor starts a real time thread: SpiMotorBoard::loop(). This thread streams the data back and forth collecting the sensor data and sends the control/commands.
spi_bus | is the object that communicate with the master board which in turn communicate with the motor boards. The master board provides the hardware informations and sends the commands. |
udriver_id | is the id of the udriver this class represents. |
blmc_drivers::SpiMotorBoard::~SpiMotorBoard | ( | ) |
Destroy the SpiMotorBoard object.
The destructor handles the proper shutdown of the class and the threads.
|
virtual |
Get the commands to be send.
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
input logs
input logs Get the controls to be send.
index | define the kind of control we are looking for. |
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
Output and status.
Getters. Get the measurements
index | is the kind of measurement we are looking for. |
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
Get the sent commands.
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
Get the sent controls.
index | define the kind of control we are looking for. |
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
Get the status of the motor board.
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
Actually send the commands and the controls.
Inherited from MotorBoardInterface. This particualr instance does not actually check if it is is a new command or control as the full status of the robot is exchange at every tick.
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
set_command save the command internally.
In order to actaully send the controls to the network please call "send_if_input_changed"
command | is the command to be sent. Inherited from MotorBoardInterface |
Implements blmc_drivers::MotorBoardInterface.
|
virtual |
Setters.
Setters. set_control save the control internally. In order to actaully send the controls to the network please call "send_if_input_changed"
control | is the value of the control. |
index | define the kind of control we want to send. Inherited from MotorBoardInterface |
Implements blmc_drivers::MotorBoardInterface.
|
private |
Communication related attributes.
Master board interface sdk: https://github.com/open-dynamic-robot-initiative/master-board
|
private |
udriver_id_ is the index of the udriver controlled by the master board.
The index is the one used in MasterBoardInterface. The index should correspond to the hardware SPI index onboard the card.