From 1104d80d8958288bebb29ce067feec4880c53a4b Mon Sep 17 00:00:00 2001 From: "Dr. Denis" Date: Thu, 1 Feb 2024 20:46:05 +0100 Subject: [PATCH] [CM] Optimized debug output about interfaces when switching controllers. (#1355) Co-authored-by: Sai Kishor Kothakota --- controller_manager/src/controller_manager.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index 9b9b0dcf8f..4becabb0a4 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -877,14 +877,15 @@ controller_interface::return_type ControllerManager::switch_controller( strictness = controller_manager_msgs::srv::SwitchController::Request::BEST_EFFORT; } - RCLCPP_DEBUG(get_logger(), "Switching controllers:"); + RCLCPP_DEBUG(get_logger(), "Activating controllers:"); for (const auto & controller : activate_controllers) { - RCLCPP_DEBUG(get_logger(), "- Activating controller '%s'", controller.c_str()); + RCLCPP_DEBUG(get_logger(), " - %s", controller.c_str()); } + RCLCPP_DEBUG(get_logger(), "Deactivating controllers:"); for (const auto & controller : deactivate_controllers) { - RCLCPP_DEBUG(get_logger(), "- Deactivating controller '%s'", controller.c_str()); + RCLCPP_DEBUG(get_logger(), " - %s", controller.c_str()); } const auto list_controllers = [this, strictness]( @@ -1222,6 +1223,17 @@ controller_interface::return_type ControllerManager::switch_controller( return controller_interface::return_type::OK; } + RCLCPP_DEBUG(get_logger(), "Request for command interfaces from activating controllers:"); + for (const auto & interface : activate_command_interface_request_) + { + RCLCPP_DEBUG(get_logger(), " - %s", interface.c_str()); + } + RCLCPP_DEBUG(get_logger(), "Release of command interfaces from deactivating controllers:"); + for (const auto & interface : deactivate_command_interface_request_) + { + RCLCPP_DEBUG(get_logger(), " - %s", interface.c_str()); + } + if ( !activate_command_interface_request_.empty() || !deactivate_command_interface_request_.empty()) {