15#ifndef HARDWARE_INTERFACE__HARDWARE_COMPONENT_INTERFACE_HPP_
16#define HARDWARE_INTERFACE__HARDWARE_COMPONENT_INTERFACE_HPP_
18#include <fmt/compile.h>
23#include <unordered_map>
27#include "control_msgs/msg/hardware_status.hpp"
28#include "hardware_interface/component_parser.hpp"
29#include "hardware_interface/handle.hpp"
30#include "hardware_interface/hardware_info.hpp"
31#include "hardware_interface/introspection.hpp"
32#include "hardware_interface/types/hardware_component_interface_params.hpp"
33#include "hardware_interface/types/hardware_component_params.hpp"
34#include "hardware_interface/types/hardware_interface_return_values.hpp"
35#include "hardware_interface/types/hardware_interface_type_values.hpp"
36#include "hardware_interface/types/lifecycle_state_names.hpp"
37#include "hardware_interface/types/trigger_type.hpp"
38#include "lifecycle_msgs/msg/state.hpp"
39#include "rclcpp/duration.hpp"
40#include "rclcpp/logger.hpp"
41#include "rclcpp/logging.hpp"
42#include "rclcpp/node_interfaces/node_clock_interface.hpp"
43#include "rclcpp/time.hpp"
44#include "rclcpp/version.h"
45#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
46#include "rclcpp_lifecycle/state.hpp"
47#include "realtime_tools/async_function_handler.hpp"
48#include "realtime_tools/realtime_publisher.hpp"
49#include "realtime_tools/realtime_thread_safe_box.hpp"
54static inline rclcpp::NodeOptions get_hardware_component_node_options()
56 rclcpp::NodeOptions node_options;
58#if RCLCPP_VERSION_MAJOR >= 21
59 node_options.enable_logger_service(
true);
64using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
79 rclcpp_lifecycle::State(
80 lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN, lifecycle_state_names::UNKNOWN)),
81 logger_(rclcpp::get_logger(
"hardware_component_interface"))
110 clock_ = params.
clock;
117 async_thread_params.scheduling_policy =
120 async_thread_params.clock = params.
clock;
125 get_logger(),
"Starting async handler with scheduler priority: %d and policy : %s",
127 async_thread_params.scheduling_policy.to_string().c_str());
128 async_handler_ = std::make_unique<realtime_tools::AsyncFunctionHandler<return_type>>();
129 const bool is_sensor_type = (info_.
type ==
"sensor");
130 async_handler_->init(
131 [
this, is_sensor_type](
const rclcpp::Time & time,
const rclcpp::Duration & period)
133 const auto read_start_time = std::chrono::steady_clock::now();
134 const auto ret_read =
read(time, period);
135 const auto read_end_time = std::chrono::steady_clock::now();
136 read_return_info_.store(ret_read, std::memory_order_release);
137 read_execution_time_.store(
138 std::chrono::duration_cast<std::chrono::nanoseconds>(read_end_time - read_start_time),
139 std::memory_order_release);
140 if (ret_read != return_type::OK)
145 !is_sensor_type && lifecycle_id_cache_.load(std::memory_order_acquire) ==
146 lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
148 const auto write_start_time = std::chrono::steady_clock::now();
149 const auto ret_write =
write(time, period);
150 const auto write_end_time = std::chrono::steady_clock::now();
151 write_return_info_.store(ret_write, std::memory_order_release);
152 write_execution_time_.store(
153 std::chrono::duration_cast<std::chrono::nanoseconds>(
154 write_end_time - write_start_time),
155 std::memory_order_release);
158 return return_type::OK;
160 async_thread_params);
161 async_handler_->start_thread();
164 if (
auto locked_executor = params.
executor.lock())
167 std::replace(node_name.begin(), node_name.end(),
'/',
'_');
168 hardware_component_node_ = std::make_shared<rclcpp::Node>(
169 node_name, params.
node_namespace, get_hardware_component_node_options());
170 locked_executor->add_node(hardware_component_node_->get_node_base_interface());
176 "Executor is not available during hardware component initialization for '%s'. Skipping "
181 double publish_rate = 0.0;
189 catch (
const std::invalid_argument &)
192 get_logger(),
"Invalid 'status_publish_rate' parameter. Using default %.1f Hz.",
197 if (publish_rate == 0.0)
201 "`status_publish_rate` is set to 0.0, hardware status publisher will not be created.");
205 control_msgs::msg::HardwareStatus status_msg_template;
208 RCLCPP_ERROR(
get_logger(),
"User-defined 'init_hardware_status_message' failed.");
209 return CallbackReturn::ERROR;
212 if (!status_msg_template.hardware_device_states.empty())
214 if (!hardware_component_node_)
218 "Hardware status message was configured, but no node is available for the publisher. "
219 "Publisher will not be created.");
225 hardware_status_publisher_ =
226 hardware_component_node_->create_publisher<control_msgs::msg::HardwareStatus>(
227 "~/hardware_status", rclcpp::SystemDefaultsQoS());
229 hardware_status_timer_ = hardware_component_node_->create_wall_timer(
230 std::chrono::duration<double>(1.0 / publish_rate),
233 std::optional<control_msgs::msg::HardwareStatus> msg_to_publish_opt;
234 hardware_status_box_.
get(msg_to_publish_opt);
236 if (msg_to_publish_opt.has_value() && hardware_status_publisher_)
238 control_msgs::msg::HardwareStatus & msg = msg_to_publish_opt.value();
241 RCLCPP_WARN_THROTTLE(
243 "User's update_hardware_status_message() failed for '%s'.",
247 msg.header.stamp = this->
get_clock()->now();
248 hardware_status_publisher_->publish(msg);
251 hardware_status_box_.
set(std::make_optional(status_msg_template));
253 catch (
const std::exception & e)
256 get_logger(),
"Exception during publisher/timer setup for hardware status: %s",
258 return CallbackReturn::ERROR;
266 "`status_publish_rate` was set to a non-zero value, but no hardware status message was "
267 "configured. Publisher will not be created. Are you sure "
268 "init_hardware_status_message() is set up properly?");
275 return on_init(interface_params);
289 control_msgs::msg::HardwareStatus & )
292 return CallbackReturn::SUCCESS;
307 return return_type::OK;
324 if (info_.
type ==
"actuator")
329 else if (info_.
type ==
"sensor")
334 else if (info_.
type ==
"system")
342 return CallbackReturn::SUCCESS;
358 "Replaced by vector<StateInterface::ConstSharedPtr> on_export_state_interfaces() method. "
359 "Exporting is handled by the Framework.")]]
virtual std::vector<StateInterface>
374 virtual std::vector<hardware_interface::InterfaceDescription>
391 std::vector<hardware_interface::InterfaceDescription> unlisted_interface_descriptions =
394 std::vector<StateInterface::ConstSharedPtr> state_interfaces;
395 state_interfaces.reserve(
396 unlisted_interface_descriptions.size() + joint_state_interfaces_.size() +
397 sensor_state_interfaces_.size() + gpio_state_interfaces_.size());
401 for (
const auto & description : unlisted_interface_descriptions)
403 auto name = description.get_name();
404 unlisted_state_interfaces_.insert(std::make_pair(name, description));
405 auto state_interface = std::make_shared<StateInterface>(description);
406 hardware_states_.insert(std::make_pair(name, state_interface));
407 unlisted_states_.push_back(state_interface);
408 state_interfaces.push_back(std::const_pointer_cast<const StateInterface>(state_interface));
411 for (
const auto & [name, descr] : joint_state_interfaces_)
413 auto state_interface = std::make_shared<StateInterface>(descr);
414 hardware_states_.insert(std::make_pair(name, state_interface));
415 joint_states_.push_back(state_interface);
416 state_interfaces.push_back(std::const_pointer_cast<const StateInterface>(state_interface));
418 for (
const auto & [name, descr] : sensor_state_interfaces_)
420 auto state_interface = std::make_shared<StateInterface>(descr);
421 hardware_states_.insert(std::make_pair(name, state_interface));
422 sensor_states_.push_back(state_interface);
423 state_interfaces.push_back(std::const_pointer_cast<const StateInterface>(state_interface));
425 for (
const auto & [name, descr] : gpio_state_interfaces_)
427 auto state_interface = std::make_shared<StateInterface>(descr);
428 hardware_states_.insert(std::make_pair(name, state_interface));
429 gpio_states_.push_back(state_interface);
430 state_interfaces.push_back(std::const_pointer_cast<const StateInterface>(state_interface));
432 return state_interfaces;
448 "Replaced by vector<CommandInterface::SharedPtr> on_export_command_interfaces() method. "
449 "Exporting is handled by the Framework.")]]
virtual std::vector<CommandInterface>
464 virtual std::vector<hardware_interface::InterfaceDescription>
484 std::vector<hardware_interface::InterfaceDescription> unlisted_interface_descriptions =
487 std::vector<CommandInterface::SharedPtr> command_interfaces;
488 command_interfaces.reserve(
489 unlisted_interface_descriptions.size() + joint_command_interfaces_.size() +
490 gpio_command_interfaces_.size());
494 for (
const auto & description : unlisted_interface_descriptions)
496 auto name = description.get_name();
497 unlisted_command_interfaces_.insert(std::make_pair(name, description));
498 auto command_interface = std::make_shared<CommandInterface>(description);
499 hardware_commands_.insert(std::make_pair(name, command_interface));
500 unlisted_commands_.push_back(command_interface);
501 command_interfaces.push_back(command_interface);
504 for (
const auto & [name, descr] : joint_command_interfaces_)
506 auto command_interface = std::make_shared<CommandInterface>(descr);
507 hardware_commands_.insert(std::make_pair(name, command_interface));
508 joint_commands_.push_back(command_interface);
509 command_interfaces.push_back(command_interface);
512 for (
const auto & [name, descr] : gpio_command_interfaces_)
514 auto command_interface = std::make_shared<CommandInterface>(descr);
515 hardware_commands_.insert(std::make_pair(name, command_interface));
516 gpio_commands_.push_back(command_interface);
517 command_interfaces.push_back(command_interface);
519 return command_interfaces;
534 const std::vector<std::string> & ,
535 const std::vector<std::string> & )
537 return return_type::OK;
551 const std::vector<std::string> & ,
552 const std::vector<std::string> & )
554 return return_type::OK;
569 const rclcpp::Time & time,
const rclcpp::Duration & period)
572 status.result = return_type::ERROR;
575 status.result = read_return_info_.load(std::memory_order_acquire);
576 const auto read_exec_time = read_execution_time_.load(std::memory_order_acquire);
577 if (read_exec_time.count() > 0)
579 status.execution_time = read_exec_time;
581 const auto result = async_handler_->trigger_async_callback(time, period);
582 status.successful = result.first;
583 if (!status.successful)
585 RCLCPP_WARN_EXPRESSION(
587 "Trigger read/write called while the previous async trigger is still in progress for "
588 "hardware interface : '%s'. Failed to trigger read/write cycle!",
590 status.result = return_type::OK;
596 const auto start_time = std::chrono::steady_clock::now();
597 status.successful =
true;
598 status.result =
read(time, period);
599 status.execution_time = std::chrono::duration_cast<std::chrono::nanoseconds>(
600 std::chrono::steady_clock::now() - start_time);
615 virtual return_type
read(
const rclcpp::Time & time,
const rclcpp::Duration & period) = 0;
628 const rclcpp::Time & time,
const rclcpp::Duration & period)
631 status.result = return_type::ERROR;
634 status.successful =
true;
635 const auto write_exec_time = write_execution_time_.load(std::memory_order_acquire);
636 if (write_exec_time.count() > 0)
638 status.execution_time = write_exec_time;
640 status.result = write_return_info_.load(std::memory_order_acquire);
644 const auto start_time = std::chrono::steady_clock::now();
645 status.successful =
true;
646 status.result =
write(time, period);
647 status.execution_time = std::chrono::duration_cast<std::chrono::nanoseconds>(
648 std::chrono::steady_clock::now() - start_time);
662 virtual return_type
write(
const rclcpp::Time & ,
const rclcpp::Duration & )
664 return return_type::OK;
697 lifecycle_state_ = new_state;
698 lifecycle_id_cache_.store(new_state.id(), std::memory_order_release);
701 uint8_t get_lifecycle_id()
const {
return lifecycle_id_cache_.load(std::memory_order_acquire); }
708 bool has_state(
const std::string & interface_name)
const
710 return hardware_states_.find(interface_name) != hardware_states_.end();
721 const std::string & interface_name)
const
723 auto it = hardware_states_.find(interface_name);
724 if (it == hardware_states_.end())
726 throw std::runtime_error(
728 "The requested state interface not found: '{}' in hardware component: '{}'.",
729 interface_name, info_.
name));
745 template <
typename T>
747 const StateInterface::SharedPtr & interface_handle,
const T & value,
bool wait_until_set)
749 if (!interface_handle)
751 throw std::runtime_error(
753 "State interface handle is null in hardware component: {}, while calling set_state "
754 "method. This should not happen.",
757 return interface_handle->set_value(value, wait_until_set);
769 template <
typename T>
770 void set_state(
const std::string & interface_name,
const T & value)
785 template <
typename T>
787 const StateInterface::SharedPtr & interface_handle, T & state,
bool wait_until_get)
const
789 if (!interface_handle)
791 throw std::runtime_error(
793 "State interface handle is null in hardware component: {}, while calling get_state "
794 "method. This should not happen.",
797 const bool success = interface_handle->get_value(state, wait_until_get);
798 if (!success && wait_until_get)
800 throw std::runtime_error(
802 "Failed to get state value from interface: {} in hardware component: {}. This should "
804 interface_handle->get_name(), info_.
name));
818 template <
typename T =
double>
833 return hardware_commands_.find(interface_name) != hardware_commands_.end();
844 const std::string & interface_name)
const
846 auto it = hardware_commands_.find(interface_name);
847 if (it == hardware_commands_.end())
849 throw std::runtime_error(
851 "The requested command interface not found: '{}' in hardware component: '{}'.",
852 interface_name, info_.
name));
867 template <
typename T>
869 const CommandInterface::SharedPtr & interface_handle,
const T & value,
bool wait_until_set)
871 if (!interface_handle)
873 throw std::runtime_error(
875 "Command interface handle is null in hardware component: {}, while calling set_command "
876 "method. This should not happen.",
879 return interface_handle->set_value(value, wait_until_set);
891 template <
typename T>
892 void set_command(
const std::string & interface_name,
const T & value)
907 template <
typename T>
909 const CommandInterface::SharedPtr & interface_handle, T & command,
bool wait_until_get)
const
911 if (!interface_handle)
913 throw std::runtime_error(
915 "Command interface handle is null in hardware component: {}, while calling get_command "
916 "method. This should not happen.",
919 const bool success = interface_handle->get_value(command, wait_until_get);
920 if (!success && wait_until_get)
922 throw std::runtime_error(
924 "Failed to get command value from interface: {} in hardware component: {}. This should "
926 interface_handle->get_name(), info_.
name));
940 template <
typename T =
double>
958 rclcpp::Clock::SharedPtr
get_clock()
const {
return clock_; }
964 rclcpp::Node::SharedPtr
get_node()
const {
return hardware_component_node_; }
981 async_handler_->pause_execution();
991 read_return_info_.store(return_type::OK, std::memory_order_release);
992 read_execution_time_.store(std::chrono::nanoseconds::zero(), std::memory_order_release);
993 write_return_info_.store(return_type::OK, std::memory_order_release);
994 write_execution_time_.store(std::chrono::nanoseconds::zero(), std::memory_order_release);
1005 stats_registrations_.enableAll();
1009 stats_registrations_.disableAll();
1016 std::unordered_map<std::string, InterfaceDescription> joint_state_interfaces_;
1017 std::unordered_map<std::string, InterfaceDescription> joint_command_interfaces_;
1019 std::unordered_map<std::string, InterfaceDescription> sensor_state_interfaces_;
1021 std::unordered_map<std::string, InterfaceDescription> gpio_state_interfaces_;
1022 std::unordered_map<std::string, InterfaceDescription> gpio_command_interfaces_;
1024 std::unordered_map<std::string, InterfaceDescription> unlisted_state_interfaces_;
1025 std::unordered_map<std::string, InterfaceDescription> unlisted_command_interfaces_;
1027 rclcpp_lifecycle::State lifecycle_state_;
1028 std::atomic<uint8_t> lifecycle_id_cache_ = lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN;
1029 std::unique_ptr<realtime_tools::AsyncFunctionHandler<return_type>> async_handler_;
1032 std::vector<StateInterface::SharedPtr> joint_states_;
1033 std::vector<CommandInterface::SharedPtr> joint_commands_;
1035 std::vector<StateInterface::SharedPtr> sensor_states_;
1037 std::vector<StateInterface::SharedPtr> gpio_states_;
1038 std::vector<CommandInterface::SharedPtr> gpio_commands_;
1040 std::vector<StateInterface::SharedPtr> unlisted_states_;
1041 std::vector<CommandInterface::SharedPtr> unlisted_commands_;
1044 rclcpp::Clock::SharedPtr clock_;
1045 rclcpp::Logger logger_;
1046 rclcpp::Node::SharedPtr hardware_component_node_ =
nullptr;
1048 std::unordered_map<std::string, StateInterface::SharedPtr> hardware_states_;
1049 std::unordered_map<std::string, CommandInterface::SharedPtr> hardware_commands_;
1050 std::atomic<return_type> read_return_info_ = return_type::OK;
1051 std::atomic<std::chrono::nanoseconds> read_execution_time_ = std::chrono::nanoseconds::zero();
1052 std::atomic<return_type> write_return_info_ = return_type::OK;
1053 std::atomic<std::chrono::nanoseconds> write_execution_time_ = std::chrono::nanoseconds::zero();
1056 pal_statistics::RegistrationsRAII stats_registrations_;
1057 std::shared_ptr<rclcpp::Publisher<control_msgs::msg::HardwareStatus>> hardware_status_publisher_;
1059 hardware_status_box_;
1060 rclcpp::TimerBase::SharedPtr hardware_status_timer_;
Virtual base class for all hardware components (Actuators, Sensors, and Systems).
Definition hardware_component_interface.hpp:75
const std::string & get_name() const
Get name of the hardware.
Definition hardware_component_interface.hpp:671
void prepare_for_activation()
Prepare for the activation of the hardware.
Definition hardware_component_interface.hpp:989
T get_state(const std::string &interface_name) const
Get the value from a state interface.
Definition hardware_component_interface.hpp:819
bool get_state(const StateInterface::SharedPtr &interface_handle, T &state, bool wait_until_get) const
Definition hardware_component_interface.hpp:786
virtual std::vector< StateInterface > export_state_interfaces()
Exports all state interfaces for this hardware interface.
Definition hardware_component_interface.hpp:360
const rclcpp_lifecycle::State & get_lifecycle_state() const
Get life-cycle state of the hardware.
Definition hardware_component_interface.hpp:686
virtual return_type read(const rclcpp::Time &time, const rclcpp::Duration &period)=0
Read the current state values from the hardware.
virtual return_type write(const rclcpp::Time &, const rclcpp::Duration &)
Write the current command values to the hardware.
Definition hardware_component_interface.hpp:662
virtual std::vector< StateInterface::ConstSharedPtr > on_export_state_interfaces()
Definition hardware_component_interface.hpp:388
virtual std::vector< hardware_interface::InterfaceDescription > export_unlisted_command_interface_descriptions()
Definition hardware_component_interface.hpp:465
bool set_command(const CommandInterface::SharedPtr &interface_handle, const T &value, bool wait_until_set)
Set the value of a command interface.
Definition hardware_component_interface.hpp:868
virtual std::vector< hardware_interface::InterfaceDescription > export_unlisted_state_interface_descriptions()
Definition hardware_component_interface.hpp:375
void set_state(const std::string &interface_name, const T &value)
Set the value of a state interface.
Definition hardware_component_interface.hpp:770
HardwareComponentCycleStatus trigger_read(const rclcpp::Time &time, const rclcpp::Duration &period)
Triggers the read method synchronously or asynchronously depending on the HardwareInfo.
Definition hardware_component_interface.hpp:568
void set_lifecycle_state(const rclcpp_lifecycle::State &new_state)
Set life-cycle state of the hardware.
Definition hardware_component_interface.hpp:695
virtual return_type perform_command_mode_switch(const std::vector< std::string > &, const std::vector< std::string > &)
Definition hardware_component_interface.hpp:550
bool has_command(const std::string &interface_name) const
Does the command interface exist?
Definition hardware_component_interface.hpp:831
void pause_async_operations()
Pause any asynchronous operations.
Definition hardware_component_interface.hpp:977
const std::string & get_group_name() const
Get name of the hardware group to which it belongs to.
Definition hardware_component_interface.hpp:677
HardwareComponentCycleStatus trigger_write(const rclcpp::Time &time, const rclcpp::Duration &period)
Triggers the write method synchronously or asynchronously depending on the HardwareInfo.
Definition hardware_component_interface.hpp:627
bool get_command(const CommandInterface::SharedPtr &interface_handle, T &command, bool wait_until_get) const
Definition hardware_component_interface.hpp:908
const StateInterface::SharedPtr & get_state_interface_handle(const std::string &interface_name) const
Get the state interface handle.
Definition hardware_component_interface.hpp:720
virtual return_type update_hardware_status_message(control_msgs::msg::HardwareStatus &)
User-overridable method to fill the hardware status message with real-time data.
Definition hardware_component_interface.hpp:304
HardwareComponentInterface(const HardwareComponentInterface &other)=delete
HardwareComponentInterface copy constructor is actively deleted.
bool set_state(const StateInterface::SharedPtr &interface_handle, const T &value, bool wait_until_set)
Set the value of a state interface.
Definition hardware_component_interface.hpp:746
void set_command(const std::string &interface_name, const T &value)
Set the value of a command interface.
Definition hardware_component_interface.hpp:892
rclcpp::Node::SharedPtr get_node() const
Get the default node of the HardwareComponentInterface.
Definition hardware_component_interface.hpp:964
virtual return_type prepare_command_mode_switch(const std::vector< std::string > &, const std::vector< std::string > &)
Prepare for a new command interface switch.
Definition hardware_component_interface.hpp:533
CallbackReturn init(const hardware_interface::HardwareComponentParams ¶ms)
Definition hardware_component_interface.hpp:108
void enable_introspection(bool enable)
Enable or disable introspection of the hardware.
Definition hardware_component_interface.hpp:1001
const CommandInterface::SharedPtr & get_command_interface_handle(const std::string &interface_name) const
Get the command interface handle.
Definition hardware_component_interface.hpp:843
rclcpp::Logger get_logger() const
Get the logger of the HardwareComponentInterface.
Definition hardware_component_interface.hpp:952
T get_command(const std::string &interface_name) const
Get the value from a command interface.
Definition hardware_component_interface.hpp:941
virtual std::vector< CommandInterface > export_command_interfaces()
Exports all command interfaces for this hardware interface.
Definition hardware_component_interface.hpp:450
virtual std::vector< CommandInterface::SharedPtr > on_export_command_interfaces()
Definition hardware_component_interface.hpp:481
rclcpp::Clock::SharedPtr get_clock() const
Get the clock.
Definition hardware_component_interface.hpp:958
const HardwareInfo & get_hardware_info() const
Get the hardware info of the HardwareComponentInterface.
Definition hardware_component_interface.hpp:970
virtual CallbackReturn on_init(const hardware_interface::HardwareComponentInterfaceParams ¶ms)
Initialization of the hardware interface from data parsed from the robot's URDF.
Definition hardware_component_interface.hpp:320
virtual CallbackReturn init_hardware_status_message(control_msgs::msg::HardwareStatus &)
User-overridable method to configure the structure of the HardwareStatus message.
Definition hardware_component_interface.hpp:288
bool has_state(const std::string &interface_name) const
Does the state interface exist?
Definition hardware_component_interface.hpp:708
Definition actuator.hpp:22
std::vector< InterfaceDescription > parse_command_interface_descriptions(const std::vector< ComponentInfo > &component_info)
Definition component_parser.cpp:1136
std::vector< InterfaceDescription > parse_state_interface_descriptions(const std::vector< ComponentInfo > &component_info)
Definition component_parser.cpp:1103
std::string to_lower_case(const std::string &string)
Convert a string to lower case.
Definition lexical_casts.cpp:65
double stod(const std::string &s)
Helper function to convert a std::string to double in a locale-independent way.
Definition lexical_casts.cpp:56
bool print_warnings
Whether to print warnings when the async thread doesn't meet its deadline.
Definition hardware_info.hpp:285
std::string scheduling_policy
Scheduling policy for the async worker thread.
Definition hardware_info.hpp:281
int thread_priority
Thread priority for the async worker thread.
Definition hardware_info.hpp:279
std::vector< int > cpu_affinity_cores
CPU affinity cores for the async worker thread.
Definition hardware_info.hpp:283
Definition hardware_interface_return_values.hpp:41
Parameters required for the initialization of a specific hardware component plugin....
Definition hardware_component_interface_params.hpp:32
rclcpp::Executor::WeakPtr executor
Weak pointer to the rclcpp::Executor instance. Hardware components can use this (after locking) to ad...
Definition hardware_component_interface_params.hpp:46
hardware_interface::HardwareInfo hardware_info
Reference to the HardwareInfo struct for this specific component, parsed from the URDF....
Definition hardware_component_interface_params.hpp:39
Parameters required for the initialization of a specific hardware component plugin....
Definition hardware_component_params.hpp:33
rclcpp::Executor::WeakPtr executor
Weak pointer to the rclcpp::Executor instance. Hardware components can use this (after locking) to ad...
Definition hardware_component_params.hpp:64
std::string node_namespace
The namespace used by the hardware component's internal node. This is typically same as the controlle...
Definition hardware_component_params.hpp:57
rclcpp::Logger logger
A logger instance taken from resource manager.
Definition hardware_component_params.hpp:45
rclcpp::Clock::SharedPtr clock
Shared pointer to the rclcpp::Clock to be used by this hardware component. Typically,...
Definition hardware_component_params.hpp:51
hardware_interface::HardwareInfo hardware_info
Reference to the HardwareInfo struct for this specific component, parsed from the URDF....
Definition hardware_component_params.hpp:40
This structure stores information about hardware defined in a robot's URDF.
Definition hardware_info.hpp:297
std::string type
Type of the hardware: actuator, sensor or system.
Definition hardware_info.hpp:301
HardwareAsyncParams async_params
Async Parameters.
Definition hardware_info.hpp:311
std::unordered_map< std::string, std::string > hardware_parameters
(Optional) Key-value pairs for hardware parameters.
Definition hardware_info.hpp:315
std::string group
Hardware group to which the hardware belongs.
Definition hardware_info.hpp:303
bool is_async
Component is async.
Definition hardware_info.hpp:307
std::vector< ComponentInfo > gpios
Definition hardware_info.hpp:334
std::vector< ComponentInfo > joints
Definition hardware_info.hpp:320
std::string name
Name of the hardware.
Definition hardware_info.hpp:299
std::vector< ComponentInfo > sensors
Definition hardware_info.hpp:329
unsigned int rw_rate
Component's read and write rates in Hz.
Definition hardware_info.hpp:305