d-ORCA: Setting up ROS Networks
ROS Network Setup
ROS is a distributed computing environment. A running ROS system can comprise dozens, even hundreds of nodes, spread across multiple machines. Depending on how the system is configured, any node may need to communicate with any other node, at any time.
As a result, ROS has certain requirements of the network configuration:
- There must be complete, bi-directional connectivity between all pairs of machines, on all ports.
- Each machine must advertise itself by a name that all other machines can resolve.
Inorder to establish a ROS network it is neccessary to connect all the machines(agents) to a wireless network. Once connected retrieve the IP address of each machine connected to the network and ping each other using the following command to verify the existence of other machines and the latency in the network.
ping <IP address>
For example, if two machines are connected to a wireless network and they have 192.168.1.1 and 192.168.1.2 as their respective IP address, then pinging 192.168.1.1 from 192.168.1.2 should give the following results
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=63 time=1.868 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=2.677 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=1.659 ms
If they are not in the same network you should get the following results
PING 192.168.1.1 (192.168.1.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
In such a case, make sure the machines are connected to the same network before proceeding.
Note : The d-ORCA package in its current version supports only low latency networks. So make sure the time field in the ping results is less than 10 ms. If not, try to improve it by making sure the machines are in the range of the network and there is no interference in the reception of the wireless signal.
Once the existence of IP address and the latency of the network is verified, we need to configure one machine to run the master which handles message passing in the established network. To do this, use the IP address of the machine, that has to be configured as the master, in the following command.
export ROS_MASTER_URI=http://<IP address>:11311
This command has to be run in every machine to make it aware of master’s IP. It is also necessary to make each machine addressable within ROS interface by its IP address. This can be done by using the IP address of the corresponding machine in the following command.
export ROS_IP=<IP address>
Note: There can only be 1 master in a network that uses a particular port for message passing (default port number is 11311 in ROS). Hence, all the machine should be configured with the same master for it to be able to listen to messages in the network. On the other hand, the ROS IP for each machine is distinct.
Assuming that ROS_MASTER_URI and ROS_IP are set in every machine run the following commands to verify if all the machines in the network are able to listen to the messages passed in the network.
Run the following command in the master.
roscore
And then run the following command in the other machines.
rostopic list
You should see the following results in the terminal
/rosout
/rosout_agg
If you see something like the following it means that the machine is not aware of the master. Try setting the ROS_MASTER_URI again and make sure you are able to listen to the messages before proceeding.
ERROR: Unable to communicate with master!