From d05137d48bba21b079e2819c6b09e642b915fcf1 Mon Sep 17 00:00:00 2001 From: "Dr. Denis" Date: Mon, 4 Dec 2023 19:11:55 +0100 Subject: [PATCH 1/3] [CM] Linting if/else statements --- controller_manager/src/controller_manager.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index 2ff070f7d2..74b1afdd3d 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -2443,7 +2443,10 @@ bool ControllerManager::controller_sorting( if (!((is_controller_active(ctrl_a.c) || is_controller_inactive(ctrl_a.c)) && (is_controller_active(ctrl_b.c) || is_controller_inactive(ctrl_b.c)))) { - if (is_controller_active(ctrl_a.c) || is_controller_inactive(ctrl_a.c)) return true; + if (is_controller_active(ctrl_a.c) || is_controller_inactive(ctrl_a.c)) + { + return true; + } return false; } @@ -2455,9 +2458,13 @@ bool ControllerManager::controller_sorting( // joint_state_broadcaster // If the controller b is also under the same condition, then maintain their initial order if (ctrl_b.c->command_interface_configuration().names.empty() || !ctrl_b.c->is_chainable()) + { return false; + } else + { return true; + } } else if (ctrl_b.c->command_interface_configuration().names.empty() || !ctrl_b.c->is_chainable()) { @@ -2472,7 +2479,9 @@ bool ControllerManager::controller_sorting( if ( std::find(following_ctrls.begin(), following_ctrls.end(), ctrl_b.info.name) != following_ctrls.end()) + { return true; + } else { auto ctrl_a_preceding_ctrls = get_preceding_controller_names(ctrl_a.info.name, controllers); From 059f8fd374e73d122d3b8f345fffb380157053d0 Mon Sep 17 00:00:00 2001 From: Bence Magyar Date: Mon, 11 Dec 2023 18:11:56 +0000 Subject: [PATCH 2/3] Update controller_manager/src/controller_manager.cpp --- controller_manager/src/controller_manager.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index 74b1afdd3d..94bd91fdd0 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -2457,14 +2457,9 @@ bool ControllerManager::controller_sorting( // The case of the controllers that don't have any command interfaces. For instance, // joint_state_broadcaster // If the controller b is also under the same condition, then maintain their initial order - if (ctrl_b.c->command_interface_configuration().names.empty() || !ctrl_b.c->is_chainable()) - { - return false; - } - else - { - return true; - } + const auto command_interfaces_exist = + !ctrl_b.c->command_interface_configuration().names.empty(); + return ctrl_b.c->is_chainable() && command_interfaces_exist; } else if (ctrl_b.c->command_interface_configuration().names.empty() || !ctrl_b.c->is_chainable()) { From 71f3bac64029f0c6529710a061ccbcd07a244998 Mon Sep 17 00:00:00 2001 From: Bence Magyar Date: Tue, 12 Dec 2023 11:59:25 +0000 Subject: [PATCH 3/3] fix format --- controller_manager/src/controller_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index 474828fdd6..da7815d51e 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -2462,8 +2462,8 @@ bool ControllerManager::controller_sorting( // The case of the controllers that don't have any command interfaces. For instance, // joint_state_broadcaster // If the controller b is also under the same condition, then maintain their initial order - const auto command_interfaces_exist = - !ctrl_b.c->command_interface_configuration().names.empty(); + const auto command_interfaces_exist = + !ctrl_b.c->command_interface_configuration().names.empty(); return ctrl_b.c->is_chainable() && command_interfaces_exist; } else if (ctrl_b.c->command_interface_configuration().names.empty() || !ctrl_b.c->is_chainable())