Apply automatic mapping rules in case only package+message mapping exists #382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In
determine_field_mapping
, there was an early return inside a loop over all mapping rules. If there were any mapping rules but they don't specify field mappings, the early return made the function return without creating field mappings automatically.For a particular message type, ROS 1's uuid_msgs/UniqueID vs ROS 2's unique_identifier_msgs/UUID, the message definition is exactly the same but type name is not. The only mapping rule defined for
unique_identifier_msgs/UUID
is that it maps touuid_msgs/UniqueID
, but no field mappings are needed because the definitions are the same: https://github.com/ros2/unique_identifier_msgs/blob/rolling/mapping_rules.yamlBut, then we hit the early return (because the for-loop is ran without any rule applying to the message at hand and thus not
continue
-ing in a code branch handling a rule) and return without applying the normal automatic field mapping generation rules.By removing the early return, the other rules are applied and the mapping rules for handling the exact same message definitions are applied.
This fixes the issue found in ros2/unique_identifier_msgs#25 in
ros1_bridge
instead ofunique_identifier_msgs
This PR applies to
foxy
because I combine it with Noetic and can test only that combo, but the early return causing this issue is still there on the main branch: https://github.com/ros2/ros1_bridge/blob/master/ros1_bridge/__init__.py#L788