dora icon indicating copy to clipboard operation
dora copied to clipboard

ros2 bridge missing some data between C++ node

Open bobd988 opened this issue 1 year ago • 1 comments

Using the main branch to run ros2 pub/sub examples and some messages lost between C++ dora node with ros2 bridge style

image

One dora mode publish message and another dora node receive message, however from receiver node not all messages received.

image

bobd988 avatar Apr 20 '24 16:04 bobd988

This seems related to https://github.com/jhelovuo/ros2-client/issues/25. Messages send at the beginning might be lost because it takes a bit until ROS2 creates the connection. You can avoid this by choosing reliable QoS settings. In the linked issue, the following settings were recommened:

If you want to receive samples published before the match was made, use e.g. the following QoS:

let reliable_qos = ros2::QosPolicyBuilder::new()
      .history(policy::History::KeepLast { depth: 10 })
      .reliability(policy::Reliability::Reliable {
        max_blocking_time: ros2::Duration::from_millis(100),
      })
      .durability(policy::Durability::TransientLocal)
      .build();

Important elements here are Reliable, TransientLocal, and some reasonable History depth.

and

You need to set reliability = Reliable at both Publisher and Subscriber.

Could you try this?

phil-opp avatar Apr 21 '24 12:04 phil-opp