ros2 topic lose data in reliable mode

asked 2022-12-08 20:48:46 -0500

gazeboxu gravatar image

Hello, there. We recently are tortured by a stupid problem for days. We need help from you.

We use ROS2 topic to send command and get response, so we need the messages(command and response) not be dropped (or must be delivered successfully). Of course we use a reliable QoS, but unluck, we did encounter data lose. Our detail use scenario like this, suppose we have one master and two salves, we want a command to send to all the slaves, we need each slave send back the corresponding response, if the master can not get all responses, it will not forward.

Firstly, we doubt the bottom dds has problem, so we modified a fast dds example to do a test, one publisher send messages to two subscribers very quickly, we do observe message lose when use KEEP_LAST_HISTORY_QOS, after some investigation, we knew this behavior is reasonable as https://www.rti.com/blog/top-10-reaso... Number 2 said. After switching to KEEP_ALL_HISTORY_QOS, we do not observe message lose. And when switched to ROS2 topic, the test result is same. But because as I said above, we use a send ,wait and send mode, we think this should not be our case.

The test program is on github( https://github.com/GazeboXu/cpp_pubsu... ). there is a macro in file pubsub.hpp TEST4REAL controls whether use real mode(send and wait). When in real mode, firstly run two slaves(ros2 run cpp_pubsub listener node1. ros 2 run cpp_pubsub listener node2), then run a master(ros2 run cpp_subpub talker 2). eventually, the output will stop, you will find some messages didn't receive by some nodes). It looks like if when one publisher and some subscribers, the message will not lose, but if many publishers and many subcsribers, the message will lose.

Any advices will be appreciated!

edit retag flag offensive close merge delete

Comments

It seems this bug disappeared on the new release -- "ROS 2 Humble Hawksbill - Patch Release 2".

gazeboxu gravatar image gazeboxu  ( 2023-01-30 20:51:36 -0500 )edit