Inherits from RokubiminiBusManager. It's used for managing the Ethercat buses. More...
#include <RokubiminiEthercatBusManager.hpp>
Public Types | |
using | BusMap = std::unordered_map< std::string, std::unique_ptr< rokubimini::soem_interface::EthercatBusBase >> |
Public Member Functions | |
bool | addEthercatBus (rokubimini::soem_interface::EthercatBusBase *bus) |
Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer. More... | |
bool | addEthercatBus (std::unique_ptr< rokubimini::soem_interface::EthercatBusBase > bus) |
Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer. More... | |
bool | addRokubiminiToBus (RokubiminiEthercat *rokubimini, rokubimini::soem_interface::EthercatBusBase *bus, const std::shared_ptr< setup::RokubiminiEthercat > &rokubiminiEthercatSetup) const |
Adds a Rokubimini to Bus. More... | |
std::unique_ptr< rokubimini::soem_interface::EthercatBusBase > | extractBusByName (const std::string &name) |
Returns an owning bus pointer. The manager is now not managing this bus anymore. More... | |
BusMap | extractBuses () |
Extracts all buses from the manager. The manager is now not managing any buses anymore. More... | |
rokubimini::soem_interface::EthercatBusBase * | getBusByName (const std::string &name) const |
Returns a non owning bus pointer. The manager still manages all the buses. More... | |
bool | loadSetup (std::vector< std::shared_ptr< rokubimini::Rokubimini >> &rokubiminis) override |
Loads the Rokubimini Setups. More... | |
void | readAllBuses () override |
Calls update read on all busses. More... | |
RokubiminiEthercatBusManager ()=default | |
void | setBussesOperational () |
Sets all busses to operational state. More... | |
void | setBussesPreOperational () |
Sets all busses to pre operational state. More... | |
void | setBussesSafeOperational () |
Sets all busses to safe operational state. More... | |
void | setConfigMode () override |
void | setRunMode () override |
void | shutdownAllBuses () override |
Calls shutdown on all busses. More... | |
bool | startupAllBuses () |
Starts up all busses and puts them in operational mode. More... | |
bool | startupCommunication () override |
Starts up all busses. More... | |
void | waitForState (const uint16_t state, const uint16_t slave=0, const std::string &busName="", const unsigned int maxRetries=40, const double retrySleep=0.001) |
Waits for the slave to reach a state. More... | |
void | writeToAllBuses () override |
Calls update write on all busses. More... | |
~RokubiminiEthercatBusManager () override=default | |
Public Member Functions inherited from rokubimini::RokubiminiBusManager | |
virtual void | addRokubiminiSetupToList (const std::shared_ptr< setup::Rokubimini > &rokubiminiSetup) |
virtual bool | addRokubiminiToBus (Rokubimini *rokubimini, const std::shared_ptr< setup::Rokubimini > &rokubiminiSetup) const |
std::vector< std::shared_ptr< setup::Rokubimini > > | getRokubiminiSetups () |
RokubiminiBusManager () | |
virtual | ~RokubiminiBusManager ()=default |
Protected Attributes | |
BusMap | buses_ |
Map with all the Ethercat buses available. More... | |
std::recursive_mutex | busMutex_ |
Mutex prohibiting simultaneous access to EtherCAT bus manager. More... | |
Protected Attributes inherited from rokubimini::RokubiminiBusManager | |
std::vector< std::shared_ptr< setup::Rokubimini > > | attachedRokubiminiSetups_ |
Inherits from RokubiminiBusManager. It's used for managing the Ethercat buses.
Definition at line 32 of file RokubiminiEthercatBusManager.hpp.
using rokubimini::ethercat::RokubiminiEthercatBusManager::BusMap = std::unordered_map<std::string, std::unique_ptr<rokubimini::soem_interface::EthercatBusBase>> |
Definition at line 35 of file RokubiminiEthercatBusManager.hpp.
|
default |
|
overridedefault |
bool rokubimini::ethercat::RokubiminiEthercatBusManager::addEthercatBus | ( | rokubimini::soem_interface::EthercatBusBase * | bus | ) |
Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer.
bus | Raw bus ptr |
Definition at line 80 of file RokubiminiEthercatBusManager.cpp.
bool rokubimini::ethercat::RokubiminiEthercatBusManager::addEthercatBus | ( | std::unique_ptr< rokubimini::soem_interface::EthercatBusBase > | bus | ) |
Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer.
bus | Unique bus ptr |
Definition at line 101 of file RokubiminiEthercatBusManager.cpp.
bool rokubimini::ethercat::RokubiminiEthercatBusManager::addRokubiminiToBus | ( | RokubiminiEthercat * | rokubimini, |
rokubimini::soem_interface::EthercatBusBase * | bus, | ||
const std::shared_ptr< setup::RokubiminiEthercat > & | rokubiminiEthercatSetup | ||
) | const |
Adds a Rokubimini to Bus.
This method is used for adding a Rokubimini Ethercat instance to the Ethercat Bus. This method also adds the EthercatSlave pointer to the Rokubimini Ethercat implementation.
rokubimini | The RokubiminiEthercat instance. |
bus | The bus to which the RokubiminiEthercat will be attached. |
rokubiminiEthercatSetup | The Rokubimini Ethercat Setup instance. |
Definition at line 52 of file RokubiminiEthercatBusManager.cpp.
std::unique_ptr< rokubimini::soem_interface::EthercatBusBase > rokubimini::ethercat::RokubiminiEthercatBusManager::extractBusByName | ( | const std::string & | name | ) |
Returns an owning bus pointer. The manager is now not managing this bus anymore.
[in] | name | The bus name |
Definition at line 218 of file RokubiminiEthercatBusManager.cpp.
RokubiminiEthercatBusManager::BusMap rokubimini::ethercat::RokubiminiEthercatBusManager::extractBuses | ( | ) |
Extracts all buses from the manager. The manager is now not managing any buses anymore.
Definition at line 225 of file RokubiminiEthercatBusManager.cpp.
|
inline |
Returns a non owning bus pointer. The manager still manages all the buses.
[in] | name | The bus name |
Definition at line 124 of file RokubiminiEthercatBusManager.hpp.
|
overridevirtual |
Loads the Rokubimini Setups.
This method is used for loading the Rokubimini Ethercat Setups assigned to the RokubiminiEthercatBusManager and then attaching them to the existing bus. It's given as input the vector with pointers to every rokubimini, from which the Ethercat implementation grubs the RokubiminiEthercat instances and attaches them to the bus. This is done by calling addRokubiminiToBus.
rokubiminis | The vector holding all the pointers to the existing Rokubiminis. |
Implements rokubimini::RokubiminiBusManager.
Definition at line 7 of file RokubiminiEthercatBusManager.cpp.
|
overridevirtual |
Calls update read on all busses.
Reimplemented from rokubimini::RokubiminiBusManager.
Definition at line 190 of file RokubiminiEthercatBusManager.cpp.
void rokubimini::ethercat::RokubiminiEthercatBusManager::setBussesOperational | ( | ) |
Sets all busses to operational state.
Definition at line 129 of file RokubiminiEthercatBusManager.cpp.
void rokubimini::ethercat::RokubiminiEthercatBusManager::setBussesPreOperational | ( | ) |
Sets all busses to pre operational state.
Definition at line 139 of file RokubiminiEthercatBusManager.cpp.
void rokubimini::ethercat::RokubiminiEthercatBusManager::setBussesSafeOperational | ( | ) |
Sets all busses to safe operational state.
Definition at line 149 of file RokubiminiEthercatBusManager.cpp.
|
overridevirtual |
Reimplemented from rokubimini::RokubiminiBusManager.
Definition at line 69 of file RokubiminiEthercatBusManager.cpp.
|
overridevirtual |
Reimplemented from rokubimini::RokubiminiBusManager.
Definition at line 75 of file RokubiminiEthercatBusManager.cpp.
|
overridevirtual |
Calls shutdown on all busses.
Reimplemented from rokubimini::RokubiminiBusManager.
Definition at line 208 of file RokubiminiEthercatBusManager.cpp.
bool rokubimini::ethercat::RokubiminiEthercatBusManager::startupAllBuses | ( | ) |
Starts up all busses and puts them in operational mode.
Definition at line 122 of file RokubiminiEthercatBusManager.cpp.
|
overridevirtual |
Starts up all busses.
Reimplemented from rokubimini::RokubiminiBusManager.
Definition at line 176 of file RokubiminiEthercatBusManager.cpp.
void rokubimini::ethercat::RokubiminiEthercatBusManager::waitForState | ( | const uint16_t | state, |
const uint16_t | slave = 0 , |
||
const std::string & | busName = "" , |
||
const unsigned int | maxRetries = 40 , |
||
const double | retrySleep = 0.001 |
||
) |
Waits for the slave to reach a state.
[in] | state | Ethercat state |
[in] | slave | Slave address, 0 = all slaves |
[in] | busName | The name of the bus |
[in] | maxRetries | The maximum retries |
[in] | retrySleep | The retry sleep |
Definition at line 159 of file RokubiminiEthercatBusManager.cpp.
|
overridevirtual |
Calls update write on all busses.
Reimplemented from rokubimini::RokubiminiBusManager.
Definition at line 199 of file RokubiminiEthercatBusManager.cpp.
|
protected |
Map with all the Ethercat buses available.
Definition at line 230 of file RokubiminiEthercatBusManager.hpp.
|
protected |
Mutex prohibiting simultaneous access to EtherCAT bus manager.
Definition at line 223 of file RokubiminiEthercatBusManager.hpp.