From 17ec65f0ef6f300342331ab3cdacb3bf536759ea Mon Sep 17 00:00:00 2001 From: Sai Kishor Kothakota Date: Wed, 16 Oct 2024 14:45:26 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Bence Magyar --- .../include/controller_manager/controller_manager.hpp | 2 +- controller_manager/src/controller_manager.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/controller_manager/include/controller_manager/controller_manager.hpp b/controller_manager/include/controller_manager/controller_manager.hpp index d54a441b49..273b48b022 100644 --- a/controller_manager/include/controller_manager/controller_manager.hpp +++ b/controller_manager/include/controller_manager/controller_manager.hpp @@ -424,7 +424,7 @@ class ControllerManager : public rclcpp::Node const std::vector & controllers, int strictness, const ControllersListIterator controller_it); - /// The methood to check if the fallback controllers of the given controllers are in the right + /// Checks if the fallback controllers of the given controllers are in the right /// state, so they can be activated immediately /** * \param[in] controllers is a list of controllers to activate. diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index 49844d1041..72cebaa1e5 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -2409,10 +2409,11 @@ controller_interface::return_type ControllerManager::update( } if (!failed_controllers_list.empty()) { + const auto FALLBACK_STACK_MAX_SIZE = 500; std::vector active_controllers_using_interfaces(failed_controllers_list); - active_controllers_using_interfaces.reserve(500); + active_controllers_using_interfaces.reserve(FALLBACK_STACK_MAX_SIZE); std::vector cumulative_fallback_controllers; - cumulative_fallback_controllers.reserve(500); + cumulative_fallback_controllers.reserve(FALLBACK_STACK_MAX_SIZE); for (const auto & failed_ctrl : failed_controllers_list) {