15 #ifndef HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_
16 #define HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_
22 #include "hardware_interface/handle.hpp"
23 #include "hardware_interface/hardware_info.hpp"
24 #include "hardware_interface/types/hardware_interface_return_values.hpp"
25 #include "hardware_interface/types/lifecycle_state_names.hpp"
26 #include "lifecycle_msgs/msg/state.hpp"
27 #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
28 #include "rclcpp_lifecycle/state.hpp"
30 using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
66 class SensorInterface :
public rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface
70 : lifecycle_state_(rclcpp_lifecycle::State(
71 lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN, lifecycle_state_names::UNKNOWN))
94 info_ = hardware_info;
95 return CallbackReturn::SUCCESS;
117 virtual return_type
read() = 0;
129 const rclcpp_lifecycle::State &
get_state()
const {
return lifecycle_state_; }
135 void set_state(
const rclcpp_lifecycle::State & new_state) { lifecycle_state_ = new_state; }
139 rclcpp_lifecycle::State lifecycle_state_;
Virtual Class to implement when integrating a stand-alone sensor into ros2_control.
Definition: sensor_interface.hpp:67
void set_state(const rclcpp_lifecycle::State &new_state)
Set life-cycle state of the actuator hardware.
Definition: sensor_interface.hpp:135
virtual return_type read()=0
Read the current state values from the actuator.
virtual std::vector< StateInterface > export_state_interfaces()=0
Exports all state interfaces for this hardware interface.
SensorInterface(const SensorInterface &other)=delete
SensorInterface copy constructor is actively deleted.
const rclcpp_lifecycle::State & get_state() const
Get life-cycle state of the actuator hardware.
Definition: sensor_interface.hpp:129
virtual CallbackReturn on_init(const HardwareInfo &hardware_info)
Initialization of the hardware interface from data parsed from the robot's URDF.
Definition: sensor_interface.hpp:92
virtual std::string get_name() const
Get name of the actuator hardware.
Definition: sensor_interface.hpp:123
Definition: actuator.hpp:29
This structure stores information about hardware defined in a robot's URDF.
Definition: hardware_info.hpp:101
std::string name
Name of the hardware.
Definition: hardware_info.hpp:103