nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
rclcpp::executors::SingleThreadedExecutor Class Reference

#include <rclcpp.hpp>

Public Member Functions

void add_node (const ::rclcpp::Node::SharedPtr &node, bool notify=true)
template<typename NodePtr, typename T = void>
void remove_node (const NodePtr &node, bool notify=true)
 SingleThreadedExecutor ()
void spin ()
 Block until rclcpp::ok() goes false — rclcpp::spin_in().
void spin_all (uint32_t max_duration_ms)
void spin_node_once (const ::rclcpp::Node::SharedPtr &node, int32_t timeout_ms)
void spin_node_some (const ::rclcpp::Node::SharedPtr &node)
void spin_some (uint32_t max_ms=0)
template<typename Future>
FutureReturnCode spin_until_future_complete (Future &&future, int32_t timeout_ms=-1)

Detailed Description

rclcpp::executors::SingleThreadedExecutor — phase-488. ADOPT-BOUNDED.

A FACADE over the process executor, which is what every rclcpp::Node already lives on: there is one session per image (issue 0465) and a node's entities are created in that executor's arena when the node is constructed (RFC-0002). So the three lines a stock main writes keep their meaning —

rclcpp::executors::SingleThreadedExecutor executor;
executor.add_node(node);
executor.spin();

— with add_node CHECKING the attachment that construction already made rather than making one. The bound, stated: there is no second executor to build, so two of these are the same executor; add_node aborts, naming the node, when the node failed to create or was created on an explicit rclcpp::Executor instead (spinning this would never reach it); there is no remove_node, because arena registration is one-way (the cpp:Executor::add_node row). spin / spin_some are rclcpp::spin_in() / the process executor's spin_some.

Constructor & Destructor Documentation

◆ SingleThreadedExecutor()

rclcpp::executors::SingleThreadedExecutor::SingleThreadedExecutor ( )
inline

Member Function Documentation

◆ add_node()

void rclcpp::executors::SingleThreadedExecutor::add_node ( const ::rclcpp::Node::SharedPtr & node,
bool notify = true )
inline

Check that node is on the process executor. notify is accepted and ignored, as there is no waiting executor to wake.

◆ remove_node()

template<typename NodePtr, typename T = void>
void rclcpp::executors::SingleThreadedExecutor::remove_node ( const NodePtr & node,
bool notify = true )
inline

REFUSED — remove_node; see rclcpp::Executor::remove_node. phase-515 P2.

◆ spin()

void rclcpp::executors::SingleThreadedExecutor::spin ( )
inline

Block until rclcpp::ok() goes false — rclcpp::spin_in().

◆ spin_all()

void rclcpp::executors::SingleThreadedExecutor::spin_all ( uint32_t max_duration_ms)
inline

spin_all(max_duration) — phase-515 P2; see rclcpp::Executor::spin_all. A zero bound is refused, as upstream throws for it.

◆ spin_node_once()

void rclcpp::executors::SingleThreadedExecutor::spin_node_once ( const ::rclcpp::Node::SharedPtr & node,
int32_t timeout_ms )
inline

spin_node_once(node, timeout) — phase-515 P2: add_node's check, then one spin_once of the process executor (every node's ready work). The budget is required, as for rclcpp::spin_once.

◆ spin_node_some()

void rclcpp::executors::SingleThreadedExecutor::spin_node_some ( const ::rclcpp::Node::SharedPtr & node)
inline

spin_node_some(node) — phase-515 P2: add_node's check, then spin_some, which drains every node on the process executor.

◆ spin_some()

void rclcpp::executors::SingleThreadedExecutor::spin_some ( uint32_t max_ms = 0)
inline

Drain what is ready, without waiting — Executor::spin_some on the process executor. max_ms is MILLISECONDS (0 = no limit).

◆ spin_until_future_complete()

template<typename Future>
FutureReturnCode rclcpp::executors::SingleThreadedExecutor::spin_until_future_complete ( Future && future,
int32_t timeout_ms = -1 )
inline

spin_until_future_complete(future, timeout) on the process executor — phase-515 P1, the envelope of rclcpp::spin_until_future_complete (int32_t milliseconds, -1 = unbounded, 10 ms slices).


The documentation for this class was generated from the following file: