ROS Multiple Machines - RoBorregos/robocup-home GitHub Wiki
Running ROS across multiple machines
ROS offers to use several computers to run in each nodes that you otherwise would run in a single computer, without changing any code. Here is an overview of that process and outline of what needs to be done.
Overview
The tutorial is at the ROS website. The requirements are to have all computers in the same network, all ports available, and the IP of everyone. There isn't any configuration or adjustment beforehand, you can decide in any moment to use 1, 2, 3, etc. number of machines. Only the terminal variables (i.e. using export) are needed before running a node and for each terminal.
There is a script to setup each computer.
Notes:
- This doesn't seem to work with VM, because others can't even ping it.
Steps
Master
- It does not need to set any variable: MASTER_URInorROS_IP.
- Only to run roscore.
No masters
- To not run roscore.
- Set terminal variable ROS_MASTER_URIwith the master's ip or hostname with the port 11311, i.e.:http://master_host:11311orhttp://ip.ma.st.er:11311
Publishers/talkers
- Also needs to set variable ROS_IPof that computer, i.e.:its.own.i.porits_hostname.
Susbcribers/listeners
- Doesn't need anything.
Hotspot, IPs, and Hostnames
An option is to use one computer (desirable the master) as a hotspot to others machines. Ubuntu enables this option in the WiFi options.
- To set the address of the hotspot (master with roscore) check this to setaddress1, that in general will automatically be the .1 ip.
- To assign by the MAC a static IP to each device check this for the hotspot computer.
- To enable using hostnames instead of the IPs, check the additions to the hostsfile in the hotspot computer here.