Skip to content

Commit 34c1b3c

Browse files
Tommy PerssonTommy Persson
authored andcommitted
Bug fix for fields in service calls with different names.
Signed-off-by: Tommy Persson <@[email protected]> Signed-off-by: Tommy Persson <[email protected]>
1 parent 4170a04 commit 34c1b3c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

resource/interface_factories.cpp.em

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,20 @@ void ServiceFactory<
317317
auto & @(field["ros2"]["name"])2 = req2.@(field["ros2"]["name"]);
318318
@[ end if]@
319319
@[ if field["basic"]]@
320+
@[ if frm == "1"]@
320321
@(field["ros2"]["name"])@(to) = @(field["ros1"]["name"])@(frm);
322+
@[ else]@
323+
@(field["ros1"]["name"])@(to) = @(field["ros2"]["name"])@(frm);
324+
@[ end if]@
325+
@[ else]@
326+
@[ if frm == "1"]@
327+
Factory<@(field["ros1"]["cpptype"]),@(field["ros2"]["cpptype"])>::convert_@(frm)_to_@(to)(@
328+
@(field["ros1"]["name"])@(frm), @(field["ros2"]["name"])@(to));
321329
@[ else]@
322330
Factory<@(field["ros1"]["cpptype"]),@(field["ros2"]["cpptype"])>::convert_@(frm)_to_@(to)(@
323331
@(field["ros2"]["name"])@(frm), @(field["ros1"]["name"])@(to));
324332
@[ end if]@
333+
@[ end if]@
325334
@[ if field["array"]]@
326335
}
327336
@[ end if]@

ros1_bridge/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,9 @@ def determine_common_services(
607607
ros2_type = str(ros2_fields[direction][i].type)
608608
ros1_name = ros1_field[1]
609609
ros2_name = ros2_fields[direction][i].name
610-
if ros1_type != ros2_type or ros1_name != ros2_name:
610+
# This must be wrong, different name with same type will now be allowed, changing it
611+
#if ros1_type != ros2_type or ros1_name != ros2_name:
612+
if ros1_type != ros2_type:
611613
# if the message types have a custom mapping their names
612614
# might not be equal, therefore check the message pairs
613615
if (ros1_type, ros2_type) not in message_string_pairs:

0 commit comments

Comments
 (0)