Skip to content

Commit

Permalink
Fix frontend topic remapping (#111)
Browse files Browse the repository at this point in the history
* Add frontend remap test

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Pass data_type parameter to remap entity

This resolves an issue where frontend remaps are not parsed.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron authored Jan 6, 2020
1 parent f906510 commit c5e2aa2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion launch_ros/launch_ros/actions/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def parse(cls, entity: Entity, parser: Parser):
ns = entity.get_attr('namespace', optional=True)
if ns is not None:
kwargs['node_namespace'] = parser.parse_substitution(ns)
remappings = entity.get_attr('remap', optional=True)
remappings = entity.get_attr('remap', data_type=List[Entity], optional=True)
if remappings is not None:
kwargs['remappings'] = [
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
</param>
<param from="{}"/>
<env name="var" value="1"/>
<remap from="foo" to="bar"/>
<remap from="baz" to="foobar"/>
</node>
<node exec="{}" args="-c 'import sys; print(sys.argv[1:])'" node-name="my_listener" namespace="my_ns" output="screen"/>
</launch>
Expand Down Expand Up @@ -110,6 +112,11 @@
env:
- name: var
value: '1'
remap:
- from: "foo"
to: "bar"
- from: "baz"
to: "foobar"
- node:
exec: {}
output: screen
Expand Down Expand Up @@ -162,6 +169,11 @@ def test_node_frontend(file):
assert param_dict['param_group1.param11'] == ('asd', 'bsd', 'csd')
assert param_dict['param_group1.param12'] == ''

# Check remappings exist
remappings = ld.describe_sub_entities()[2]._Node__remappings
assert remappings is not None
assert len(remappings) == 2

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

0 comments on commit c5e2aa2

Please sign in to comment.