ros2_control - jazzy
Loading...
Searching...
No Matches
hardware_interface Namespace Reference

Classes

class  ActuatorInterface
 Virtual Class to implement when integrating a 1 DoF actuator into ros2_control. More...
class  AsyncComponentThread
struct  ControllerInfo
 Controller Information. More...
class  Handle
 A handle used to get and set a value on a given interface. More...
class  StateInterface
class  CommandInterface
class  HardwareComponent
struct  HardwareComponentStatisticsData
struct  HardwareComponentInfo
 Hardware Component Information. More...
class  HardwareComponentInterface
 Virtual base class for all hardware components (Actuators, Sensors, and Systems). More...
struct  InterfaceInfo
struct  MimicJoint
 This structure stores information about a joint that is mimicking another joint. More...
struct  ComponentInfo
struct  JointInfo
 Contains semantic info about a given joint loaded from URDF for a transmission. More...
struct  ActuatorInfo
 Contains semantic info about a given actuator loaded from URDF for a transmission. More...
struct  TransmissionInfo
 Contains semantic info about a given transmission loaded from URDF. More...
class  HandleDataType
struct  InterfaceDescription
struct  HardwareAsyncParams
struct  HardwareInfo
 This structure stores information about hardware defined in a robot's URDF. More...
class  LoanedCommandInterface
class  LoanedStateInterface
struct  HardwareReadWriteStatus
class  ResourceManager
class  SensorInterface
 Virtual Class to implement when integrating a stand-alone sensor into ros2_control. More...
class  SystemInterface
 Virtual Class to implement when integrating a complex system into ros2_control. More...
struct  HardwareComponentInterfaceParams
 Parameters required for the initialization of a specific hardware component plugin. Typically used for on_init methods of hardware interfaces, and is parsed by the user. This struct is typically populated with data from HardwareComponentParams from each component. More...
struct  HardwareComponentParams
 Parameters required for the initialization of a specific hardware component plugin. Typically used for init, initialise and load methods of hardware components. This struct is typically not accessible to user. This struct is typically populated with data from ResourceManagerParams. More...
struct  HardwareComponentCycleStatus
struct  ResourceManagerParams
 Parameters required for the construction and initial setup of a ResourceManager. This struct is typically populated by the ControllerManager. More...
struct  HardwareComponentStatisticsCollector
 Data structure with two moving average statistics collectors. One for the execution time and the other for the periodicity. More...
class  ResourceStorage

Typedefs

using Actuator = HardwareComponent
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
using HANDLE_DATATYPE
using Sensor = HardwareComponent
using System = HardwareComponent

Enumerations

enum class  MimicAttribute { NOT_SET , TRUE , FALSE }
 This enum is used to store the mimic attribute of a joint.
enum class  return_type : std::uint8_t { OK = 0 , ERROR = 1 , DEACTIVATE = 2 }
enum class  TriggerType { READ , WRITE }

Functions

std::vector< HardwareInfo > parse_control_resources_from_urdf (const std::string &urdf)
 Search XML snippet from URDF for information about a control component.
std::vector< InterfaceDescription > parse_state_interface_descriptions (const std::vector< ComponentInfo > &component_info)
void parse_state_interface_descriptions (const std::vector< ComponentInfo > &component_info, std::unordered_map< std::string, InterfaceDescription > &state_interfaces_map)
std::vector< InterfaceDescription > parse_command_interface_descriptions (const std::vector< ComponentInfo > &component_info)
void parse_command_interface_descriptions (const std::vector< ComponentInfo > &component_info, std::unordered_map< std::string, InterfaceDescription > &command_interfaces_map)
double stod (const std::string &s)
 Helper function to convert a std::string to double in a locale-independent way.
float stof (const std::string &s)
 Helper function to convert a std::string to float in a locale-independent way.
template<typename T>
T stoi_generic (const std::string &s)
 Overflow-safe conversion from string to int32_t.
