26#include <hardware_interface/system_interface.hpp>
27#include <hardware_interface/types/hardware_component_interface_params.hpp>
28#include <rclcpp/node.hpp>
29#include <rclcpp/publisher.hpp>
30#include <rclcpp/subscription.hpp>
31#include <realtime_tools/realtime_buffer.hpp>
33#include <control_msgs/msg/joint_command.hpp>
34#include <sensor_msgs/msg/joint_state.hpp>
36namespace joint_command_topic_hardware_interface
38using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
45 hardware_interface::return_type
read(
const rclcpp::Time& time,
const rclcpp::Duration& period)
override;
47 hardware_interface::return_type
write(
const rclcpp::Time& time,
const rclcpp::Duration& period)
override;
50 struct JointCommandGroup
52 std::string interface_name;
53 std::vector<std::string> joint_names;
54 std::vector<std::string> command_keys;
55 control_msgs::msg::JointCommand msg;
58 rclcpp::Subscription<sensor_msgs::msg::JointState>::SharedPtr topic_based_joint_states_subscriber_;
59 std::map<std::string, rclcpp::Publisher<control_msgs::msg::JointCommand>::SharedPtr>
60 topic_based_joint_command_publishers_;
61 std::map<std::string, JointCommandGroup> command_groups_;
63 bool sum_wrapped_joint_states_{
false };
65 double trigger_joint_command_threshold_ = 1e-5;
Virtual Class to implement when integrating a complex system into ros2_control.
Definition system_interface.hpp:67
Definition joint_command_topic_hardware_interface.hpp:41
hardware_interface::return_type read(const rclcpp::Time &time, const rclcpp::Duration &period) override
Read the current state values from the hardware.
Definition joint_command_topic_hardware_interface.cpp:110
hardware_interface::return_type write(const rclcpp::Time &time, const rclcpp::Duration &period) override
Write the current command values to the hardware.
Definition joint_command_topic_hardware_interface.cpp:183
CallbackReturn on_init(const hardware_interface::HardwareComponentInterfaceParams ¶ms) override
Initialization of the hardware interface from data parsed from the robot's URDF.
Definition joint_command_topic_hardware_interface.cpp:44
Parameters required for the initialization of a specific hardware component plugin....
Definition hardware_component_interface_params.hpp:32