6#ifndef YARP_DEV_GENERICSENSORS_NWC_ROS2_H
7#define YARP_DEV_GENERICSENSORS_NWC_ROS2_H
19#include <rclcpp/rclcpp.hpp>
41template <
class ROS_MSG>
69template <
class ROS_MSG>
73 m_subscription=
nullptr;
77template <
class ROS_MSG>
80template <
class ROS_MSG>
84 if (m_node_name.c_str()[0] ==
'/') {
89 if (m_topic_name.c_str()[0] !=
'/') {
94 m_sensor_name = config.
find(
"sensor_name").asString();
97 m_subscription = m_node->create_subscription<ROS_MSG>(m_topic_name, rclcpp::QoS(10),
99 this, std::placeholders::_1));
101 if (m_node ==
nullptr) {
106 if (m_subscription ==
nullptr) {
120template <
class ROS_MSG>
const yarp::os::LogComponent & GENERICSENSOR_NWC_ROS2()
This class is the parameters parser for class GenericSensor_nwc_ros2.
This abstract template needs to be specialized in a ROS2 subscription, for a specific ROS2 message/se...
bool open(yarp::os::Searchable ¶ms) override
Open the DeviceDriver.
yarp::dev::MAS_status m_internalStatus
rclcpp::Subscription< ROS_MSG >::SharedPtr m_subscription
virtual ~GenericSensor_nwc_ros2()
rclcpp::Node::SharedPtr m_node
const size_t m_sens_index
virtual void subscription_callback(const std::shared_ptr< ROS_MSG > msg)=0
bool close() override
Close the DeviceDriver.
static rclcpp::Node::SharedPtr createNode(std::string name)
Interface implemented by all device drivers.
A base class for nested structures that can be searched.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_DECLARE_LOG_COMPONENT(name)
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.
@ MAS_WAITING_FOR_FIRST_READ
The sensor is read through the network, and the device is waiting to receive the first measurement.