Skip to content

Commit b9d30d8

Browse files
Remove deprecations from CLI and controller_manager (#948)
Co-authored-by: Bence Magyar <[email protected]>
1 parent a676d3c commit b9d30d8

File tree

7 files changed

+12
-102
lines changed

7 files changed

+12
-102
lines changed

controller_manager/controller_manager/spawner.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,6 @@ def main(args=None):
156156
action="store_true",
157157
required=False,
158158
)
159-
parser.add_argument(
160-
"--stopped",
161-
help="Load and configure the controller, however do not activate them",
162-
action="store_true",
163-
required=False,
164-
)
165159
parser.add_argument(
166160
"--inactive",
167161
help="Load and configure the controller, however do not activate them",
@@ -298,7 +292,7 @@ def main(args=None):
298292
node.get_logger().error("Failed to configure controller")
299293
return 1
300294

301-
if not args.stopped and not args.inactive:
295+
if not args.inactive:
302296
ret = switch_controllers(
303297
node, controller_manager_name, [], [controller_name], True, True, 5.0
304298
)
@@ -313,8 +307,6 @@ def main(args=None):
313307
+ prefixed_controller_name
314308
+ bcolors.ENDC
315309
)
316-
elif args.stopped:
317-
node.get_logger().warn('"--stopped" flag is deprecated use "--inactive" instead')
318310

