From 54b8f9cc9736a0e0a160452553a21a2a86acfd43 Mon Sep 17 00:00:00 2001 From: Alberto Soragna Date: Mon, 22 Jul 2024 06:43:16 -0700 Subject: [PATCH] Have the EventsExecutor use more common code (#2570) * move notify waitable setup to its own function * move mutex lock to retrieve_entity utility * use entities_need_rebuild_ atomic bool in events-executors * remove duplicated set_on_ready_callback for notify_waitable * use mutex from base class rather than a new recursive mutex * use current_collection_ member in events-executor * delay adding notify waitable to collection * postpone clearing the current collection * commonize notify waitable and collection * commonize add/remove node/cbg methods * fix linter errors --------- Signed-off-by: Alberto Soragna --- rclcpp/include/rclcpp/executor.hpp | 5 +- .../executors/executor_notify_waitable.hpp | 11 ++ .../events_executor/events_executor.hpp | 109 ++---------- rclcpp/src/rclcpp/executor.cpp | 18 +- .../executors/executor_notify_waitable.cpp | 14 +- .../events_executor/events_executor.cpp | 163 ++++-------------- .../test/rclcpp/executors/test_executors.cpp | 2 +- .../test_static_single_threaded_executor.cpp | 8 +- rclcpp/test/rclcpp/test_executor.cpp | 4 +- 9 files changed, 90 insertions(+), 244 deletions(-) diff --git a/rclcpp/include/rclcpp/executor.hpp b/rclcpp/include/rclcpp/executor.hpp index 5e5a054814..ae2087bbc5 100644 --- a/rclcpp/include/rclcpp/executor.hpp +++ b/rclcpp/include/rclcpp/executor.hpp @@ -541,8 +541,9 @@ class Executor * * \param[in] notify if true will execute a trigger that will wake up a waiting executor */ - void - trigger_entity_recollect(bool notify); + RCLCPP_PUBLIC + virtual void + handle_updated_entities(bool notify); /// Spinning state, used to prevent multi threaded calls to spin and to cancel blocking spins. std::atomic_bool spinning; diff --git a/rclcpp/include/rclcpp/executors/executor_notify_waitable.hpp b/rclcpp/include/rclcpp/executors/executor_notify_waitable.hpp index d389cbf1e0..7ae1c3b875 100644 --- a/rclcpp/include/rclcpp/executors/executor_notify_waitable.hpp +++ b/rclcpp/include/rclcpp/executors/executor_notify_waitable.hpp @@ -122,6 +122,14 @@ class ExecutorNotifyWaitable : public rclcpp::Waitable void clear_on_ready_callback() override; + /// Set a new callback to be called whenever this waitable is executed. + /** + * \param[in] on_execute_callback The new callback + */ + RCLCPP_PUBLIC + void + set_execute_callback(std::function on_execute_callback); + /// Remove a guard condition from being waited on. /** * \param[in] weak_guard_condition The guard condition to remove. @@ -142,7 +150,10 @@ class ExecutorNotifyWaitable : public rclcpp::Waitable /// Callback to run when waitable executes std::function execute_callback_; + /// Mutex to procetect the guard conditions std::mutex guard_condition_mutex_; + /// Mutex to protect the execute callback + std::mutex execute_mutex_; std::function on_ready_callback_; diff --git a/rclcpp/include/rclcpp/experimental/executors/events_executor/events_executor.hpp b/rclcpp/include/rclcpp/experimental/executors/events_executor/events_executor.hpp index dd5b1ebe63..163d8d2367 100644 --- a/rclcpp/include/rclcpp/experimental/executors/events_executor/events_executor.hpp +++ b/rclcpp/include/rclcpp/experimental/executors/events_executor/events_executor.hpp @@ -59,8 +59,6 @@ namespace executors */ class EventsExecutor : public rclcpp::Executor { - friend class EventsExecutorEntitiesCollector; - public: RCLCPP_SMART_PTR_DEFINITIONS(EventsExecutor) @@ -72,7 +70,7 @@ class EventsExecutor : public rclcpp::Executor * \param[in] options Options used to configure the executor. */ RCLCPP_PUBLIC - explicit EventsExecutor( + EventsExecutor( rclcpp::experimental::executors::EventsQueue::UniquePtr events_queue = std::make_unique< rclcpp::experimental::executors::SimpleEventsQueue>(), bool execute_timers_separate_thread = false, @@ -128,87 +126,6 @@ class EventsExecutor : public rclcpp::Executor void spin_all(std::chrono::nanoseconds max_duration) override; - /// Add a node to the executor. - /** - * \sa rclcpp::Executor::add_node - */ - RCLCPP_PUBLIC - void - add_node( - rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, - bool notify = true) override; - - /// Convenience function which takes Node and forwards NodeBaseInterface. - /** - * \sa rclcpp::EventsExecutor::add_node - */ - RCLCPP_PUBLIC - void - add_node(std::shared_ptr node_ptr, bool notify = true) override; - - /// Remove a node from the executor. - /** - * \sa rclcpp::Executor::remove_node - */ - RCLCPP_PUBLIC - void - remove_node( - rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, - bool notify = true) override; - - /// Convenience function which takes Node and forwards NodeBaseInterface. - /** - * \sa rclcpp::Executor::remove_node - */ - RCLCPP_PUBLIC - void - remove_node(std::shared_ptr node_ptr, bool notify = true) override; - - /// Add a callback group to an executor. - /** - * \sa rclcpp::Executor::add_callback_group - */ - RCLCPP_PUBLIC - void - add_callback_group( - rclcpp::CallbackGroup::SharedPtr group_ptr, - rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, - bool notify = true) override; - - /// Remove callback group from the executor - /** - * \sa rclcpp::Executor::remove_callback_group - */ - RCLCPP_PUBLIC - void - remove_callback_group( - rclcpp::CallbackGroup::SharedPtr group_ptr, - bool notify = true) override; - - /// Get callback groups that belong to executor. - /** - * \sa rclcpp::Executor::get_all_callback_groups() - */ - RCLCPP_PUBLIC - std::vector - get_all_callback_groups() override; - - /// Get callback groups that belong to executor. - /** - * \sa rclcpp::Executor::get_manually_added_callback_groups() - */ - RCLCPP_PUBLIC - std::vector - get_manually_added_callback_groups() override; - - /// Get callback groups that belong to executor. - /** - * \sa rclcpp::Executor::get_automatically_added_callback_groups_from_nodes() - */ - RCLCPP_PUBLIC - std::vector - get_automatically_added_callback_groups_from_nodes() override; - protected: /// Internal implementation of spin_once RCLCPP_PUBLIC @@ -220,6 +137,11 @@ class EventsExecutor : public rclcpp::Executor void spin_some_impl(std::chrono::nanoseconds max_duration, bool exhaustive); + /// Collect entities from callback groups and refresh the current collection with them + RCLCPP_PUBLIC + void + handle_updated_entities(bool notify) override; + private: RCLCPP_DISABLE_COPY(EventsExecutor) @@ -227,9 +149,9 @@ class EventsExecutor : public rclcpp::Executor void execute_event(const ExecutorEvent & event); - /// Collect entities from callback groups and refresh the current collection with them + /// Rebuilds the executor's notify waitable, as we can't use the one built in the base class void - refresh_current_collection_from_callback_groups(); + setup_notify_waitable(); /// Refresh the current collection using the provided new_collection void @@ -253,6 +175,11 @@ class EventsExecutor : public rclcpp::Executor typename CollectionType::EntitySharedPtr retrieve_entity(typename CollectionType::Key entity_id, CollectionType & collection) { + // Note: we lock the mutex because we assume that you are trying to get an element from the + // current collection... If there will be a use-case to retrieve elements also from other + // collections, we can move the mutex back to the calling codes. + std::lock_guard guard(mutex_); + // Check if the entity_id is in the collection auto it = collection.find(entity_id); if (it == collection.end()) { @@ -273,16 +200,6 @@ class EventsExecutor : public rclcpp::Executor /// Queue where entities can push events rclcpp::experimental::executors::EventsQueue::UniquePtr events_queue_; - std::shared_ptr entities_collector_; - std::shared_ptr notify_waitable_; - - /// Mutex to protect the current_entities_collection_ - std::recursive_mutex collection_mutex_; - std::shared_ptr current_entities_collection_; - - /// Flag used to reduce the number of unnecessary waitable events - std::atomic notify_waitable_event_pushed_ {false}; - /// Timers manager used to track and/or execute associated timers std::shared_ptr timers_manager_; }; diff --git a/rclcpp/src/rclcpp/executor.cpp b/rclcpp/src/rclcpp/executor.cpp index 181f0c9a6a..69131cc111 100644 --- a/rclcpp/src/rclcpp/executor.cpp +++ b/rclcpp/src/rclcpp/executor.cpp @@ -129,7 +129,7 @@ Executor::~Executor() } void -Executor::trigger_entity_recollect(bool notify) +Executor::handle_updated_entities(bool notify) { this->entities_need_rebuild_.store(true); @@ -174,11 +174,11 @@ Executor::add_callback_group( this->collector_.add_callback_group(group_ptr); try { - this->trigger_entity_recollect(notify); + this->handle_updated_entities(notify); } catch (const rclcpp::exceptions::RCLError & ex) { throw std::runtime_error( std::string( - "Failed to trigger guard condition on callback group add: ") + ex.what()); + "Failed to handle entities update on callback group add: ") + ex.what()); } } @@ -188,11 +188,11 @@ Executor::add_node(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_pt this->collector_.add_node(node_ptr); try { - this->trigger_entity_recollect(notify); + this->handle_updated_entities(notify); } catch (const rclcpp::exceptions::RCLError & ex) { throw std::runtime_error( std::string( - "Failed to trigger guard condition on node add: ") + ex.what()); + "Failed to handle entities update on node add: ") + ex.what()); } } @@ -204,11 +204,11 @@ Executor::remove_callback_group( this->collector_.remove_callback_group(group_ptr); try { - this->trigger_entity_recollect(notify); + this->handle_updated_entities(notify); } catch (const rclcpp::exceptions::RCLError & ex) { throw std::runtime_error( std::string( - "Failed to trigger guard condition on callback group remove: ") + ex.what()); + "Failed to handle entities update on callback group remove: ") + ex.what()); } } @@ -224,11 +224,11 @@ Executor::remove_node(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node this->collector_.remove_node(node_ptr); try { - this->trigger_entity_recollect(notify); + this->handle_updated_entities(notify); } catch (const rclcpp::exceptions::RCLError & ex) { throw std::runtime_error( std::string( - "Failed to trigger guard condition on node remove: ") + ex.what()); + "Failed to handle entities update on node remove: ") + ex.what()); } } diff --git a/rclcpp/src/rclcpp/executors/executor_notify_waitable.cpp b/rclcpp/src/rclcpp/executors/executor_notify_waitable.cpp index 09789a13ff..2e62f9dd1a 100644 --- a/rclcpp/src/rclcpp/executors/executor_notify_waitable.cpp +++ b/rclcpp/src/rclcpp/executors/executor_notify_waitable.cpp @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "rclcpp/exceptions.hpp" #include "rclcpp/executors/executor_notify_waitable.hpp" @@ -91,9 +89,9 @@ ExecutorNotifyWaitable::is_ready(const rcl_wait_set_t & wait_set) } void -ExecutorNotifyWaitable::execute(const std::shared_ptr & data) +ExecutorNotifyWaitable::execute(const std::shared_ptr & /*data*/) { - (void) data; + std::lock_guard lock(execute_mutex_); this->execute_callback_(); } @@ -149,6 +147,14 @@ ExecutorNotifyWaitable::clear_on_ready_callback() } } +RCLCPP_PUBLIC +void +ExecutorNotifyWaitable::set_execute_callback(std::function on_execute_callback) +{ + std::lock_guard lock(execute_mutex_); + execute_callback_ = on_execute_callback; +} + void ExecutorNotifyWaitable::add_guard_condition(rclcpp::GuardCondition::WeakPtr weak_guard_condition) { diff --git a/rclcpp/src/rclcpp/experimental/executors/events_executor/events_executor.cpp b/rclcpp/src/rclcpp/experimental/executors/events_executor/events_executor.cpp index c7d6be7e44..b7dd1487f9 100644 --- a/rclcpp/src/rclcpp/experimental/executors/events_executor/events_executor.cpp +++ b/rclcpp/src/rclcpp/experimental/executors/events_executor/events_executor.cpp @@ -52,30 +52,37 @@ EventsExecutor::EventsExecutor( timers_manager_ = std::make_shared(context_, timer_on_ready_cb); - this->current_entities_collection_ = - std::make_shared(); + entities_need_rebuild_ = false; - notify_waitable_ = std::make_shared( + this->setup_notify_waitable(); + + // Ensure that the entities collection is empty (the base class may have added elements + // that we are not interested in) + this->current_collection_.clear(); + + // Make sure that the notify waitable is immediately added to the collection + // to avoid missing events + this->add_notify_waitable_to_collection(current_collection_.waitables); +} + +void +EventsExecutor::setup_notify_waitable() +{ + // The base class already created this object but the events-executor + // needs different callbacks. + assert(notify_waitable_ && "The notify waitable should have already been constructed"); + + notify_waitable_->set_execute_callback( [this]() { // This callback is invoked when: // - the interrupt or shutdown guard condition is triggered: // ---> we need to wake up the executor so that it can terminate // - a node or callback group guard condition is triggered: // ---> the entities collection is changed, we need to update callbacks - notify_waitable_event_pushed_ = false; - this->refresh_current_collection_from_callback_groups(); + entities_need_rebuild_ = false; + this->handle_updated_entities(false); }); - // Make sure that the notify waitable is immediately added to the collection - // to avoid missing events - this->add_notify_waitable_to_collection(current_entities_collection_->waitables); - - notify_waitable_->add_guard_condition(interrupt_guard_condition_); - notify_waitable_->add_guard_condition(shutdown_guard_condition_); - - notify_waitable_->set_on_ready_callback( - this->create_waitable_callback(notify_waitable_.get())); - auto notify_waitable_entity_id = notify_waitable_.get(); notify_waitable_->set_on_ready_callback( [this, notify_waitable_entity_id](size_t num_events, int waitable_data) { @@ -85,7 +92,7 @@ EventsExecutor::EventsExecutor( // For the same reason, if an event of this type has already been pushed but it has not been // processed yet, we avoid pushing additional events. (void)num_events; - if (notify_waitable_event_pushed_.exchange(true)) { + if (entities_need_rebuild_.exchange(true)) { return; } @@ -93,9 +100,6 @@ EventsExecutor::EventsExecutor( {notify_waitable_entity_id, nullptr, waitable_data, ExecutorEventType::WAITABLE_EVENT, 1}; this->events_queue_->enqueue(event); }); - - this->entities_collector_ = - std::make_shared(notify_waitable_); } EventsExecutor::~EventsExecutor() @@ -229,46 +233,6 @@ EventsExecutor::spin_once_impl(std::chrono::nanoseconds timeout) } } -void -EventsExecutor::add_node( - rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, bool notify) -{ - // This field is unused because we don't have to wake up the executor when a node is added. - (void) notify; - - // Add node to entities collector - this->entities_collector_->add_node(node_ptr); - - this->refresh_current_collection_from_callback_groups(); -} - -void -EventsExecutor::add_node(std::shared_ptr node_ptr, bool notify) -{ - this->add_node(node_ptr->get_node_base_interface(), notify); -} - -void -EventsExecutor::remove_node( - rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, bool notify) -{ - // This field is unused because we don't have to wake up the executor when a node is removed. - (void)notify; - - // Remove node from entities collector. - // This will result in un-setting all the event callbacks from its entities. - // After this function returns, this executor will not receive any more events associated - // to these entities. - this->entities_collector_->remove_node(node_ptr); - - this->refresh_current_collection_from_callback_groups(); -} - -void -EventsExecutor::remove_node(std::shared_ptr node_ptr, bool notify) -{ - this->remove_node(node_ptr->get_node_base_interface(), notify); -} void EventsExecutor::execute_event(const ExecutorEvent & event) @@ -278,10 +242,9 @@ EventsExecutor::execute_event(const ExecutorEvent & event) { rclcpp::ClientBase::SharedPtr client; { - std::lock_guard lock(collection_mutex_); client = this->retrieve_entity( static_cast(event.entity_key), - current_entities_collection_->clients); + current_collection_.clients); } if (client) { for (size_t i = 0; i < event.num_events; i++) { @@ -295,10 +258,9 @@ EventsExecutor::execute_event(const ExecutorEvent & event) { rclcpp::SubscriptionBase::SharedPtr subscription; { - std::lock_guard lock(collection_mutex_); subscription = this->retrieve_entity( static_cast(event.entity_key), - current_entities_collection_->subscriptions); + current_collection_.subscriptions); } if (subscription) { for (size_t i = 0; i < event.num_events; i++) { @@ -311,10 +273,9 @@ EventsExecutor::execute_event(const ExecutorEvent & event) { rclcpp::ServiceBase::SharedPtr service; { - std::lock_guard lock(collection_mutex_); service = this->retrieve_entity( static_cast(event.entity_key), - current_entities_collection_->services); + current_collection_.services); } if (service) { for (size_t i = 0; i < event.num_events; i++) { @@ -334,10 +295,9 @@ EventsExecutor::execute_event(const ExecutorEvent & event) { rclcpp::Waitable::SharedPtr waitable; { - std::lock_guard lock(collection_mutex_); waitable = this->retrieve_entity( static_cast(event.entity_key), - current_entities_collection_->waitables); + current_collection_.waitables); } if (waitable) { for (size_t i = 0; i < event.num_events; i++) { @@ -351,61 +311,12 @@ EventsExecutor::execute_event(const ExecutorEvent & event) } void -EventsExecutor::add_callback_group( - rclcpp::CallbackGroup::SharedPtr group_ptr, - rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, - bool notify) +EventsExecutor::handle_updated_entities(bool notify) { - // This field is unused because we don't have to wake up - // the executor when a callback group is added. (void)notify; - (void)node_ptr; - - this->entities_collector_->add_callback_group(group_ptr); - - this->refresh_current_collection_from_callback_groups(); -} - -void -EventsExecutor::remove_callback_group( - rclcpp::CallbackGroup::SharedPtr group_ptr, bool notify) -{ - // This field is unused because we don't have to wake up - // the executor when a callback group is removed. - (void)notify; - - this->entities_collector_->remove_callback_group(group_ptr); - - this->refresh_current_collection_from_callback_groups(); -} - -std::vector -EventsExecutor::get_all_callback_groups() -{ - this->entities_collector_->update_collections(); - return this->entities_collector_->get_all_callback_groups(); -} - -std::vector -EventsExecutor::get_manually_added_callback_groups() -{ - this->entities_collector_->update_collections(); - return this->entities_collector_->get_manually_added_callback_groups(); -} - -std::vector -EventsExecutor::get_automatically_added_callback_groups_from_nodes() -{ - this->entities_collector_->update_collections(); - return this->entities_collector_->get_automatically_added_callback_groups(); -} - -void -EventsExecutor::refresh_current_collection_from_callback_groups() -{ // Build the new collection - this->entities_collector_->update_collections(); - auto callback_groups = this->entities_collector_->get_all_callback_groups(); + this->collector_.update_collections(); + auto callback_groups = this->collector_.get_all_callback_groups(); rclcpp::executors::ExecutorEntitiesCollection new_collection; rclcpp::executors::build_entities_collection(callback_groups, new_collection); @@ -428,14 +339,14 @@ EventsExecutor::refresh_current_collection( const rclcpp::executors::ExecutorEntitiesCollection & new_collection) { // Acquire lock before modifying the current collection - std::lock_guard lock(collection_mutex_); + std::lock_guard guard(mutex_); - current_entities_collection_->timers.update( + current_collection_.timers.update( new_collection.timers, [this](rclcpp::TimerBase::SharedPtr timer) {timers_manager_->add_timer(timer);}, [this](rclcpp::TimerBase::SharedPtr timer) {timers_manager_->remove_timer(timer);}); - current_entities_collection_->subscriptions.update( + current_collection_.subscriptions.update( new_collection.subscriptions, [this](auto subscription) { subscription->set_on_new_message_callback( @@ -444,7 +355,7 @@ EventsExecutor::refresh_current_collection( }, [](auto subscription) {subscription->clear_on_new_message_callback();}); - current_entities_collection_->clients.update( + current_collection_.clients.update( new_collection.clients, [this](auto client) { client->set_on_new_response_callback( @@ -453,7 +364,7 @@ EventsExecutor::refresh_current_collection( }, [](auto client) {client->clear_on_new_response_callback();}); - current_entities_collection_->services.update( + current_collection_.services.update( new_collection.services, [this](auto service) { service->set_on_new_request_callback( @@ -464,12 +375,12 @@ EventsExecutor::refresh_current_collection( // DO WE NEED THIS? WE ARE NOT DOING ANYTHING WITH GUARD CONDITIONS /* - current_entities_collection_->guard_conditions.update(new_collection.guard_conditions, + current_collection_.guard_conditions.update(new_collection.guard_conditions, [](auto guard_condition) {(void)guard_condition;}, [](auto guard_condition) {guard_condition->set_on_trigger_callback(nullptr);}); */ - current_entities_collection_->waitables.update( + current_collection_.waitables.update( new_collection.waitables, [this](auto waitable) { waitable->set_on_ready_callback( diff --git a/rclcpp/test/rclcpp/executors/test_executors.cpp b/rclcpp/test/rclcpp/executors/test_executors.cpp index a7129d4488..72afee8dda 100644 --- a/rclcpp/test/rclcpp/executors/test_executors.cpp +++ b/rclcpp/test/rclcpp/executors/test_executors.cpp @@ -638,7 +638,7 @@ TYPED_TEST(TestExecutors, testSpinUntilFutureCompleteInterrupted) // and b) refreshing the executor collections. // The inconsistent state would happen if the event was processed before the collections were // finished to be refreshed: the executor would pick up the event but be unable to process it. -// This would leave the `notify_waitable_event_pushed_` flag to true, preventing additional +// This would leave the `entities_need_rebuild_` flag to true, preventing additional // notify waitable events to be pushed. // The behavior is observable only under heavy load, so this test spawns several worker // threads. Due to the nature of the bug, this test may still succeed even if the diff --git a/rclcpp/test/rclcpp/executors/test_static_single_threaded_executor.cpp b/rclcpp/test/rclcpp/executors/test_static_single_threaded_executor.cpp index 1a0f3f88c4..05d0b23152 100644 --- a/rclcpp/test/rclcpp/executors/test_static_single_threaded_executor.cpp +++ b/rclcpp/test/rclcpp/executors/test_static_single_threaded_executor.cpp @@ -56,7 +56,7 @@ TEST_F(TestStaticSingleThreadedExecutor, add_callback_group_trigger_guard_failed "lib:rclcpp", rcl_trigger_guard_condition, RCL_RET_ERROR); RCLCPP_EXPECT_THROW_EQ( executor.add_callback_group(cb_group, node->get_node_base_interface(), true), - std::runtime_error("Failed to trigger guard condition on callback group add: error not set")); + std::runtime_error("Failed to handle entities update on callback group add: error not set")); } } @@ -69,7 +69,7 @@ TEST_F(TestStaticSingleThreadedExecutor, add_node_trigger_guard_failed) { "lib:rclcpp", rcl_trigger_guard_condition, RCL_RET_ERROR); RCLCPP_EXPECT_THROW_EQ( executor.add_node(node), - std::runtime_error("Failed to trigger guard condition on node add: error not set")); + std::runtime_error("Failed to handle entities update on node add: error not set")); } } @@ -87,7 +87,7 @@ TEST_F(TestStaticSingleThreadedExecutor, remove_callback_group_trigger_guard_fai RCLCPP_EXPECT_THROW_EQ( executor.remove_callback_group(cb_group, true), std::runtime_error( - "Failed to trigger guard condition on callback group remove: error not set")); + "Failed to handle entities update on callback group remove: error not set")); } } @@ -115,7 +115,7 @@ TEST_F(TestStaticSingleThreadedExecutor, remove_node_trigger_guard_failed) { "lib:rclcpp", rcl_trigger_guard_condition, RCL_RET_ERROR); RCLCPP_EXPECT_THROW_EQ( executor.remove_node(node, true), - std::runtime_error("Failed to trigger guard condition on node remove: error not set")); + std::runtime_error("Failed to handle entities update on node remove: error not set")); } } diff --git a/rclcpp/test/rclcpp/test_executor.cpp b/rclcpp/test/rclcpp/test_executor.cpp index 668ab96797..21a19cee18 100644 --- a/rclcpp/test/rclcpp/test_executor.cpp +++ b/rclcpp/test/rclcpp/test_executor.cpp @@ -138,7 +138,7 @@ TEST_F(TestExecutor, add_callback_group_failed_trigger_guard_condition) { "lib:rclcpp", rcl_trigger_guard_condition, RCL_RET_ERROR); RCLCPP_EXPECT_THROW_EQ( dummy.add_callback_group(cb_group, node->get_node_base_interface(), true), - std::runtime_error("Failed to trigger guard condition on callback group add: error not set")); + std::runtime_error("Failed to handle entities update on callback group add: error not set")); } TEST_F(TestExecutor, remove_callback_group_null_node) { @@ -175,7 +175,7 @@ TEST_F(TestExecutor, remove_callback_group_failed_trigger_guard_condition) { RCLCPP_EXPECT_THROW_EQ( dummy.remove_callback_group(cb_group, true), std::runtime_error( - "Failed to trigger guard condition on callback group remove: error not set")); + "Failed to handle entities update on callback group remove: error not set")); } TEST_F(TestExecutor, remove_node_not_associated) {