ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
Public Member Functions | List of all members
rclcpp::executors::ExecutorNotifyWaitable Class Reference

#include <rclcpp/executors/executor_notify_waitable.hpp>

Inheritance diagram for rclcpp::executors::ExecutorNotifyWaitable:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::executors::ExecutorNotifyWaitable:
Collaboration graph
[legend]

Public Member Functions

RCLCPP_PUBLIC ExecutorNotifyWaitable (std::function< void(void)> on_execute_callback={})
 
RCLCPP_PUBLIC ExecutorNotifyWaitable (ExecutorNotifyWaitable &other)
 
RCLCPP_PUBLIC ExecutorNotifyWaitableoperator= (ExecutorNotifyWaitable &other)
 
RCLCPP_PUBLIC void add_to_wait_set (rcl_wait_set_t &wait_set) override
 Add conditions to the wait set. More...
 
RCLCPP_PUBLIC bool is_ready (const rcl_wait_set_t &wait_set) override
 Check conditions against the wait set. More...
 
RCLCPP_PUBLIC void execute (const std::shared_ptr< void > &data) override
 Perform work associated with the waitable. More...
 
RCLCPP_PUBLIC std::shared_ptr< void > take_data () override
 Retrieve data to be used in the next execute call. More...
 
RCLCPP_PUBLIC std::shared_ptr< void > take_data_by_entity_id (size_t id) override
 Take the data from an entity ID so that it can be consumed with execute. More...
 
RCLCPP_PUBLIC void set_on_ready_callback (std::function< void(size_t, int)> callback) override
 Set a callback to be called whenever the waitable becomes ready. More...
 
RCLCPP_PUBLIC void add_guard_condition (rclcpp::GuardCondition::WeakPtr guard_condition)
 Add a guard condition to be waited on. More...
 
RCLCPP_PUBLIC void clear_on_ready_callback () override
 Unset any callback registered via set_on_ready_callback. More...
 
RCLCPP_PUBLIC void remove_guard_condition (rclcpp::GuardCondition::WeakPtr weak_guard_condition)
 Remove a guard condition from being waited on. More...
 
RCLCPP_PUBLIC size_t get_number_of_ready_guard_conditions () override
 Get the number of ready guard_conditions. More...
 
- 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 void add_to_wait_set (rcl_wait_set_t *wait_set)
 Deprecated. More...
 
virtual RCLCPP_PUBLIC bool is_ready (rcl_wait_set_t *wait_set)
 Deprecated. More...
 
virtual RCLCPP_PUBLIC void execute (std::shared_ptr< void > &data)
 Deprecated. 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...
 

Detailed Description

Maintain a collection of guard conditions from associated nodes and callback groups to signal to the executor when associated entities have changed.

Definition at line 33 of file executor_notify_waitable.hpp.

Constructor & Destructor Documentation

◆ ExecutorNotifyWaitable()

rclcpp::executors::ExecutorNotifyWaitable::ExecutorNotifyWaitable ( std::function< void(void)>  on_execute_callback = {})
explicit
Parameters
[in]on_execute_callbackCallback to execute when one of the conditions of this waitable has signaled the wait_set.

Definition at line 25 of file executor_notify_waitable.cpp.

Member Function Documentation

◆ add_guard_condition()

void rclcpp::executors::ExecutorNotifyWaitable::add_guard_condition ( rclcpp::GuardCondition::WeakPtr  guard_condition)

Add a guard condition to be waited on.

Parameters
[in]guard_conditionThe guard condition to add.

Definition at line 153 of file executor_notify_waitable.cpp.

◆ add_to_wait_set()

void rclcpp::executors::ExecutorNotifyWaitable::add_to_wait_set ( rcl_wait_set_t wait_set)
overridevirtual

Add conditions to the wait set.

Parameters
[in,out]wait_setstructure that conditions will be added to

Reimplemented from rclcpp::Waitable.

Definition at line 48 of file executor_notify_waitable.cpp.

References RCL_RET_OK, and rcl_wait_set_add_guard_condition().

Here is the call graph for this function:

◆ clear_on_ready_callback()

RCLCPP_PUBLIC void rclcpp::executors::ExecutorNotifyWaitable::clear_on_ready_callback ( )
overridevirtual

Unset any callback registered via set_on_ready_callback.

See also
rclcpp::Waitable::clear_on_ready_callback

Reimplemented from rclcpp::Waitable.

Definition at line 138 of file executor_notify_waitable.cpp.

◆ execute()

void rclcpp::executors::ExecutorNotifyWaitable::execute ( const std::shared_ptr< void > &  data)
overridevirtual

Perform work associated with the waitable.

This will call the callback provided in the constructor.

Parameters
[in]dataData to be use for the execute, if available, else nullptr.

Reimplemented from rclcpp::Waitable.

Definition at line 94 of file executor_notify_waitable.cpp.

◆ get_number_of_ready_guard_conditions()

size_t rclcpp::executors::ExecutorNotifyWaitable::get_number_of_ready_guard_conditions ( )
overridevirtual

Get the number of ready guard_conditions.

Returns
The number of guard_conditions associated with the Waitable.

Reimplemented from rclcpp::Waitable.

Definition at line 180 of file executor_notify_waitable.cpp.

◆ is_ready()

bool rclcpp::executors::ExecutorNotifyWaitable::is_ready ( const rcl_wait_set_t wait_set)
overridevirtual

Check conditions against the wait set.

Parameters
[in,out]wait_setstructure that internal elements will be checked against.
Returns
true if this waitable is ready to be executed, false otherwise.

Reimplemented from rclcpp::Waitable.

Definition at line 71 of file executor_notify_waitable.cpp.

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

◆ remove_guard_condition()

void rclcpp::executors::ExecutorNotifyWaitable::remove_guard_condition ( rclcpp::GuardCondition::WeakPtr  weak_guard_condition)

Remove a guard condition from being waited on.

Parameters
[in]weak_guard_conditionThe guard condition to remove.

Definition at line 166 of file executor_notify_waitable.cpp.

◆ set_on_ready_callback()

void rclcpp::executors::ExecutorNotifyWaitable::set_on_ready_callback ( std::function< void(size_t, int)>  callback)
overridevirtual

Set a callback to be called whenever the waitable becomes ready.

Parameters
[in]callbackcallback to set
See also
rclcpp::Waitable::set_on_ready_callback

Reimplemented from rclcpp::Waitable.

Definition at line 114 of file executor_notify_waitable.cpp.

◆ take_data()

std::shared_ptr< void > rclcpp::executors::ExecutorNotifyWaitable::take_data ( )
overridevirtual

Retrieve data to be used in the next execute call.

Returns
If available, data to be used, otherwise nullptr

Implements rclcpp::Waitable.

Definition at line 101 of file executor_notify_waitable.cpp.

◆ take_data_by_entity_id()

std::shared_ptr< void > rclcpp::executors::ExecutorNotifyWaitable::take_data_by_entity_id ( size_t  id)
overridevirtual

Take the data from an entity ID so that it can be consumed with execute.

Parameters
[in]idID of the entity to take data from.
Returns
If available, data to be used, otherwise nullptr
See also
rclcpp::Waitable::take_data_by_entity_id

Reimplemented from rclcpp::Waitable.

Definition at line 107 of file executor_notify_waitable.cpp.


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