319311
if not args.unload_on_kill:
320312
return 0
@@ -324,7 +316,7 @@ def main(args=None):
324316
while True:
325317
time.sleep(1)
326318
except KeyboardInterrupt:
327-
if not args.stopped and not args.inactive:
319+
if not args.inactive:
328320
node.get_logger().info("Interrupt captured, deactivating and unloading controller")
329321
ret = switch_controllers(
330322
node, controller_manager_name, [controller_name], [], True, True, 5.0
@@ -335,9 +327,6 @@ def main(args=None):
335327

336328
node.get_logger().info("Deactivated controller")
337329

338-
elif args.stopped:
339-
node.get_logger().warn('"--stopped" flag is deprecated use "--inactive" instead')
340-
341330
ret = unload_controller(node, controller_manager_name, controller_name)
342331
if not ret.ok:
343332
node.get_logger().error("Failed to unload controller")

controller_manager/doc/userdoc.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,23 @@ There are two scripts to interact with controller manager from launch files:
8181
.. code-block:: console
8282
8383
$ ros2 run controller_manager spawner -h
84-
usage: spawner [-h] [-c CONTROLLER_MANAGER] [-p PARAM_FILE] [--load-only] [--stopped] [-t CONTROLLER_TYPE] [-u]
84+
usage: spawner [-h] [-c CONTROLLER_MANAGER] [-p PARAM_FILE] [-n NAMESPACE] [--load-only] [--inactive] [-t CONTROLLER_TYPE] [-u]
8585
[--controller-manager-timeout CONTROLLER_MANAGER_TIMEOUT]
8686
controller_name
8787
8888
positional arguments:
8989
controller_name Name of the controller
9090
91-
optional arguments:
91+
options:
9292
-h, --help show this help message and exit
9393
-c CONTROLLER_MANAGER, --controller-manager CONTROLLER_MANAGER
9494
Name of the controller manager ROS node
9595
-p PARAM_FILE, --param-file PARAM_FILE
9696
Controller param file to be loaded into controller node before configure
97+
-n NAMESPACE, --namespace NAMESPACE
98+
Namespace for the controller
9799
--load-only Only load the controller and leave unconfigured.
98-
--stopped Load and configure the controller, however do not start them
100+
--inactive Load and configure the controller, however do not activate them
99101
-t CONTROLLER_TYPE, --controller-type CONTROLLER_TYPE
100102
If not provided it should exist in the controller manager namespace
101103
-u, --unload-on-kill Wait until this application is interrupted and unload controller

controller_manager/src/controller_manager.cpp

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,46 +1521,10 @@ void ControllerManager::switch_controller_service_cb(
15211521
std::lock_guard<std::mutex> guard(services_lock_);
15221522
RCLCPP_DEBUG(get_logger(), "switching service locked");
15231523

1524-
// response->ok = switch_controller(
1525-
// request->activate_controllers, request->deactivate_controllers, request->strictness,
1526-
// request->activate_asap, request->timeout) == controller_interface::return_type::OK;
1527-
// TODO(destogl): remove this after deprecated fields are removed from service and use the
1528-
// commented three lines above
1529-
// BEGIN: remove when deprecated removed
1530-
auto activate_controllers = request->activate_controllers;
1531-
auto deactivate_controllers = request->deactivate_controllers;
1532-
1533-
if (!request->start_controllers.empty())
1534-
{
1535-
RCLCPP_WARN(
1536-
get_logger(),
1537-
"'start_controllers' field is deprecated, use 'activate_controllers' field instead!");
1538-
activate_controllers.insert(
1539-
activate_controllers.end(), request->start_controllers.begin(),
1540-
request->start_controllers.end());
1541-
}
1542-
if (!request->stop_controllers.empty())
1543-
{
1544-
RCLCPP_WARN(
1545-
get_logger(),
1546-
"'stop_controllers' field is deprecated, use 'deactivate_controllers' field instead!");
1547-
deactivate_controllers.insert(
1548-
deactivate_controllers.end(), request->stop_controllers.begin(),
1549-
request->stop_controllers.end());
1550-
}
1551-
1552-
auto activate_asap = request->activate_asap;
1553-
if (request->start_asap)
1554-
{
1555-
RCLCPP_WARN(
1556-
get_logger(), "'start_asap' field is deprecated, use 'activate_asap' field instead!");
1557-
activate_asap = request->start_asap;
1558-
}
1559-
1560-
response->ok = switch_controller(
1561-
activate_controllers, deactivate_controllers, request->strictness, activate_asap,
1562-
request->timeout) == controller_interface::return_type::OK;
1563-
// END: remove when deprecated removed
1524+
response->ok =
1525+
switch_controller(
1526+
request->activate_controllers, request->deactivate_controllers, request->strictness,
1527+
request->activate_asap, request->timeout) == controller_interface::return_type::OK;
15641528

15651529
RCLCPP_DEBUG(get_logger(), "switching service finished");
15661530
}

controller_manager_msgs/srv/SwitchController.srv

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@
2121

2222
string[] activate_controllers
2323
string[] deactivate_controllers
24-
string[] start_controllers # DEPRECATED: Use activate_controllers filed instead
25-
string[] stop_controllers # DEPRECATED: Use deactivate_controllers filed instead
2624
int32 strictness
2725
int32 BEST_EFFORT=1
2826
int32 STRICT=2
29-
bool start_asap # DEPRECATED: Use activate_asap filed instead
3027
bool activate_asap
3128
builtin_interfaces/Duration timeout
3229
---

ros2controlcli/ros2controlcli/verb/load_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ def main(self, *, args):
5050
if not response.ok:
5151
return "Error configuring controller"
5252

53-
# TODO(destogl): remove in humble+
54-
if args.set_state == "start":
55-
print('Setting state "start" is deprecated "activate" instead!')
56-
args.set_state == "activate"
57-
5853
if args.set_state == "active":
5954
response = switch_controllers(
6055
node, args.controller_manager, [], [args.controller_name], True, True, 5.0

ros2controlcli/ros2controlcli/verb/set_controller_state.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ def main(self, *, args):
5858
# # print(f'successfully cleaned up {args.controller_name}')
5959
# return 0
6060

61-
if args.state == "configure":
62-
args.state = "inactive"
63-
print('Setting state "configure" is deprecated, use "inactive" instead!')
64-
65-
if args.state == "stop":
66-
args.state = "inactive"
67-
print('Setting state "stop" is deprecated, use "inactive" instead!')
68-
6961
if args.state == "inactive":
7062
if matched_controller.state == "unconfigured":
7163
response = configure_controller(
@@ -93,10 +85,6 @@ def main(self, *, args):
9385
f"from its current state {matched_controller.state}"
9486
)
9587

96-
if args.state == "start":
97-
args.state = "active"
98-
print('Setting state "start" is deprecated, use "active" instead!')
99-
10088
if args.state == "active":
10189
if matched_controller.state != "inactive":
10290
return (

ros2controlcli/ros2controlcli/verb/switch_controllers.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,13 @@ class SwitchControllersVerb(VerbExtension):
2626

2727
def add_arguments(self, parser, cli_name):
2828
add_arguments(parser)
29-
arg = parser.add_argument(
30-
"--stop",
31-
nargs="*",
32-
default=[],
33-
help="Name of the controllers to be deactivated",
34-
)
35-
arg.completer = LoadedControllerNameCompleter(["active"])
3629
arg = parser.add_argument(
3730
"--deactivate",
3831
nargs="*",
3932
default=[],
4033
help="Name of the controllers to be deactivated",
4134
)
4235
arg.completer = LoadedControllerNameCompleter(["active"])
43-
arg = parser.add_argument(
44-
"--start",
45-
nargs="*",
46-
default=[],
47-
help="Name of the controllers to be activated",
48-
)
49-
arg.completer = LoadedControllerNameCompleter(["inactive"])
5036
arg = parser.add_argument(
5137
"--activate",
5238
nargs="*",
@@ -55,7 +41,6 @@ def add_arguments(self, parser, cli_name):
5541
)
5642
arg.completer = LoadedControllerNameCompleter(["inactive"])
5743
parser.add_argument("--strict", action="store_true", help="Strict switch")
58-
parser.add_argument("--start-asap", action="store_true", help="Start asap controllers")
5944
parser.add_argument("--activate-asap", action="store_true", help="Start asap controllers")
6045
parser.add_argument(
6146
"--switch-timeout",
@@ -67,24 +52,14 @@ def add_arguments(self, parser, cli_name):
6752
add_controller_mgr_parsers(parser)
6853

6954
def main(self, *, args):
70-
if args.stop:
71-
print('"--stop" flag is deprecated, use "--deactivate" instead!')
72-
args.deactivate = args.stop
73-
if args.start:
74-
print('"--start" flag is deprecated, use "--activate" instead!')
75-
args.activate = args.start
76-
if args.start_asap:
77-
print('"--start-asap" flag is deprecated, use "--activate-asap" instead!')
78-
args.activate_asap = args.start_asap
79-
8055
with NodeStrategy(args) as node:
8156
response = switch_controllers(
8257
node,
8358
args.controller_manager,
8459
args.deactivate,
8560
args.activate,
8661
args.strict,
87-
args.start_asap,
62+
args.activate_asap,
8863
args.switch_timeout,
8964
)
9065
if not response.ok:

0 commit comments

Comments
 (0)