Skip to content

Commit 9c969e9

Browse files
committed
aplly suggestions from code review
1 parent 96aaf9a commit 9c969e9

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

controller_manager/controller_manager/hardware_spawner.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2023 PAL Robotics S.L.
2+
# Copyright 2023 Stogl Robotics Consulting UG (haftungsbeschränkt)
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -157,7 +157,6 @@ def main(args=None):
157157
"hardware_component_name",
158158
help="The name of the hardware component which should be activated.",
159159
)
160-
161160
parser.add_argument(
162161
"-c",
163162
"--controller-manager",
@@ -173,13 +172,13 @@ def main(args=None):
173172
type=int,
174173
)
175174

175+
# add arguments which are mutually exclusive
176176
activate_or_confiigure_grp.add_argument(
177177
"--activate",
178178
help="Activates the given components. Note: Components are by default configured before activated. ",
179179
action="store_true",
180180
required=False,
181181
)
182-
183182
activate_or_confiigure_grp.add_argument(
184183
"--configure",
185184
help="Configures the given components.",
@@ -195,15 +194,14 @@ def main(args=None):
195194
activate = args.activate
196195
configure = args.configure
197196

198-
print(type(hardware_component))
199-
200197
node = Node("hardware_spawner")
201198
if not controller_manager_name.startswith("/"):
202199
spawner_namespace = node.get_namespace()
203200
if spawner_namespace != "/":
204201
controller_manager_name = f"{spawner_namespace}/{controller_manager_name}"
205202
else:
206203
controller_manager_name = f"/{controller_manager_name}"
204+
207205
try:
208206
if not wait_for_controller_manager(
209207
node, controller_manager_name, controller_manager_timeout
@@ -216,10 +214,11 @@ def main(args=None):
216214
elif configure:
217215
configure_components(node, controller_manager_name, hardware_component)
218216
else:
219-
node.get_logger().warn("Something went wrong.")
217+
node.get_logger().error(
218+
'You need to either specify if the hardware component should be activated with the "--activate" flag or configured with the "--configure" flag'
219+
)
220220
parser.print_help()
221221
return 0
222-
223222
finally:
224223
rclpy.shutdown()
225224

controller_manager/src/controller_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ void ControllerManager::init_resource_manager(const std::string & robot_descript
230230
{
231231
RCLCPP_WARN_STREAM(
232232
get_logger(),
233-
"[Deprecated]: Automatic activation of all components will not be supported in the future "
234-
"anymore. Use hardware_spawner instead.");
233+
"[Deprecated]: Automatic activation of all hardware components will not be supported in the "
234+
"future anymore. Use hardware_spawner instead.");
235235
resource_manager_->activate_all_components();
236236
}
237237
}

0 commit comments

Comments
 (0)