Can we ensure subscribing order same as publishing order in ROS given multiple publishers on a same topic?
Suppose I have two publishers P1 and P2 that publish a same topic M, which is received by two other subscribers S1 and S2, is there a way to ensure that both subscribers will receive M messages in a same order as published from P1 and P2? For example, if P1 publishes a M message and after some time P2 publishes another M message, is it possible to guarantee that both S1 and S2 will receive the M message from P1 and then the one from P2? My understanding is that this can be generally hard to ensure in a message-passing based distributed system. Thanks for any answering or clarification!
This reads a little like a homework question.
Can you give a little more context and clarify why you are asking this?
I am a PhD student working on autonomous vehicle (AV) security. I used this example to simplify my question for ease of understanding. I am working on a ROS-based autonomous vehicle system that relies on ROS pub-sub messaging model to interact between self-driving modules, including P1, P2, S1, S2
does "a same topic M" means that the name and type of topic is same?
Yes, "a same topic M" means that the name and type of topic are same.