Skip to content

Commit

Permalink
Bug fix for fields in service calls with different names.
Browse files Browse the repository at this point in the history
Signed-off-by: Tommy Persson <@[email protected]>
  • Loading branch information
Tommy Persson committed Mar 22, 2022
1 parent fe94cf5 commit b9c8200
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions resource/interface_factories.cpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,20 @@ void ServiceFactory<
auto & @(field["ros2"]["name"])2 = req2.@(field["ros2"]["name"]);
@[ end if]@
@[ if field["basic"]]@
@[ if frm == "1"]@
@(field["ros2"]["name"])@(to) = @(field["ros1"]["name"])@(frm);
@[ else]@
@(field["ros1"]["name"])@(to) = @(field["ros2"]["name"])@(frm);
@[ end if]@
@[ else]@
@[ if frm == "1"]@
Factory<@(field["ros1"]["cpptype"]),@(field["ros2"]["cpptype"])>::convert_@(frm)_to_@(to)(@
@(field["ros1"]["name"])@(frm), @(field["ros2"]["name"])@(to));
@[ else]@
Factory<@(field["ros1"]["cpptype"]),@(field["ros2"]["cpptype"])>::convert_@(frm)_to_@(to)(@
@(field["ros2"]["name"])@(frm), @(field["ros1"]["name"])@(to));
@[ end if]@
@[ end if]@
@[ if field["array"]]@
}
@[ end if]@
Expand Down
4 changes: 3 additions & 1 deletion ros1_bridge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,9 @@ def determine_common_services(
ros2_type = str(ros2_fields[direction][i].type)
ros1_name = ros1_field[1]
ros2_name = ros2_fields[direction][i].name
if ros1_type != ros2_type or ros1_name != ros2_name:
# This must be wrong, different name with same type will now be allowed, changing it
#if ros1_type != ros2_type or ros1_name != ros2_name:
if ros1_type != ros2_type:
# if the message types have a custom mapping their names
# might not be equal, therefore check the message pairs
if (ros1_type, ros2_type) not in message_string_pairs:
Expand Down

0 comments on commit b9c8200

Please sign in to comment.