Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized debug output in CM about interfaces when switching controllers. #1355

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:");
destogl marked this conversation as resolved.
Show resolved Hide resolved
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_))
destogl marked this conversation as resolved.
Show resolved Hide resolved
{
if (!resource_manager_->prepare_command_mode_switch(
activate_command_interface_request_, deactivate_command_interface_request_))
Expand Down
Loading