15 #ifndef RCLCPP__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__EVENTS_EXECUTOR_HPP_
16 #define RCLCPP__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__EVENTS_EXECUTOR_HPP_
23 #include "rclcpp/executor.hpp"
24 #include "rclcpp/executors/executor_entities_collection.hpp"
25 #include "rclcpp/executors/executor_entities_collector.hpp"
26 #include "rclcpp/experimental/executors/events_executor/events_executor_event_types.hpp"
27 #include "rclcpp/experimental/executors/events_executor/events_queue.hpp"
28 #include "rclcpp/experimental/executors/events_executor/simple_events_queue.hpp"
29 #include "rclcpp/experimental/timers_manager.hpp"
30 #include "rclcpp/node.hpp"
34 namespace experimental
74 rclcpp::experimental::executors::EventsQueue::UniquePtr events_queue = std::make_unique<
76 bool execute_timers_separate_thread =
false,
109 spin_some(std::chrono::nanoseconds max_duration = std::chrono::nanoseconds(0))
override;
127 spin_all(std::chrono::nanoseconds max_duration)
override;
138 spin_some_impl(std::chrono::nanoseconds max_duration,
bool exhaustive);
154 setup_notify_waitable();
161 std::function<void(
size_t)>
162 create_entity_callback(
void * entity_key, ExecutorEventType type);
165 std::function<void(
size_t,
int)>
170 add_notify_waitable_to_collection(
174 template<
typename CollectionType>
175 typename CollectionType::EntitySharedPtr
176 retrieve_entity(
typename CollectionType::Key entity_id, CollectionType & collection)
181 std::lock_guard<std::mutex> guard(mutex_);
184 auto it = collection.find(entity_id);
185 if (it == collection.end()) {
191 auto entity = it->second.entity.lock();
193 collection.erase(it);
201 rclcpp::experimental::executors::EventsQueue::UniquePtr events_queue_;
204 std::shared_ptr<rclcpp::experimental::TimersManager> timers_manager_;
Coordinate the order and timing of available communication tasks.
Events executor implementation.
RCLCPP_PUBLIC void spin_once_impl(std::chrono::nanoseconds timeout) override
Internal implementation of spin_once.
RCLCPP_PUBLIC void spin() override
Events executor implementation of spin.
virtual RCLCPP_PUBLIC ~EventsExecutor()
Default destructor.
RCLCPP_PUBLIC void spin_some_impl(std::chrono::nanoseconds max_duration, bool exhaustive)
Internal implementation of spin_some.
RCLCPP_PUBLIC EventsExecutor(rclcpp::experimental::executors::EventsQueue::UniquePtr events_queue=std::make_unique< rclcpp::experimental::executors::SimpleEventsQueue >(), bool execute_timers_separate_thread=false, const rclcpp::ExecutorOptions &options=rclcpp::ExecutorOptions())
Default constructor. See the default constructor for Executor.
RCLCPP_PUBLIC void spin_all(std::chrono::nanoseconds max_duration) override
Events executor implementation of spin all.
RCLCPP_PUBLIC void handle_updated_entities(bool notify) override
Collect entities from callback groups and refresh the current collection with them.
RCLCPP_PUBLIC void spin_some(std::chrono::nanoseconds max_duration=std::chrono::nanoseconds(0)) override
Events executor implementation of spin some.
This class implements an EventsQueue as a simple wrapper around a std::queue. It does not perform any...
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Options to be passed to the executor constructor.
Represent the total set of entities for a single executor.