ROS 2 rclcpp + rcl - humble  humble
ROS 2 C++ Client Library with ROS Client Library
Public Member Functions | List of all members
rclcpp::executors::StaticExecutorEntitiesCollector Class Referencefinal
Inheritance diagram for rclcpp::executors::StaticExecutorEntitiesCollector:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::executors::StaticExecutorEntitiesCollector:
Collaboration graph
[legend]

Public Member Functions

RCLCPP_PUBLIC void init (rcl_wait_set_t *p_wait_set, rclcpp::memory_strategy::MemoryStrategy::SharedPtr memory_strategy)
 Initialize StaticExecutorEntitiesCollector. More...
 
RCLCPP_PUBLIC bool is_init ()
 Finalize StaticExecutorEntitiesCollector to clear resources.
 
RCLCPP_PUBLIC void fini ()
 
RCLCPP_PUBLIC void execute (std::shared_ptr< void > &data) override
 Execute the waitable.
 
RCLCPP_PUBLIC std::shared_ptr< void > take_data () override
 Take the data so that it can be consumed with execute. More...
 
RCLCPP_PUBLIC void refresh_wait_set (std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1))
 Function to add_handles_to_wait_set and wait for work and. More...
 
RCLCPP_PUBLIC void add_to_wait_set (rcl_wait_set_t *wait_set) override
 
RCLCPP_PUBLIC size_t get_number_of_ready_guard_conditions () override
 Get the number of ready guard_conditions. More...
 
RCLCPP_PUBLIC bool add_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 Add a callback group to an executor. More...
 
RCLCPP_PUBLIC bool add_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, WeakCallbackGroupsToNodesMap &weak_groups_to_nodes)
 Add a callback group to an executor. More...
 
RCLCPP_PUBLIC bool remove_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr)
 Remove a callback group from the executor. More...
 
RCLCPP_PUBLIC bool remove_callback_group_from_map (rclcpp::CallbackGroup::SharedPtr group_ptr, WeakCallbackGroupsToNodesMap &weak_groups_to_nodes)
 Remove a callback group from the executor. More...
 
RCLCPP_PUBLIC bool add_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 
RCLCPP_PUBLIC bool remove_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 
RCLCPP_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_all_callback_groups ()
 
RCLCPP_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_manually_added_callback_groups ()
 Get callback groups that belong to executor. More...
 
RCLCPP_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_automatically_added_callback_groups_from_nodes ()
 Get callback groups that belong to executor. More...
 
RCLCPP_PUBLIC bool is_ready (rcl_wait_set_t *wait_set) override
 Complete all available queued work without blocking. More...
 
RCLCPP_PUBLIC size_t get_number_of_timers ()
 Return number of timers. More...
 
RCLCPP_PUBLIC size_t get_number_of_subscriptions ()
 Return number of subscriptions. More...
 
RCLCPP_PUBLIC size_t get_number_of_services ()
 Return number of services. More...
 
RCLCPP_PUBLIC size_t get_number_of_clients ()
 Return number of clients. More...
 
RCLCPP_PUBLIC size_t get_number_of_waitables ()
 Return number of waitables. More...
 
RCLCPP_PUBLIC rclcpp::SubscriptionBase::SharedPtr get_subscription (size_t i)
 
RCLCPP_PUBLIC rclcpp::TimerBase::SharedPtr get_timer (size_t i)
 
RCLCPP_PUBLIC rclcpp::ServiceBase::SharedPtr get_service (size_t i)
 
RCLCPP_PUBLIC rclcpp::ClientBase::SharedPtr get_client (size_t i)
 
RCLCPP_PUBLIC rclcpp::Waitable::SharedPtr get_waitable (size_t i)
 
- Public Member Functions inherited from rclcpp::Waitable
virtual RCLCPP_PUBLIC size_t get_number_of_ready_subscriptions ()
 Get the number of ready subscriptions. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_timers ()
 Get the number of ready timers. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_clients ()
 Get the number of ready clients. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_events ()
 Get the number of ready events. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_services ()
 Get the number of ready services. More...
 
virtual RCLCPP_PUBLIC std::shared_ptr< void > take_data_by_entity_id (size_t id)
 Take the data so that it can be consumed with execute. More...
 
RCLCPP_PUBLIC bool exchange_in_use_by_wait_set_state (bool in_use_state)
 Exchange the "in use by wait set" state for this timer. More...
 
virtual RCLCPP_PUBLIC void set_on_ready_callback (std::function< void(size_t, int)> callback)
 Set a callback to be called whenever the waitable becomes ready. More...
 
