Skip to content

Commit

Permalink
Optimized debug output in CM about interfaces when switching controll…
Browse files Browse the repository at this point in the history
…ers.
  • Loading branch information
destogl committed Feb 1, 2024
1 parent 26815e8 commit d03f295
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 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,8 +1223,19 @@ controller_interface::return_type ControllerManager::switch_controller(
return controller_interface::return_type::OK;
}

if (
!activate_command_interface_request_.empty() || !deactivate_command_interface_request_.empty())
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(), "Request for command interfaces from deactivating controllers:");
for (const auto & interface : deactivate_command_interface_request_)
{
RCLCPP_DEBUG(get_logger(), " - %s", interface.c_str());
}

if (!resource_manager_->prepare_command_mode_switch(
activate_command_interface_request_, deactivate_command_interface_request_))
{
if (!resource_manager_->prepare_command_mode_switch(
activate_command_interface_request_, deactivate_command_interface_request_))
Expand Down

0 comments on commit d03f295

Please sign in to comment.