Skip to content

Commit

Permalink
[CM] Optimized debug output about interfaces when switching controlle…
Browse files Browse the repository at this point in the history
…rs. (#1355)

Co-authored-by: Sai Kishor Kothakota <[email protected]>
  • Loading branch information
destogl and saikishor authored Feb 1, 2024
1 parent 26815e8 commit 1104d80
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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](
Expand Down Expand Up @@ -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())
{
Expand Down

0 comments on commit 1104d80

Please sign in to comment.