virtual RCLCPP_PUBLIC void clear_on_ready_callback ()
 Unset any callback registered via set_on_ready_callback. More...
 

Detailed Description

Definition at line 41 of file static_executor_entities_collector.hpp.

Member Function Documentation

◆ add_callback_group() [1/2]

bool StaticExecutorEntitiesCollector::add_callback_group ( rclcpp::CallbackGroup::SharedPtr  group_ptr,
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr 
)

Add a callback group to an executor.

See also
rclcpp::Executor::add_callback_group

Definition at line 343 of file static_executor_entities_collector.cpp.

◆ add_callback_group() [2/2]

bool StaticExecutorEntitiesCollector::add_callback_group ( rclcpp::CallbackGroup::SharedPtr  group_ptr,
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr,
WeakCallbackGroupsToNodesMap &  weak_groups_to_nodes 
)

Add a callback group to an executor.

See also
rclcpp::Executor::add_callback_group
Returns
boolean whether the node from the callback group is new

Definition at line 315 of file static_executor_entities_collector.cpp.

◆ add_node()

bool StaticExecutorEntitiesCollector::add_node ( rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr)
See also
rclcpp::Executor::add_node()
Exceptions
std::runtime_errorif node was already added

Definition at line 287 of file static_executor_entities_collector.cpp.

◆ add_to_wait_set()

void StaticExecutorEntitiesCollector::add_to_wait_set ( rcl_wait_set_t wait_set)
overridevirtual
Exceptions
std::runtime_errorif it couldn't add guard condition to wait set

Implements rclcpp::Waitable.

Definition at line 271 of file static_executor_entities_collector.cpp.

◆ get_automatically_added_callback_groups_from_nodes()

std::vector< rclcpp::CallbackGroup::WeakPtr > StaticExecutorEntitiesCollector::get_automatically_added_callback_groups_from_nodes ( )

Get callback groups that belong to executor.

See also
rclcpp::Executor::get_automatically_added_callback_groups_from_nodes()

Definition at line 517 of file static_executor_entities_collector.cpp.

◆ get_client()

RCLCPP_PUBLIC rclcpp::ClientBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_client ( size_t  i)
inline

Return a ClientBase Sharedptr by index

Parameters
[in]iThe index of the ClientBase
Returns
a ClientBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

Definition at line 275 of file static_executor_entities_collector.hpp.

◆ get_manually_added_callback_groups()

std::vector< rclcpp::CallbackGroup::WeakPtr > StaticExecutorEntitiesCollector::get_manually_added_callback_groups ( )

Get callback groups that belong to executor.

See also
rclcpp::Executor::get_manually_added_callback_groups()

Definition at line 507 of file static_executor_entities_collector.cpp.

◆ get_number_of_clients()

RCLCPP_PUBLIC size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_clients ( )
inline

Return number of clients.

Returns
number of clients

Definition at line 231 of file static_executor_entities_collector.hpp.

◆ get_number_of_ready_guard_conditions()

size_t StaticExecutorEntitiesCollector::get_number_of_ready_guard_conditions ( )
overridevirtual

Get the number of ready guard_conditions.

Returns a value of 0 by default. This should be overridden if the Waitable contains one or more guard_conditions.

Returns
The number of guard_conditions associated with the Waitable.

Reimplemented from rclcpp::Waitable.

Definition at line 280 of file static_executor_entities_collector.cpp.

◆ get_number_of_services()

RCLCPP_PUBLIC size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_services ( )
inline

Return number of services.

Returns
number of services

Definition at line 223 of file static_executor_entities_collector.hpp.

◆ get_number_of_subscriptions()

RCLCPP_PUBLIC size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_subscriptions ( )
inline

Return number of subscriptions.

Returns
number of subscriptions

Definition at line 215 of file static_executor_entities_collector.hpp.

◆ get_number_of_timers()

RCLCPP_PUBLIC size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_timers ( )
inline

Return number of timers.

Returns
number of timers

Definition at line 207 of file static_executor_entities_collector.hpp.

◆ get_number_of_waitables()

RCLCPP_PUBLIC size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_waitables ( )
inline

Return number of waitables.

Returns
number of waitables

Definition at line 239 of file static_executor_entities_collector.hpp.

◆ get_service()

RCLCPP_PUBLIC rclcpp::ServiceBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_service ( size_t  i)
inline

Return a ServiceBase Sharedptr by index.

