Skip to content

Commit

Permalink
Properly support ros_args attribute through launch frontends (#253)
Browse files Browse the repository at this point in the history
Signed-off-by: Christophe Bedard <[email protected]>
  • Loading branch information
christophebedard authored Aug 9, 2021
1 parent 83659fd commit 846212e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions launch_ros/launch_ros/actions/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ def parse(cls, entity: Entity, parser: Parser):
args = entity.get_attr('args', optional=True)
if args is not None:
kwargs['arguments'] = super()._parse_cmdline(args, parser)
ros_args = entity.get_attr('ros_args', optional=True)
if ros_args is not None:
kwargs['ros_arguments'] = super()._parse_cmdline(ros_args, parser)
node_name = entity.get_attr('node-name', optional=True)
if node_name is not None:
kwargs['node_name'] = parser.parse_substitution(node_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_launch_frontend_xml():
<let name="a_string" value="\'[2, 5, 8]\'"/>
<let name="a_list" value="[2, 5, 8]"/>
<let name="my_value" value="100"/>
<node pkg="demo_nodes_py" exec="talker_qos" output="screen" name="my_talker" namespace="my_ns" exec_name="my_talker_process" args="--number_of_cycles 1">
<node pkg="demo_nodes_py" exec="talker_qos" output="screen" name="my_talker" namespace="my_ns" exec_name="my_talker_process" args="--number_of_cycles 1" ros_args="--log-level info">
<param name="param1" value="ads"/>
<param name="param_group1">
<param name="param_group2">
Expand Down Expand Up @@ -91,6 +91,7 @@ def test_launch_frontend_yaml():
namespace: my_ns
exec_name: my_talker_process
args: '--number_of_cycles 1'
ros_args: '--log-level info'
param:
- name: param1
value: ads
Expand Down Expand Up @@ -203,6 +204,10 @@ def check_launch_node(file):
assert remappings is not None
assert len(remappings) == 2

talker_node_action = ld.describe_sub_entities()[3]
talker_node_cmd_string = ' '.join(talker_node_action.process_details['cmd'])
assert '--ros-args --log-level info' in talker_node_cmd_string

listener_node_action = ld.describe_sub_entities()[4]
listener_node_cmd = listener_node_action.process_details['cmd']
assert [
Expand Down

0 comments on commit 846212e

Please sign in to comment.