Skip to content

Commit

Permalink
Avoid using a wildcard to specify parameters if possible (#154)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
  • Loading branch information
ivanpauno authored Jun 25, 2020
1 parent 3775aa3 commit 6c1f36a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions launch_ros/launch_ros/actions/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,10 @@ def is_node_name_fully_specified(self):
def _create_params_file_from_dict(self, params):
with NamedTemporaryFile(mode='w', prefix='launch_params_', delete=False) as h:
param_file_path = h.name
# TODO(dhood): clean up generated parameter files.
param_dict = {'/**': {'ros__parameters': params}}
param_dict = {
self.node_name if self.is_node_name_fully_specified() else '/**':
{'ros__parameters': params}
}
yaml.dump(param_dict, h, default_flow_style=False)
return param_file_path

Expand Down
2 changes: 1 addition & 1 deletion test_launch_ros/test/test_launch_ros/actions/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_launch_node_with_parameter_dict(self):
with open(expanded_parameter_files[0], 'r') as h:
expanded_parameters_dict = yaml.load(h, Loader=yaml.FullLoader)
assert expanded_parameters_dict == {
'/**': {
'/my_ns/my_node': {
'ros__parameters': {
'param1': 'param1_value',
'param2': 'param2_value',
Expand Down

0 comments on commit 6c1f36a

Please sign in to comment.