Skip to content

fix bidirectional bridge looping over the messages with fastdds - #79

Open
cyrilleberger wants to merge 1 commit into
ros2:humblefrom
cyrilleberger:fix-bidirectional
Open

fix bidirectional bridge looping over the messages with fastdds#79
cyrilleberger wants to merge 1 commit into
ros2:humblefrom
cyrilleberger:fix-bidirectional

Conversation

@cyrilleberger

Copy link
Copy Markdown

When using fastdds (default in humble), and using a bidirectional topic bridge, the same message keep been sent over and over. This is because the behavior of ignore_local_publications is different between fastdds and cyclonedds, this is was reported to rmw_fastrtps in ros2/rmw_fastrtps#573. To fix this problem, I made a change in domain_bridge to make sure that the message we receive from a subscriber do not come from a publisher owned by the bridge. This fix the problem of sending the same message over and over.

bool has_publisher_with_gid(const rmw_gid_t & _publisher_gid)
{
for (auto it = bridged_topics_.begin(); it != bridged_topics_.end(); ++it) {
if (*it->second.first->get_base_publisher() == _publisher_gid) {

@AdamGoertz AdamGoertz May 6, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this, we were having problems with this issue and this PR helped us. I noticed one issue when we tried using this; we got a segmentation fault on this line. I haven't looked into the root cause, but adding this patch fixed the issue.

Suggested change
if (*it->second.first->get_base_publisher() == _publisher_gid) {
if (it->second.first && *it->second.first->get_base_publisher() == _publisher_gid) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants