From 059f8fd374e73d122d3b8f345fffb380157053d0 Mon Sep 17 00:00:00 2001 From: Bence Magyar Date: Mon, 11 Dec 2023 18:11:56 +0000 Subject: [PATCH] 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()) {