Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When generating service mappings cast pair to set to avoid duplicate pairs #268

Merged
merged 2 commits into from
May 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ros1_bridge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,17 +562,20 @@ def determine_common_services(
for rule in mapping_rules:
for ros1_srv in ros1_srvs:
for ros2_srv in ros2_srvs:
pair = (ros1_srv, ros2_srv)
if pair in pairs:
continue
if rule.ros1_package_name == ros1_srv.package_name and \
rule.ros2_package_name == ros2_srv.package_name:
if rule.ros1_service_name is None and rule.ros2_service_name is None:
if ros1_srv.message_name == ros2_srv.message_name:
pairs.append((ros1_srv, ros2_srv))
pairs.append(pair)
else:
if (
rule.ros1_service_name == ros1_srv.message_name and
rule.ros2_service_name == ros2_srv.message_name
):
pairs.append((ros1_srv, ros2_srv))
pairs.append(pair)

for pair in pairs:
ros1_spec = load_ros1_service(pair[0])
Expand Down