ros2_control - galactic
|
Public Member Functions | |
ResourceManager () | |
Default constructor for the Resource Manager. | |
ResourceManager (const std::string &urdf, bool validate_interfaces=true) | |
Constructor for the Resource Manager. More... | |
ResourceManager (const ResourceManager &)=delete | |
void | load_urdf (const std::string &urdf, bool validate_interfaces=true) |
Load resources from on a given URDF. More... | |
LoanedStateInterface | claim_state_interface (const std::string &key) |
Claim a state interface given its key. More... | |
std::vector< std::string > | state_interface_keys () const |
Returns all registered state interfaces keys. More... | |
bool | state_interface_exists (const std::string &key) const |
Checks whether a state interface is registered under the given key. More... | |
bool | command_interface_is_claimed (const std::string &key) const |
Checks whether a command interface is already claimed. More... | |
LoanedCommandInterface | claim_command_interface (const std::string &key) |
Claim a command interface given its key. More... | |
std::vector< std::string > | command_interface_keys () const |
Returns all registered command interfaces keys. More... | |
bool | command_interface_exists (const std::string &key) const |
Checks whether a command interface is registered under the given key. More... | |
size_t | actuator_components_size () const |
Return the number size_t of loaded actuator components. More... | |
void | import_component (std::unique_ptr< ActuatorInterface > actuator) |
Import a hardware component which is not listed in the URDF. More... | |
size_t | sensor_components_size () const |
Return the number of loaded sensor components. More... | |
void | import_component (std::unique_ptr< SensorInterface > sensor) |
Import a hardware component which is not listed in the URDF. More... | |
size_t | system_components_size () const |
Return the number of loaded system components. More... | |
void | import_component (std::unique_ptr< SystemInterface > system) |
Import a hardware component which is not listed in the URDF. More... | |
void | import_component (std::unique_ptr< ActuatorInterface > actuator, const HardwareInfo &hardware_info) |
Import a hardware component which is not listed in the URDF. More... | |
void | import_component (std::unique_ptr< SensorInterface > sensor, const HardwareInfo &hardware_info) |
Import a hardware component which is not listed in the URDF. More... | |
void | import_component (std::unique_ptr< SystemInterface > system, const HardwareInfo &hardware_info) |
Import a hardware component which is not listed in the URDF. More... | |
std::unordered_map< std::string, rclcpp_lifecycle::State > | get_components_states () |
Return status for all components. More... | |
bool | prepare_command_mode_switch (const std::vector< std::string > &start_interfaces, const std::vector< std::string > &stop_interfaces) |
Prepare the hardware components for a new command interface mode. More... | |
bool | perform_command_mode_switch (const std::vector< std::string > &start_interfaces, const std::vector< std::string > &stop_interfaces) |
Notify the hardware components that realtime hardware mode switching should occur. More... | |
void | start_components () |
Start all loaded hardware components. | |
void | stop_components () |
Stops all loaded hardware components. | |
void | read () |
Reads all loaded hardware components. | |
void | write () |
Write all loaded hardware components. | |
|
explicit |
Constructor for the Resource Manager.
The implementation loads the specified urdf and initializes the hardware components listed within as well as populate their respective state and command interfaces.
If the interfaces ought to be validated, the constructor throws an exception in case the URDF lists interfaces which are not available.
[in] | urdf | string containing the URDF. |
[in] | validate_interfaces | boolean argument indicating whether the exported interfaces ought to be validated. Defaults to true. |
size_t hardware_interface::ResourceManager::actuator_components_size | ( | ) | const |
Return the number size_t of loaded actuator components.
LoanedCommandInterface hardware_interface::ResourceManager::claim_command_interface | ( | const std::string & | key | ) |
Claim a command interface given its key.
The resource is claimed as long as being in scope. Once the resource is going out of scope, the destructor returns and thus frees the resource to claimed by others.
[in] | key | String identifier which command interface to claim |
LoanedStateInterface hardware_interface::ResourceManager::claim_state_interface | ( | const std::string & | key | ) |
Claim a state interface given its key.
The resource is claimed as long as being in scope. Once the resource is going out of scope, the destructor returns.
[in] | key | String identifier which state interface to claim |
bool hardware_interface::ResourceManager::command_interface_exists | ( | const std::string & | key | ) | const |
Checks whether a command interface is registered under the given key.
[in] | key | string identifying the interface to check. |
bool hardware_interface::ResourceManager::command_interface_is_claimed | ( | const std::string & | key | ) | const |
Checks whether a command interface is already claimed.
Any command interface can only be claimed by a single instance.
[in] | key | string identifying the interface to check. |
std::vector< std::string > hardware_interface::ResourceManager::command_interface_keys | ( | ) | const |
Returns all registered command interfaces keys.
The keys are collected from each loaded hardware component.
std::unordered_map< std::string, rclcpp_lifecycle::State > hardware_interface::ResourceManager::get_components_states | ( | ) |
Return status for all components.
void hardware_interface::ResourceManager::import_component | ( | std::unique_ptr< ActuatorInterface > | actuator | ) |
Import a hardware component which is not listed in the URDF.
Components which are initialized outside a URDF can be added post initialization.
[in] | actuator | pointer to the actuator interface. |
void hardware_interface::ResourceManager::import_component | ( | std::unique_ptr< ActuatorInterface > | actuator, |
const HardwareInfo & | hardware_info | ||
) |
Import a hardware component which is not listed in the URDF.
Components which are initialized outside a URDF can be added post initialization. Nevertheless, there should still be HardwareInfo
available for this component, either parsed from a URDF string (easiest) or filled manually.
[in] | actuator | pointer to the actuator interface. |
[in] |
void hardware_interface::ResourceManager::import_component | ( | std::unique_ptr< SensorInterface > | sensor | ) |
Import a hardware component which is not listed in the URDF.
Components which are initialized outside a URDF can be added post initialization.
[in] | sensor | pointer to the sensor interface. |
void hardware_interface::ResourceManager::import_component | ( | std::unique_ptr< SensorInterface > | sensor, |
const HardwareInfo & | hardware_info | ||
) |
Import a hardware component which is not listed in the URDF.
Components which are initialized outside a URDF can be added post initialization. Nevertheless, there should still be HardwareInfo
available for this component, either parsed from a URDF string (easiest) or filled manually.
[in] | sensor | pointer to the sensor interface. |
[in] | hardware_info | hardware info |
void hardware_interface::ResourceManager::import_component | ( | std::unique_ptr< SystemInterface > | system | ) |
Import a hardware component which is not listed in the URDF.
Components which are initialized outside a URDF can be added post initialization.
[in] | system | pointer to the system interface. |
void hardware_interface::ResourceManager::import_component | ( | std::unique_ptr< SystemInterface > | system, |
const HardwareInfo & | hardware_info | ||
) |
Import a hardware component which is not listed in the URDF.
Components which are initialized outside a URDF can be added post initialization. Nevertheless, there should still be HardwareInfo
available for this component, either parsed from a URDF string (easiest) or filled manually.
[in] | system | pointer to the system interface. |
[in] | hardware_info | hardware info |
void hardware_interface::ResourceManager::load_urdf | ( | const std::string & | urdf, |
bool | validate_interfaces = true |
||
) |
Load resources from on a given URDF.
The resource manager can be post initialized with a given URDF. This is mainly used in conjunction with the default constructor in which the URDF might not be present at first initialization.
[in] | urdf | string containing the URDF. |
[in] | validate_interfaces | boolean argument indicating whether the exported interfaces ought to be validated. Defaults to true. |
bool hardware_interface::ResourceManager::perform_command_mode_switch | ( | const std::vector< std::string > & | start_interfaces, |
const std::vector< std::string > & | stop_interfaces | ||
) |
Notify the hardware components that realtime hardware mode switching should occur.
Hardware components are asked to perform the command interface mode switching.
[in] | start_interfaces | vector of string identifiers for the command interfaces starting. |
[in] | stop_interfaces | vector of string identifiers for the command interfacs stopping. |
bool hardware_interface::ResourceManager::prepare_command_mode_switch | ( | const std::vector< std::string > & | start_interfaces, |
const std::vector< std::string > & | stop_interfaces | ||
) |
Prepare the hardware components for a new command interface mode.
Hardware components are asked to prepare a new command interface claim.
[in] | start_interfaces | vector of string identifiers for the command interfaces starting. |
[in] | stop_interfaces | vector of string identifiers for the command interfaces stopping. |
size_t hardware_interface::ResourceManager::sensor_components_size | ( | ) | const |
Return the number of loaded sensor components.
bool hardware_interface::ResourceManager::state_interface_exists | ( | const std::string & | key | ) | const |
Checks whether a state interface is registered under the given key.
std::vector< std::string > hardware_interface::ResourceManager::state_interface_keys | ( | ) | const |
Returns all registered state interfaces keys.
The keys are collected from each loaded hardware component.
size_t hardware_interface::ResourceManager::system_components_size | ( | ) | const |
Return the number of loaded system components.