Skip to content

Commit

Permalink
remove duplicate services and msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Lopez committed Nov 18, 2020
1 parent 596eb40 commit 3dc613a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ros1_bridge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ def get_ros1_messages(rospack=None):
pkgs = sorted(x for x in rosmsg.iterate_packages(rospack, rosmsg.MODE_MSG))
for package_name, path in pkgs:
for message_name in rosmsg._list_types(path, 'msg', rosmsg.MODE_MSG):
msgs.append(Message(package_name, message_name, path))
# iterate_packages might return ROS2 paths for already found ROS1 pkgs
msg = Message(package_name, message_name, path)
if msg not in msgs:
msgs.append(msg)
return msgs


Expand Down Expand Up @@ -626,14 +629,15 @@ def determine_common_services(
'cpptype': ros2_type.rstrip('[]').replace('/', '::msg::')
}
})
if match:
services.append({
service_data = {
'ros1_name': pair[0].message_name,
'ros2_name': pair[1].message_name,
'ros1_package': pair[0].package_name,
'ros2_package': pair[1].package_name,
'fields': output
})
}
if match and service_data not in services:
services.append(service_data)
return services


Expand Down

0 comments on commit 3dc613a

Please sign in to comment.