Skip to content

Commit 313e3c8

Browse files
authored
Add new strictness modes to SwitchController service (#2224) (#2231)
1 parent 916c4c0 commit 313e3c8

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

controller_manager/src/controller_manager.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,22 @@ controller_interface::return_type ControllerManager::switch_controller_cb(
13761376
? controller_manager_msgs::srv::SwitchController::Request::STRICT
13771377
: controller_manager_msgs::srv::SwitchController::Request::BEST_EFFORT;
13781378
}
1379+
else if (strictness == controller_manager_msgs::srv::SwitchController::Request::AUTO)
1380+
{
1381+
RCLCPP_WARN(
1382+
get_logger(),
1383+
"Controller Manager: AUTO is not currently implemented. "
1384+
"Defaulting to BEST_EFFORT");
1385+
strictness = controller_manager_msgs::srv::SwitchController::Request::BEST_EFFORT;
1386+
}
1387+
else if (strictness == controller_manager_msgs::srv::SwitchController::Request::FORCE_AUTO)
1388+
{
1389+
RCLCPP_DEBUG(
1390+
get_logger(),
1391+
"Controller Manager: FORCE_AUTO is not currently implemented. "
1392+
"Defaulting to BEST_EFFORT");
1393+
strictness = controller_manager_msgs::srv::SwitchController::Request::BEST_EFFORT;
1394+
}
13791395

13801396
std::string activate_list, deactivate_list;
13811397
activate_list.reserve(500);

controller_manager_msgs/srv/SwitchController.srv

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,20 @@
99
# * STRICT means that switching will fail if anything goes wrong (an invalid
1010
# controller name, a controller that failed to activate, etc. )
1111
# * BEST_EFFORT means that even when something goes wrong with on controller,
12-
# the service will still try to activate/stop the remaining controllers
12+
# the service will still try to activate/deactivate the remaining controllers
13+
# * AUTO means that the controller manager will automatically resolve the controller
14+
# chain in order to activate and/or deactivate the specified controllers.
15+
# This is useful in complex systems when you want all dependent controllers to start
16+
# within the same update iteration.
17+
# * FORCE_AUTO means that the controller manager will take all necessary steps to activate
18+
# the specified controllers without requiring you to explicitly list the controllers
19+
# to be deactivated. This is useful when the controller being activated depends on
20+
# another unknown controller that is currently running. The controller manager will
21+
# deactivate any controllers that block the activation of the requested controller,
22+
# following the mutually exclusive joint interface switching principle. For example,
23+
# to activate a controller that uses a joint's position interface, the controller manager
24+
# will automatically deactivate any controllers that use conflicting interfaces for
25+
# the same joint.
1326
# * activate the controllers as soon as their hardware dependencies are ready, will
1427
# wait for all interfaces to be ready otherwise
1528
# * the timeout before aborting pending controllers. Zero for infinite
@@ -25,6 +38,8 @@ string[] deactivate_controllers
2538
int32 strictness
2639
int32 BEST_EFFORT=1
2740
int32 STRICT=2
41+
int32 AUTO=3
42+
int32 FORCE_AUTO=4
2843
bool activate_asap
2944
builtin_interfaces/Duration timeout
3045
---

0 commit comments

Comments
 (0)