ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS2 message duplicates

asked 2022-06-02 06:39:53 -0600

Mihai D gravatar image

updated 2022-06-03 04:10:49 -0600

ljaniec gravatar image

Hello,

I am sending messages from a node, receiving them in another.

The message type is custom containing 4 float32 values.

I am sending using a QoS that contains "reliable".

Problem is, I am sending different values and receiving the same value over and over again for some time, then it changes, then again a lot of duplicates, etc.

In the attached 5 sec video you can see the sender and the receiver, they run in sync, simply printing out the message sent/received. The received message contains the duplicated values.

https://youtu.be/nWg6YaYQrPY

How is this possible, what could be wrong?

Thanks,

Mihai

edit retag flag offensive close merge delete

Comments

hard to tell without code. Can you provide a minimal working example?

CroCo gravatar image CroCo  ( 2022-06-02 07:25:40 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-06-02 09:18:41 -0600

ljaniec gravatar image

updated 2022-06-03 02:39:46 -0600

QoS "reliable" means according to the documentation:

Reliability

  • Best effort: attempt to deliver samples, but may lose them if the network is not robust.

  • Reliable: guarantee that samples are delivered, may retry multiple times.


EDIT: That's not true, check @Mihai D and @gvdhoorn comments. I misunderstood the documentation.

This is what you observed here.


Do you have a Header in your messages? You could check the metadata to filter out repeated messages, using e.g.

# sequence ID: consecutively increasing ID 
uint32 seq

Maybe you could use a message_filters package to do it?

https://github.com/ros2/message_filters


@Mihai D Can you provide a minimal working example of your code? With this problem of overwriting values in messages that are NOT duplicates.

edit flag offensive delete link more

Comments

1

The problem is I receive the exact number of messages I send. So there are no duplicates received, it is just the data fields in the messages that are somehow changed. Instead of receiving each individual value I send, I receive the same value over and over again, until at some point it changes, then I receive that value for some time, etc. The intermediate values are "overwritten" by some value to which the system is stuck for some time, that is my biggest problem.

Thanks,

Mihai

Mihai D gravatar image Mihai D  ( 2022-06-03 01:39:24 -0600 )edit
1

Afaik, reliable QoS should not result in multiple message duplicates getting delivered to the application.

The "may retry multiple times" part describes the behaviour of the DDS layer. The application should still only see a single instance of a message.

gvdhoorn gravatar image gvdhoorn  ( 2022-06-03 02:03:27 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-06-02 06:39:53 -0600

Seen: 466 times

Last updated: Jun 03 '22