YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Ros2Spinner.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include "Ros2Spinner.h"
7
8#include <yarp/os/Log.h>
10#include <yarp/os/LogStream.h>
11
12namespace {
13YARP_LOG_COMPONENT(ROS2SPINNER, "yarp.ros2.Ros2Spinner")
14}
15
16Ros2Spinner::Ros2Spinner(std::shared_ptr<rclcpp::Node> input_node) :
17m_node(input_node)
18{}
19
21{
22 if(!m_spun)
23 {
24 m_spun = true;
25 rclcpp::spin(m_node);
26 }
27}
28
30{
31 if(m_spun)
32 {
33 rclcpp::shutdown();
34 m_spun = false;
35 }
36}
void run() override
Main body of the new thread.
Ros2Spinner(std::shared_ptr< rclcpp::Node > input_node)
#define YARP_LOG_COMPONENT(name,...)