Determine message origin in a multirobot environment
Hi! I'm pretty new to ROS (noetic) and I'm currently trying to run the AMCL localization algorithm in an environment where multiple robots have to communicate between each other. Because of this, we have a single roscore acting as an intermediary between multiple robots and robots themselves publish messages in topics that are shared between the group. My problem is: how can a robot tell that a specific message is for him (or from him)?
Example: two robots are running AMCL nodes and do only computations for themselves. Both publish their laser scans to the /scan topic, but how can their respective AMCL node tell which data to use? How can I be sure that robot1 is not using the laser scan from robot2?
Sorry if the question is trivial, but I think that the header message could cover this problem, but apparently it doesn't.
Quick comment:
for this specifically, you'd use namespacing.
Each robot has its own namespace, and topics are looked up relative to the namespace a node is in.
You mention having multiple robots, so I would expect you're already using namespaces to make that possible.
One thing you should avoid is publishing to
/scan
. Instead, publish toscan
. Otherwise namespacing can't work.That's perfect! Thank you!