15 #ifndef RCLCPP__EXECUTORS__EXECUTOR_NOTIFY_WAITABLE_HPP_
16 #define RCLCPP__EXECUTORS__EXECUTOR_NOTIFY_WAITABLE_HPP_
24 #include "rclcpp/guard_condition.hpp"
25 #include "rclcpp/waitable.hpp"
46 std::function<
void(
void)> on_execute_callback = {},
const rclcpp::Context::SharedPtr & context =
47 rclcpp::contexts::get_global_default_context());
83 execute(
const std::shared_ptr<void> & data)
override;
100 std::shared_ptr<void>
157 std::vector<std::shared_ptr<rclcpp::TimerBase>>
162 std::function<void(
void)> execute_callback_;
165 std::mutex guard_condition_mutex_;
167 std::mutex execute_mutex_;
169 std::function<void(
size_t)> on_ready_callback_;
172 std::set<rclcpp::GuardCondition::SharedPtr> notify_guard_conditions_;
176 std::vector<size_t> idxs_of_added_guard_condition_;
179 bool needs_processing =
false;
182 rclcpp::GuardCondition::SharedPtr guard_condition_;
RCLCPP_PUBLIC ExecutorNotifyWaitable(std::function< void(void)> on_execute_callback={}, const rclcpp::Context::SharedPtr &context=rclcpp::contexts::get_global_default_context())
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.
RCLCPP_PUBLIC void set_execute_callback(std::function< void(void)> on_execute_callback)
Set a new callback to be called whenever this waitable is executed.
RCLCPP_PUBLIC void execute(const std::shared_ptr< void > &data) override
Perform work associated with the waitable.
RCLCPP_PUBLIC void add_guard_condition(rclcpp::GuardCondition::WeakPtr guard_condition)
Add a guard condition to be waited on.
RCLCPP_PUBLIC size_t get_number_of_ready_guard_conditions() override
Get the number of ready guard_conditions.
RCLCPP_PUBLIC std::shared_ptr< void > take_data() override
Retrieve data to be used in the next execute call.
RCLCPP_PUBLIC void add_to_wait_set(rcl_wait_set_t &wait_set) override
Add conditions to the wait set.
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.
RCLCPP_PUBLIC void clear_on_ready_callback() override
Unset any callback registered via set_on_ready_callback.
RCLCPP_PUBLIC bool is_ready(const rcl_wait_set_t &wait_set) override
Check conditions against the wait set.
RCLCPP_PUBLIC std::vector< std::shared_ptr< rclcpp::TimerBase > > get_timers() const override
Returns the number of used Timers.
RCLCPP_PUBLIC void remove_guard_condition(rclcpp::GuardCondition::WeakPtr weak_guard_condition)
Remove a guard condition from being waited on.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Container for subscription's, guard condition's, etc to be waited on.