Skip to content

Commit 562f36d

Browse files
authored
Reformat with braces added (ros-controls#1209)
1 parent 345e70f commit 562f36d

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

controller_manager/src/controller_manager.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ std::vector<std::string> get_following_controller_names(
150150
}
151151
// If the controller is not configured, return empty
152152
if (!(is_controller_active(controller_it->c) || is_controller_inactive(controller_it->c)))
153+
{
153154
return following_controllers;
155+
}
154156
const auto cmd_itfs = controller_it->c->command_interface_configuration().names;
155157
for (const auto & itf : cmd_itfs)
156158
{
@@ -210,7 +212,10 @@ std::vector<std::string> get_preceding_controller_names(
210212
for (const auto & ctrl : controllers)
211213
{
212214
// If the controller is not configured, then continue
213-
if (!(is_controller_active(ctrl.c) || is_controller_inactive(ctrl.c))) continue;
215+
if (!(is_controller_active(ctrl.c) || is_controller_inactive(ctrl.c)))
216+
{
217+
continue;
218+
}
214219
auto cmd_itfs = ctrl.c->command_interface_configuration().names;
215220
for (const auto & itf : cmd_itfs)
216221
{
@@ -2443,7 +2448,10 @@ bool ControllerManager::controller_sorting(
24432448
if (!((is_controller_active(ctrl_a.c) || is_controller_inactive(ctrl_a.c)) &&
24442449
(is_controller_active(ctrl_b.c) || is_controller_inactive(ctrl_b.c))))
24452450
{
2446-
if (is_controller_active(ctrl_a.c) || is_controller_inactive(ctrl_a.c)) return true;
2451+
if (is_controller_active(ctrl_a.c) || is_controller_inactive(ctrl_a.c))
2452+
{
2453+
return true;
2454+
}
24472455
return false;
24482456
}
24492457

@@ -2455,9 +2463,13 @@ bool ControllerManager::controller_sorting(
24552463
// joint_state_broadcaster
24562464
// If the controller b is also under the same condition, then maintain their initial order
24572465
if (ctrl_b.c->command_interface_configuration().names.empty() || !ctrl_b.c->is_chainable())
2466+
{
24582467
return false;
2468+
}
24592469
else
2470+
{
24602471
return true;
2472+
}
24612473
}
24622474
else if (ctrl_b.c->command_interface_configuration().names.empty() || !ctrl_b.c->is_chainable())
24632475
{
@@ -2467,12 +2479,17 @@ bool ControllerManager::controller_sorting(
24672479
else
24682480
{
24692481
auto following_ctrls = get_following_controller_names(ctrl_a.info.name, controllers);
2470-
if (following_ctrls.empty()) return false;
2482+
if (following_ctrls.empty())
2483+
{
2484+
return false;
2485+
}
24712486
// If the ctrl_b is any of the following controllers of ctrl_a, then place ctrl_a before ctrl_b
24722487
if (
24732488
std::find(following_ctrls.begin(), following_ctrls.end(), ctrl_b.info.name) !=
24742489
following_ctrls.end())
2490+
{
24752491
return true;
2492+
}
24762493
else
24772494
{
24782495
auto ctrl_a_preceding_ctrls = get_preceding_controller_names(ctrl_a.info.name, controllers);
@@ -2505,7 +2522,10 @@ bool ControllerManager::controller_sorting(
25052522

25062523
// If there is no common parent, then they belong to 2 different sets
25072524
auto following_ctrls_b = get_following_controller_names(ctrl_b.info.name, controllers);
2508-
if (following_ctrls_b.empty()) return true;
2525+
if (following_ctrls_b.empty())
2526+
{
2527+
return true;
2528+
}
25092529
auto find_first_element = [&](const auto & controllers_list) -> size_t
25102530
{
25112531
auto it = std::find_if(

controller_manager/test/test_controller_manager_srvs.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,9 @@ TEST_F(TestControllerManagerSrvs, list_sorted_chained_controllers)
639639
{TEST_CHAINED_CONTROLLER_4, TEST_CHAINED_CONTROLLER_3, TEST_CHAINED_CONTROLLER_5,
640640
TEST_CHAINED_CONTROLLER_2, TEST_CHAINED_CONTROLLER_1,
641641
test_controller::TEST_CONTROLLER_NAME})
642+
{
642643
cm_->configure_controller(controller);
644+
}
643645

644646
// get controller list after configure
645647
result = call_service_and_wait(*client, request, srv_executor);
@@ -796,7 +798,9 @@ TEST_F(TestControllerManagerSrvs, list_sorted_complex_chained_controllers)
796798
{TEST_CHAINED_CONTROLLER_4, TEST_CHAINED_CONTROLLER_3, TEST_CHAINED_CONTROLLER_5,
797799
TEST_CHAINED_CONTROLLER_7, TEST_CHAINED_CONTROLLER_2, TEST_CHAINED_CONTROLLER_1,
798800
TEST_CHAINED_CONTROLLER_6, test_controller::TEST_CONTROLLER_NAME})
801+
{
799802
cm_->configure_controller(controller);
803+
}
800804

801805
// get controller list after configure
802806
result = call_service_and_wait(*client, request, srv_executor);
@@ -1010,7 +1014,10 @@ TEST_F(TestControllerManagerSrvs, list_sorted_independent_chained_controllers)
10101014
TEST_CHAINED_CONTROLLER_4, TEST_CONTROLLER_2,
10111015
TEST_CHAINED_CONTROLLER_2, TEST_CHAINED_CONTROLLER_6,
10121016
TEST_CHAINED_CONTROLLER_7, TEST_CHAINED_CONTROLLER_8};
1013-
for (const auto & controller : ctrls_order) cm_->configure_controller(controller);
1017+
for (const auto & controller : ctrls_order)
1018+
{
1019+
cm_->configure_controller(controller);
1020+
}
10141021

10151022
// get controller list after configure
10161023
result = call_service_and_wait(*client, request, srv_executor);

0 commit comments

Comments
 (0)