Class ExecutorNotifyWaitable

Inheritance Relationships

Base Type

Class Documentation

class ExecutorNotifyWaitable : public rclcpp::Waitable

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

Public Functions

explicit ExecutorNotifyWaitable(std::function<void(void)> on_execute_callback = {})
Parameters:

on_execute_callback[in] Callback to execute when one of the conditions of this waitable has signaled the wait_set.

~ExecutorNotifyWaitable() override = default
ExecutorNotifyWaitable(ExecutorNotifyWaitable &other)
ExecutorNotifyWaitable &operator=(ExecutorNotifyWaitable &other)
virtual void add_to_wait_set(rcl_wait_set_t &wait_set) override

Add conditions to the wait set.

Parameters:

wait_set[inout] structure that conditions will be added to

virtual bool is_ready(const rcl_wait_set_t &wait_set) override

Check conditions against the wait set.

Parameters:

wait_set[inout] structure that internal elements will be checked against.

Returns:

true if this waitable is ready to be executed, false otherwise.

virtual void execute(const std::shared_ptr<void> &data) override

Perform work associated with the waitable.

This will call the callback provided in the constructor.

Parameters:

data[in] Data to be use for the execute, if available, else nullptr.

virtual std::shared_ptr<void> take_data() override

Retrieve data to be used in the next execute call.

Returns:

If available, data to be used, otherwise nullptr

virtual 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.

Parameters:

id[in] ID of the entity to take data from.

Returns:

If available, data to be used, otherwise nullptr

virtual void set_on_ready_callback(std::function<void(size_t, int)> callback) override

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

Parameters:

callback[in] callback to set

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

Add a guard condition to be waited on.

Parameters:

guard_condition[in] The guard condition to add.

virtual void clear_on_ready_callback() override

Unset any callback registered via set_on_ready_callback.

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

Remove a guard condition from being waited on.

Parameters:

weak_guard_condition[in] The guard condition to remove.

virtual size_t get_number_of_ready_guard_conditions() override

Get the number of ready guard_conditions.

Returns:

The number of guard_conditions associated with the Waitable.