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

fix bidirectional bridge looping over the messages with fastdds #79

Open
wants to merge 1 commit into
base: humble
Choose a base branch
from

Conversation

cyrilleberger
Copy link

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) {
Copy link

@AdamGoertz AdamGoertz May 6, 2024

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