Parameters
[in]iThe index of the ServiceBase
Returns
a ServiceBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

Definition at line 266 of file static_executor_entities_collector.hpp.

◆ get_subscription()

RCLCPP_PUBLIC rclcpp::SubscriptionBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_subscription ( size_t  i)
inline

Return a SubscritionBase Sharedptr by index.

Parameters
[in]iThe index of the SubscritionBase
Returns
a SubscritionBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size of the structrue.

Definition at line 248 of file static_executor_entities_collector.hpp.

◆ get_timer()

RCLCPP_PUBLIC rclcpp::TimerBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_timer ( size_t  i)
inline

Return a TimerBase Sharedptr by index.

Parameters
[in]iThe index of the TimerBase
Returns
a TimerBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

Definition at line 257 of file static_executor_entities_collector.hpp.

◆ get_waitable()

RCLCPP_PUBLIC rclcpp::Waitable::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_waitable ( size_t  i)
inline

Return a Waitable Sharedptr by index

Parameters
[in]iThe index of the Waitable
Returns
a Waitable shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

Definition at line 284 of file static_executor_entities_collector.hpp.

◆ init()

void StaticExecutorEntitiesCollector::init ( rcl_wait_set_t p_wait_set,
rclcpp::memory_strategy::MemoryStrategy::SharedPtr  memory_strategy 
)

Initialize StaticExecutorEntitiesCollector.

Parameters
p_wait_setA reference to the wait set to be used in the executor
memory_strategyShared pointer to the memory strategy to set.
Exceptions
std::runtime_errorif memory strategy is null

Definition at line 63 of file static_executor_entities_collector.cpp.

References execute().

Here is the call graph for this function:

◆ is_ready()

bool StaticExecutorEntitiesCollector::is_ready ( rcl_wait_set_t wait_set)
overridevirtual

Complete all available queued work without blocking.

This function checks if after the guard condition was triggered (or a spurious wakeup happened) we are really ready to execute i.e. re-collect entities

Implements rclcpp::Waitable.

Definition at line 434 of file static_executor_entities_collector.cpp.

References rcl_wait_set_s::guard_conditions, and rcl_wait_set_s::size_of_guard_conditions.

◆ refresh_wait_set()

void StaticExecutorEntitiesCollector::refresh_wait_set ( std::chrono::nanoseconds  timeout = std::chrono::nanoseconds(-1))

Function to add_handles_to_wait_set and wait for work and.

block until the wait set is ready or until the timeout has been exceeded.

Exceptions
std::runtime_errorif wait set couldn't be cleared or filled.
anyrcl errors from rcl_wait,
See also
rclcpp::exceptions::throw_from_rcl_error()

Definition at line 245 of file static_executor_entities_collector.cpp.

References RCL_RET_OK, RCL_RET_TIMEOUT, RCL_RET_WAIT_SET_EMPTY, rcl_wait(), and rcl_wait_set_clear().

Here is the call graph for this function:

◆ remove_callback_group()

bool StaticExecutorEntitiesCollector::remove_callback_group ( rclcpp::CallbackGroup::SharedPtr  group_ptr)

Remove a callback group from the executor.

See also
rclcpp::Executor::remove_callback_group

Definition at line 351 of file static_executor_entities_collector.cpp.

References remove_callback_group_from_map().

Here is the call graph for this function:

◆ remove_callback_group_from_map()

bool StaticExecutorEntitiesCollector::remove_callback_group_from_map ( rclcpp::CallbackGroup::SharedPtr  group_ptr,
WeakCallbackGroupsToNodesMap &  weak_groups_to_nodes 
)

Remove a callback group from the executor.

See also
rclcpp::Executor::remove_callback_group_from_map

Definition at line 360 of file static_executor_entities_collector.cpp.

Referenced by remove_callback_group().

Here is the caller graph for this function:

◆ remove_node()

bool StaticExecutorEntitiesCollector::remove_node ( rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr)
See also
rclcpp::Executor::remove_node()
Exceptions
std::runtime_errorif no guard condition is associated with node.

Definition at line 388 of file static_executor_entities_collector.cpp.

◆ take_data()

std::shared_ptr< void > StaticExecutorEntitiesCollector::take_data ( )
overridevirtual

Take the data so that it can be consumed with execute.

For StaticExecutorEntitiesCollector, this always return nullptr.

See also
rclcpp::Waitable::take_data()

Implements rclcpp::Waitable.

Definition at line 93 of file static_executor_entities_collector.cpp.


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