15 #ifndef NAV2_ROS_COMMON__NODE_THREAD_HPP_
16 #define NAV2_ROS_COMMON__NODE_THREAD_HPP_
20 #include "rclcpp/executor.hpp"
21 #include "rclcpp/executors/single_threaded_executor.hpp"
22 #include "rclcpp/node_interfaces/node_base_interface.hpp"
38 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base)
41 executor_ = std::make_shared<rclcpp::executors::SingleThreadedExecutor>();
42 thread_ = std::make_unique<std::thread>(
45 executor_->add_node(node_);
47 executor_->remove_node(node_);
56 rclcpp::executors::SingleThreadedExecutor::SharedPtr executor)
59 thread_ = std::make_unique<std::thread>(
69 template<
typename NodeT>
84 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_;
85 std::unique_ptr<std::thread> thread_;
86 rclcpp::Executor::SharedPtr executor_;
A background thread to process node/executor callbacks.
~NodeThread()
A destructor.
NodeThread(rclcpp::executors::SingleThreadedExecutor::SharedPtr executor)
A background thread to process executor's callbacks constructor.
NodeThread(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base)
A background thread to process node callbacks constructor.
NodeThread(NodeT node)
A background thread to process node callbacks constructor.