Are messages sent once per node or once per subscriber?
Hi! My question is related but not identical to this.
If there are N subscribers in one node on Machine A, that are all listening to the same publisher from Machine B over Wifi, how are the messages handled exactly?
- Is one message being transmitted over Wifi and duplicated N times locally on Machine A?
- Are N messages being transmitted over Wifi?
- If N messages are being transmitted, does this mean the publisher has to serialize the same message N times?
In ROS1, connections are peer-to-peer. I believe, option 2 is definitely Yes. About Option 3, i am not sure of implementation.
For question 3, see rospy's publish behavior and roscpp's publish behavior (they are slightly different).
This seems to be a duplicate of #q289237.
From that answer:
this corresponds to my own understanding and the
roscpp
documentation forNodeHandle::subscribe(..)
, which mentionsshared_ptr
s passed to callbacks must not be used to change the incoming msg.This answer focuses on
roscpp
of course. But @JunTuck has not specified which client library he/she's using.