|
void | loop () |
| This is the real time thread that streams the data to/from the main board.
|
|
void | send_newest_command () |
| Send the newest control stored in the time series. More...
|
|
void | send_newest_controls () |
| Send the newest control stored in the time series.
|
|
|
static THREAD_FUNCTION_RETURN_TYPE | loop (void *instance_pointer) |
| Private methods. More...
|
|
◆ SpiBus()
blmc_drivers::SpiBus::SpiBus |
( |
std::shared_ptr< MasterBoardInterface > |
main_board_interface, |
|
|
const size_t & |
nb_udrivers, |
|
|
const size_t & |
history_length = 1000 |
|
) |
| |
Construct a new SpiBus object.
The constructor starts a real time thread: SpiBus::loop(). This thread streams the data back and forth collecting the sensor data and sends the control/commands.
- Parameters
-
main_board_interface | is the object that communicate with the main board. The main board provides the hardware informations. |
nb_udrivers | is the number udrivers plugged on the main board. |
history_length | is the size of the buffer of messages stored. |
◆ ~SpiBus()
blmc_drivers::SpiBus::~SpiBus |
( |
| ) |
|
Destroy the SpiBus object.
The destructor handles the proper shutdown of the class and the threads.
◆ get_command()
Get the commands to be send.
- Returns
- Ptr<const CommandTimeseries> is the list of the commands to be send. Inherited from MotorBoardInterface
◆ get_control()
input logs
input logs Get the controls to be send.
- Parameters
-
index | define the kind of control we are looking for. |
- Returns
- Ptr<const ScalarTimeseries> is the list of the controls to be send. Inherited from MotorBoardInterface
◆ get_measurement()
Output and status.
Get the measurements from the main board.
- Parameters
-
udriver_id | is the index of the spi port on the control board |
index | |
- Returns
- std::shared_ptr<const MotorInterface::ScalarTimeseries>
◆ get_sent_command()
Get the sent commands.
- Returns
- Ptr<const CommandTimeseries> is the list of the commands sent recently. Inherited from MotorBoardInterface
◆ get_sent_control()
Get the sent controls.
- Parameters
-
index | define the kind of control we are looking for. |
- Returns
- Ptr<const ScalarTimeseries> is the list of the controls sent recently. Inherited from MotorBoardInterface
◆ get_status()
Get the status of the motor board.
- Returns
- Ptr<const StatusTimeseries> is the list of the last status of the card. Inherited from MotorBoardInterface
◆ loop()
static THREAD_FUNCTION_RETURN_TYPE blmc_drivers::SpiBus::loop |
( |
void * |
instance_pointer | ) |
|
|
inlinestaticprivate |
Private methods.
This is the helper function used for spawning the real time thread.
- Parameters
-
instance_pointer | is the current object in this case. |
- Returns
- THREAD_FUNCTION_RETURN_TYPE depends on the current OS.
◆ send_if_input_changed()
void blmc_drivers::SpiBus::send_if_input_changed |
( |
| ) |
|
|
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.
◆ send_newest_command()
void blmc_drivers::SpiBus::send_newest_command |
( |
| ) |
|
|
private |
Send the newest control stored in the time series.
Some of the command are not implemented/will be implemented. A warning is issued upon miss-use.
◆ set_command()
void blmc_drivers::SpiBus::set_command |
( |
const size_t |
udriver_id, |
|
|
const MotorBoardCommand & |
command |
|
) |
| |
|
virtual |
set_command save the command internally.
In order to actaully send the controls to the network please call "send_if_input_changed"
- Parameters
-
◆ set_control()
Setters.
Setters. set_control save the control internally. In order to actaully send the controls to the network please call "send_if_input_changed"
- Parameters
-
control | is the value of the control. |
index | define the kind of control we want to send. Inherited from MotorBoardInterface |
◆ control_
Inputs.
This is the buffer of the controls to be sent to card.
◆ is_loop_active_
bool blmc_drivers::SpiBus::is_loop_active_ |
|
private |
Loop management.
This boolean makes sure that the loop is stopped upon destruction of this object.
◆ main_board_interface_
std::shared_ptr<MasterBoardInterface> blmc_drivers::SpiBus::main_board_interface_ |
|
private |
◆ measurement_
Outputs.
All the measurements acquiered from the CAN board.
◆ motor_index_toggle_bits_
std::array<bool, 12> blmc_drivers::SpiBus::motor_index_toggle_bits_ |
|
private |
Everytime a motor index is detected the corresponding bit change for the opposite value.
if (index detected on motor X)
{
}
◆ sent_control_
Log.
This is the history of the already sent controls.
The documentation for this class was generated from the following files: