6#ifndef YARP_DEV_GENERICSENSORS_NWS_ROS2_H
7#define YARP_DEV_GENERICSENSORS_NWS_ROS2_H
18#include <rclcpp/rclcpp.hpp>
39template <
class ROS_MSG>
75template <
class ROS_MSG>
85template <
class ROS_MSG>
88template <
class ROS_MSG>
92 if (m_node_name.c_str()[0] ==
'/') {
97 if (m_topic_name.c_str()[0] !=
'/') {
103 m_publisher = m_node->create_publisher<ROS_MSG>(m_topic_name,rclcpp::QoS(10));
105 if (m_node ==
nullptr) {
110 if (m_publisher ==
nullptr) {
120template <
class ROS_MSG>
123 return this->detachAll();
126template <
class ROS_MSG>
133 "single MultipleAnalogSensors device on YARP ports, but %d devices have been passed in attachAll.",
155 bool ok = viewInterfaces();
158 ok &= this->setPeriod(m_period);
164template <
class ROS_MSG>
168 if (this->isRunning()) {
174template <
class ROS_MSG>
179template <
class ROS_MSG>
const yarp::os::LogComponent & GENERICSENSOR_NWS_ROS2()
This class is the parameters parser for class GenericSensor_nws_ros2.
This abstract template needs to be specialized in a ROS Publisher, for a specific ROS mesagge/sensor ...
rclcpp::Publisher< ROS_MSG >::SharedPtr m_publisher
bool open(yarp::os::Searchable ¶ms) override
Open the DeviceDriver.
yarp::dev::PolyDriver * m_poly
bool detachAll() override
Detach the object (you must have first called attach).
virtual bool viewInterfaces()=0
rclcpp::Node::SharedPtr m_node
virtual ~GenericSensor_nws_ros2()
bool attachAll(const yarp::dev::PolyDriverList &p) override
Attach to a list of objects.
const size_t m_sens_index
yarp::dev::PolyDriver m_subdevicedriver
bool close() override
Close the DeviceDriver.
void run() override
Loop function.
void threadRelease() override
Release method.
static rclcpp::Node::SharedPtr createNode(std::string name)
Interface implemented by all device drivers.
Interface for an object that can wrap/attach to to another.
A container for a device driver.
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_DECLARE_LOG_COMPONENT(name)