Rosanswers logo

Hello everybody,

I have a very basic question regarding multi-robot interaction. How can I make two robots share the same roscore?

My basic job is to interact between two robots via some topic. The multi-robot example given in ROS wiki makes one of the system the workstation and the other the actual robot. What I am really trying is to have a single workstation with multiple robot connected to it to interact via topic. So how is the ROS_MASTER_URI coupled? Also if the robots are sharing the same environment how is data sent to a topic by a robot resolved by the workstation?

I also looked at alternate ways like foreign_relay and it suits my need best. But the documentation in wiki for it is really the heading and nothing else! :( Any pointers on how I could learn more about this would be great. (I am not a network guy so I guess I am having hard time figuring out the code given multimaster experimental package)

Any help regarding this matter would be greatly appreciated!

Originally posted by joy on ROS Answers with karma: 85 on 2013-04-15

Post score: 2


1 Answer 1


Rosanswers logo

If you simply want two robots and one worksstation PC to communicate via network, and you can guarantee full network connectivity at all times between all involved PCs, you don't need multimaster. Instead, you can just use the built-in ROS functionality. There's a tutorial here.

UPDATE1: To avoid name conflicts, you need to remap everything related to a specific robot into a namespace. So robot1 would receive commands on the topic /robot1/cmd_vel, robot2 likewise on the topic /robot2/cmd_vel, and both could exchange messages via some topic, say /shared_topic. The master needs to run on one of those robots (or on an entirely different PC), it doesn't really matter where it runs. The only important thing is that there is exactly one master, and all other PCs connect to it.

Originally posted by Martin Günther with karma: 11816 on 2013-04-17

This answer was ACCEPTED on the original site

Post score: 3

Original comments

Comment by joy on 2013-04-17:
In this tutorial one of them is a workstation and other a turtlebot. The workstation system does'nt function normally like a turtlebot. Say I want to move one turtlebot, then pass message to the other turtlebot(here a workstation) which starts moving after receiving the message.How to do that?

Comment by Martin Günther on 2013-04-18:
I don't think I understood what you want to do exactly. Where the involved PCs are mounted (as a workstation or on a robot) doesn't matter. You can easily run the rosmaster on one turtlebot and connect from the other turtlebot, if you want.

Comment by joy on 2013-04-18:
Sorry let me rephrase. I am trying to share all /topic between two robots. However if one robot acts as master it is not really performing any robot function. Say I pass a value to /cmd_vel how will the robots resolve which needs to move?

Comment by joy on 2013-04-18:
So basically I am trying to co-ordinate movement between two robot by publishing message over /topic. Position of the robots is not important here. Simple message can be communicated but if both robots need to move and if one of them is the master it is not functioning as a normal robot!

Comment by Martin Günther on 2013-04-18:
Okay, now I think I understand. I'll update the answer (UPDATE1).

Comment by joy on 2013-04-18:
Yes this is exactly what I needed. Thank you so much for bearing with me! :)

Comment by Martin Günther on 2013-04-19:
No problem! Nice to see I solved your problem. :-)

Comment by Rafael on 2013-06-11:
Hi, I am trying to implement this to move two turtlebots as well, sorry I am very new, how can I "need to remap everything related to a specific robot into a namespace"? I followed the example in the link, but how can I do roslaunch turtlebot_bringup minimal.launch in both without conflicts?

Comment by Martin Günther on 2013-06-11:
$ ROS_NAMESPACE=turtlebot1 roslaunch turtlebot_bringup minimal.launch

Comment by Rafael on 2013-06-12:
Thank you Martin, I made a follow up questions due that its giving me some errors, but this has helped tremendously.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.