Skip to content

Commit c5e2aa2

Browse files
authored
Fix frontend topic remapping (#111)
* Add frontend remap test Signed-off-by: Jacob Perron <[email protected]> * Pass data_type parameter to remap entity This resolves an issue where frontend remaps are not parsed. Signed-off-by: Jacob Perron <[email protected]>
1 parent f906510 commit c5e2aa2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

launch_ros/launch_ros/actions/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def parse(cls, entity: Entity, parser: Parser):
244244
ns = entity.get_attr('namespace', optional=True)
245245
if ns is not None:
246246
kwargs['node_namespace'] = parser.parse_substitution(ns)
247-
remappings = entity.get_attr('remap', optional=True)
247+
remappings = entity.get_attr('remap', data_type=List[Entity], optional=True)
248248
if remappings is not None:
249249
kwargs['remappings'] = [
250250
(

test_launch_ros/test/test_launch_ros/frontend/test_node_frontend.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
</param>
5757
<param from="{}"/>
5858
<env name="var" value="1"/>
59+
<remap from="foo" to="bar"/>
60+
<remap from="baz" to="foobar"/>
5961
</node>
6062
<node exec="{}" args="-c 'import sys; print(sys.argv[1:])'" node-name="my_listener" namespace="my_ns" output="screen"/>
6163
</launch>
@@ -110,6 +112,11 @@
110112
env:
111113
- name: var
112114
value: '1'
115+
remap:
116+
- from: "foo"
117+
to: "bar"
118+
- from: "baz"
119+
to: "foobar"
113120
- node:
114121
exec: {}
115122
output: screen
@@ -162,6 +169,11 @@ def test_node_frontend(file):
162169
assert param_dict['param_group1.param11'] == ('asd', 'bsd', 'csd')
163170
assert param_dict['param_group1.param12'] == ''
164171

172+
# Check remappings exist
173+
remappings = ld.describe_sub_entities()[2]._Node__remappings
174+
assert remappings is not None
175+
assert len(remappings) == 2
176+
165177
listener_node_action = ld.describe_sub_entities()[3]
166178
listener_node_cmd = listener_node_action.process_details['cmd']
167179
assert [

0 commit comments

Comments
 (0)