@@ -156,7 +156,9 @@ std::vector<std::string> get_following_controller_names(
156156 }
157157 // If the controller is not configured, return empty
158158 if (!(is_controller_active (controller_it->c ) || is_controller_inactive (controller_it->c )))
159+ {
159160 return following_controllers;
161+ }
160162 const auto cmd_itfs = controller_it->c ->command_interface_configuration ().names ;
161163 for (const auto & itf : cmd_itfs)
162164 {
@@ -216,7 +218,10 @@ std::vector<std::string> get_preceding_controller_names(
216218 for (const auto & ctrl : controllers)
217219 {
218220 // If the controller is not configured, then continue
219- if (!(is_controller_active (ctrl.c ) || is_controller_inactive (ctrl.c ))) continue ;
221+ if (!(is_controller_active (ctrl.c ) || is_controller_inactive (ctrl.c )))
222+ {
223+ continue ;
224+ }
220225 auto cmd_itfs = ctrl.c ->command_interface_configuration ().names ;
221226 for (const auto & itf : cmd_itfs)
222227 {
@@ -2300,7 +2305,10 @@ bool ControllerManager::controller_sorting(
23002305 if (!((is_controller_active (ctrl_a.c ) || is_controller_inactive (ctrl_a.c )) &&
23012306 (is_controller_active (ctrl_b.c ) || is_controller_inactive (ctrl_b.c ))))
23022307 {
2303- if (is_controller_active (ctrl_a.c ) || is_controller_inactive (ctrl_a.c )) return true ;
2308+ if (is_controller_active (ctrl_a.c ) || is_controller_inactive (ctrl_a.c ))
2309+ {
2310+ return true ;
2311+ }
23042312 return false ;
23052313 }
23062314
@@ -2312,9 +2320,13 @@ bool ControllerManager::controller_sorting(
23122320 // joint_state_broadcaster
23132321 // If the controller b is also under the same condition, then maintain their initial order
23142322 if (ctrl_b.c ->command_interface_configuration ().names .empty () || !ctrl_b.c ->is_chainable ())
2323+ {
23152324 return false ;
2325+ }
23162326 else
2327+ {
23172328 return true ;
2329+ }
23182330 }
23192331 else if (ctrl_b.c ->command_interface_configuration ().names .empty () || !ctrl_b.c ->is_chainable ())
23202332 {
@@ -2324,12 +2336,17 @@ bool ControllerManager::controller_sorting(
23242336 else
23252337 {
23262338 auto following_ctrls = get_following_controller_names (ctrl_a.info .name , controllers);
2327- if (following_ctrls.empty ()) return false ;
2339+ if (following_ctrls.empty ())
2340+ {
2341+ return false ;
2342+ }
23282343 // If the ctrl_b is any of the following controllers of ctrl_a, then place ctrl_a before ctrl_b
23292344 if (
23302345 std::find (following_ctrls.begin (), following_ctrls.end (), ctrl_b.info .name ) !=
23312346 following_ctrls.end ())
2347+ {
23322348 return true ;
2349+ }
23332350 else
23342351 {
23352352 auto ctrl_a_preceding_ctrls = get_preceding_controller_names (ctrl_a.info .name , controllers);
@@ -2362,8 +2379,11 @@ bool ControllerManager::controller_sorting(
23622379
23632380 // If there is no common parent, then they belong to 2 different sets
23642381 auto following_ctrls_b = get_following_controller_names (ctrl_b.info .name , controllers);
2365- if (following_ctrls_b.empty ()) return true ;
2366- auto find_first_element = [&](const auto & controllers_list)
2382+ if (following_ctrls_b.empty ())
2383+ {
2384+ return true ;
2385+ }
2386+ auto find_first_element = [&](const auto & controllers_list) -> int64_t
23672387 {
23682388 auto it = std::find_if (
23692389 controllers.begin (), controllers.end (),
0 commit comments