16using namespace std::chrono_literals;
23 rclcpp::init( 0,
nullptr);
24 node = std::make_shared<rclcpp::Node>(
"yarprobotinterface_node");
35 yarp::os::PeriodicThread(0.5)
42 m_topic = config.
check(
"topic",
yarp::os::Value(
"ros2test_topic"),
"Name of the ROS topic").asString();
45 m_publisher =
Ros2Init::get().
node->create_publisher<std_msgs::msg::String>(m_topic, 10);
61 auto message = std_msgs::msg::String();
62 message.data =
"Hello, " + m_topic +
"! " + std::to_string(m_count++);
64 m_publisher->publish(message);
const yarp::os::LogComponent & ROS2TEST()
std::shared_ptr< rclcpp::Node > node
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
void run() override
Loop function.
bool start()
Call this to start the thread.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
#define yCInfo(component,...)
#define yCTrace(component,...)
#define YARP_LOG_COMPONENT(name,...)
The main, catch-all namespace for YARP.