int8_t stoi8 (const std::string &s)
int16_t stoi16 (const std::string &s)
int32_t stoi32 (const std::string &s)
template<typename T>
T stoui_generic (const std::string &s)
 Overflow-safe conversion from string to uint32_t.
uint8_t stoui8 (const std::string &s)
uint16_t stoui16 (const std::string &s)
uint32_t stoui32 (const std::string &s)
std::string to_lower_case (const std::string &string)
 Convert a string to lower case.
bool parse_bool (const std::string &bool_string)
 Parse a boolean value from a string.
template<typename T>
std::vector< T > parse_array (const std::string &array_string)
std::vector< std::string > parse_string_array (const std::string &string_array_string)
constexpr bool lifecycleStateThatRequiresNoAction (const lifecycle_msgs::msg::State::_id_type state)
std::string interfaces_to_string (const std::vector< std::string > &start_interfaces, const std::vector< std::string > &stop_interfaces)
void get_hardware_related_interfaces (const std::vector< std::string > &hw_command_itfs, const std::vector< std::string > &start_stop_interfaces_list, std::vector< std::string > &hw_interfaces)

Variables

constexpr char HW_IF_TORQUE [] = "torque"
 Constant defining torque interface name.
constexpr char HW_IF_FORCE [] = "force"
 Constant defining force interface name.
constexpr char DEFAULT_REGISTRY_KEY [] = "ros2_control"
constexpr char DEFAULT_INTROSPECTION_TOPIC [] = "~/introspection_data"
constexpr char CM_STATISTICS_KEY [] = "cm_execution_statistics"
constexpr char CM_STATISTICS_TOPIC [] = "~/statistics"
constexpr char HW_IF_POSITION [] = "position"
 Constant defining position interface name.
constexpr char HW_IF_VELOCITY [] = "velocity"
 Constant defining velocity interface name.
constexpr char HW_IF_ACCELERATION [] = "acceleration"
 Constant defining acceleration interface name.
constexpr char HW_IF_EFFORT [] = "effort"
 Constant defining effort interface name.
constexpr char HW_IF_CURRENT [] = "current"
 Constant defining current interface name.
constexpr char HW_IF_TEMPERATURE [] = "temperature"
 Constant defining temperature interface name.
constexpr char HW_IF_PROPORTIONAL_GAIN [] = "proportional"
constexpr char HW_IF_INTEGRAL_GAIN [] = "integral"
 Constant defining integral gain interface name.
constexpr char HW_IF_DERIVATIVE_GAIN [] = "derivative"
 Constant defining derivative gain interface name.
constexpr char HW_IF_INTEGRAL_CLAMP_MAX [] = "integral_clamp_max"
 Constant defining integral clamp interface name.
constexpr char HW_IF_INTEGRAL_CLAMP_MIN [] = "integral_clamp_min"
 Constant defining integral clamp interface name.
constexpr char HW_IF_FEEDFORWARD [] = "feedforward"
 Constant defining the feedforward interface name.
auto trigger_and_print_hardware_state_transition

Detailed Description

Author
: Denis Stogl

Typedef Documentation

◆ HANDLE_DATATYPE

Initial value:
std::variant<
std::monostate, double, float, bool, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t>

Hardware handles supported types

Function Documentation

◆ parse_bool()

bool hardware_interface::parse_bool ( const std::string & bool_string)

Parse a boolean value from a string.

Parameters
bool_stringThe input string, can be "true", "false" (case insensitive)
Returns
The parsed boolean value.
Exceptions
std::invalid_argumentif the string is not a valid boolean representation.

◆ parse_command_interface_descriptions() [1/2]

std::vector< InterfaceDescription > hardware_interface::parse_command_interface_descriptions ( const std::vector< ComponentInfo > & component_info)
Parameters
[in]component_infoinformation about a component (gpio, joint, sensor)
Returns
vector filled with information about hardware's CommandInterfaces for the component which are exported

◆ parse_command_interface_descriptions() [2/2]

