[ros2] Fix message duplication caused by bidirectional bridge (not for all rmw implementations) #146
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.
🦟 Bug fix
Fixes #143 (but not for all rmw implementations)
Summary
This PR adds
ignore_local_publications
option to ROS 2 subscriber of the bridge, which should fix duplication of Ignition messages (echoing). However, ROS 2 Design - Node to Participant mapping mentions that this feature is NOT part of all rmw implementations, and unfortunately, this feature is currently not implemented in the default FastRTPS rmw of ROS 2 Foxy. When using other rmw implementations like Cyclone DDS, the issue gets fixed by this PR, otherwise it persists.I am aware that this way of fixing the issue is not robust enough, especially as it requires non-default configuration. If you know of a better solution to this problem, please close this PR. Else the documentation probably needs to be updated a bit.
To try out with FastRTPS (issue persists):
Shell 1:
Shell 2:
Shell 3:
ign topic -t /chatter -m ignition.msgs.StringMsg -p 'data:"This message should be received only once"'
To try out with Cyclone DDS (issue is fixed):
Install Cyclone DDS
Shell 1:
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ros2 run ros_ign_bridge parameter_bridge /chatter@std_msgs/msg/String@ignition.msgs.StringMsg
Shell 2:
Shell 3:
ign topic -t /chatter -m ignition.msgs.StringMsg -p 'data:"This message should be received only once"'
Checklist
Note to maintainers: Remember to use Squash-Merge