Skip to content

Commit aeea81a

Browse files
committed
Update print list
1 parent f50a7dd commit aeea81a

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ repos:
8585
entry: ament_cpplint
8686
language: system
8787
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
88-
args: ["--linelength=100", "--filter=-whitespace/newline"]
88+
args: ["--linelength=100", "--filter=-whitespace/newline,-readability/fn_size"]
8989

9090
# Cmake hooks
9191
- repo: local

controller_manager/src/controller_manager.cpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,14 @@ controller_interface::return_type ControllerManager::switch_controller_cb(
15061506
? "AUTO"
15071507
: "FORCE_AUTO"));
15081508

1509+
RCLCPP_INFO_EXPRESSION(
1510+
get_logger(), !activate_controllers.empty(),
1511+
fmt::format("Activating controllers: [ {} ]", fmt::join(activate_controllers, " ")).c_str());
1512+
RCLCPP_INFO_EXPRESSION(
1513+
get_logger(), !deactivate_controllers.empty(),
1514+
fmt::format("Deactivating controllers: [ {} ]", fmt::join(deactivate_controllers, " "))
1515+
.c_str());
1516+
15091517
const auto list_controllers =
15101518
[this, strictness, &strictness_string](
15111519
const std::vector<std::string> & controller_list, std::vector<std::string> & request_list,
@@ -1526,7 +1534,7 @@ controller_interface::return_type ControllerManager::switch_controller_cb(
15261534
is_activate
15271535
? controller_chain_dependency_graph_.get_dependencies_to_activate(controller)
15281536
: controller_chain_dependency_graph_.get_dependencies_to_deactivate(controller);
1529-
RCLCPP_INFO(
1537+
RCLCPP_DEBUG(
15301538
get_logger(), fmt::format(
15311539
"Controller {} has '{}' dependencies to {}", controller,
15321540
fmt::join(ctrl_dependencies, ", "), action)
@@ -1598,12 +1606,17 @@ controller_interface::return_type ControllerManager::switch_controller_cb(
15981606
return ret;
15991607
}
16001608

1609+
const bool print_updated_list =
1610+
(strictness != controller_manager_msgs::srv::SwitchController::Request::AUTO ||
1611+
strictness != controller_manager_msgs::srv::SwitchController::Request::FORCE_AUTO);
16011612
RCLCPP_INFO_EXPRESSION(
1602-
get_logger(), !activate_request_.empty(),
1603-
fmt::format("Activating controllers: [ {} ]", fmt::join(activate_request_, " ")).c_str());
1613+
get_logger(), !activate_request_.empty() && print_updated_list,
1614+
fmt::format("Updated Activating controllers: [ {} ]", fmt::join(activate_request_, " "))
1615+
.c_str());
16041616
RCLCPP_INFO_EXPRESSION(
1605-
get_logger(), !deactivate_request_.empty(),
1606-
fmt::format("Deactivating controllers: [ {} ]", fmt::join(deactivate_request_, " ")).c_str());
1617+
get_logger(), !deactivate_request_.empty() && print_updated_list,
1618+
fmt::format("Updated Deactivating controllers: [ {} ]", fmt::join(deactivate_request_, " "))
1619+
.c_str());
16071620

16081621
// If it is a best effort switch, we can remove the controllers log that could not be activated
16091622
message.clear();
@@ -4412,16 +4425,16 @@ void ControllerManager::build_controllers_topology_info(
44124425
}
44134426
for (const auto & [controller_name, controller_chain] : controller_chain_spec_)
44144427
{
4415-
RCLCPP_INFO(
4428+
RCLCPP_DEBUG(
44164429
get_logger(), "Controller '%s' has %ld following controllers and %ld preceding controllers.",
44174430
controller_name.c_str(), controller_chain.following_controllers.size(),
44184431
controller_chain.preceding_controllers.size());
4419-
RCLCPP_INFO_EXPRESSION(
4432+
RCLCPP_DEBUG_EXPRESSION(
44204433
get_logger(), !controller_chain.following_controllers.empty(),
44214434
fmt::format(
44224435
"\tFollowing controllers are : {}", fmt::join(controller_chain.following_controllers, ", "))
44234436
.c_str());
4424-
RCLCPP_INFO_EXPRESSION(
4437+
RCLCPP_DEBUG_EXPRESSION(
44254438
get_logger(), !controller_chain.preceding_controllers.empty(),
44264439
fmt::format(
44274440
"\tPreceding controllers are : {}", fmt::join(controller_chain.preceding_controllers, ", "))

0 commit comments

Comments
 (0)