void hardware_interface::parse_command_interface_descriptions ( const std::vector< ComponentInfo > & component_info,
std::unordered_map< std::string, InterfaceDescription > & command_interfaces_map )
Parameters
[in]component_infoinformation about a component (gpio, joint, sensor)
[out]command_interfaces_mapunordered_map filled with information about hardware's CommandInterfaces for the component which are exported

◆ parse_control_resources_from_urdf()

std::vector< HardwareInfo > hardware_interface::parse_control_resources_from_urdf ( const std::string & urdf)

Search XML snippet from URDF for information about a control component.

Parameters
[in]urdfstring with robot's URDF
Returns
vector filled with information about robot's control resources
Exceptions
std::runtime_errorif a robot attribute or tag is not found

◆ parse_state_interface_descriptions() [1/2]

std::vector< InterfaceDescription > hardware_interface::parse_state_interface_descriptions ( const std::vector< ComponentInfo > & component_info)
Parameters
[in]component_infoinformation about a component (gpio, joint, sensor)
Returns
vector filled with information about hardware's StateInterfaces for the component which are exported

◆ parse_state_interface_descriptions() [2/2]

void hardware_interface::parse_state_interface_descriptions ( const std::vector< ComponentInfo > & component_info,
std::unordered_map< std::string, InterfaceDescription > & state_interfaces_map )
Parameters
[in]component_infoinformation about a component (gpio, joint, sensor)
[out]state_interfaces_mapunordered_map filled with information about hardware's StateInterfaces for the component which are exported

◆ stod()

double hardware_interface::stod ( const std::string & s)

Helper function to convert a std::string to double in a locale-independent way.

Exceptions
std::invalid_argumentif not a valid number or exceeds limits from https://github.com/ros-planning/srdfdom/blob/ad17b8d25812f752c397a6011cec64aeff090c46/src/model.cpp#L53

◆ stof()

float hardware_interface::stof ( const std::string & s)

Helper function to convert a std::string to float in a locale-independent way.

Exceptions
std::invalid_argumentif not a valid number or exceeds limits

◆ stoi_generic()

template<typename T>
T hardware_interface::stoi_generic ( const std::string & s)

Overflow-safe conversion from string to int32_t.

Exceptions
std::out_of_rangeif the converted value would fall out of the range of int32_t
std::invalid_argumentif no conversion could be performed

◆ stoui_generic()

template<typename T>
T hardware_interface::stoui_generic ( const std::string & s)

Overflow-safe conversion from string to uint32_t.

Exceptions
std::out_of_rangeif the converted value would fall out of the range of int32_t
std::invalid_argumentif no conversion could be performed

◆ to_lower_case()

std::string hardware_interface::to_lower_case ( const std::string & string)

Convert a string to lower case.

Parameters
stringThe input string.
Returns
The lower case version of the input string.

Variable Documentation

◆ HW_IF_PROPORTIONAL_GAIN

char hardware_interface::HW_IF_PROPORTIONAL_GAIN[] = "proportional"
constexpr

Gains interface constants Constant defining proportional gain interface name

◆ trigger_and_print_hardware_state_transition

auto hardware_interface::trigger_and_print_hardware_state_transition
Initial value:
=
[](
auto transition, const std::string transition_name, const std::string & hardware_name,
const lifecycle_msgs::msg::State::_id_type & target_state)
{
RCUTILS_LOG_INFO_NAMED(
"resource_manager", "'%s' hardware '%s' ", transition_name.c_str(), hardware_name.c_str());
const rclcpp_lifecycle::State new_state = transition();
bool result = new_state.id() == target_state;
if (result)
{
RCUTILS_LOG_INFO_NAMED(
"resource_manager", "Successful '%s' of hardware '%s'", transition_name.c_str(),
hardware_name.c_str());
}
else
{
RCUTILS_LOG_ERROR_NAMED(
"resource_manager", "Failed to '%s' hardware '%s'", transition_name.c_str(),
hardware_name.c_str());
}
return result;
}