Communication Setup
This page covers the configuration of ROS MASTER and MULTIMASTER, along with instructions on connecting to Wi-Fi using the terminal
Ros Master
First we setup the commnunication between the computers. In this one computer is master and remaining computers are slave.
Setup
First connect all the computers in the same network. Every computer will have their IP assigned in the network in the subnet mask of 24. Check the IP all computer by typing ifconfig in the terminal. Note the IP of the master computer. Run the following command in all the slave computer.
Now, Every computer should also export their own IP. Type the following command in every computer.
To check everything is setup, type the following commands.
Now, everything is established. You can now run the roscore on the master computer. Now you can run nodes on computer and view their topics on any computer.
Example
I am running talker on one computer
Check on others computer if this node is running by typing rosnode list . This will show talker node running.
Now you can run listener on other computer to see the talker message.
Firewall should be disabled on all the computer for proper communication setup.
You can check it by following command
This should show inactive. But if it is active, then you have to disable it by following command.
Multimaster fkie
This is different from ROS Master in a way that in this multiple masters are running and are communicating with each other.
Master running on same computer(host)
In this we start two ROS master on the same host using different ROS_MASTER_URI. Then we start the synchronization to let rostopic pub and rostopic echo communicate together.
Setup the environment
In the first console we start the ROS master and an example publisher, which publish Hello World to topic with name /test/topic:
In the second console we start a second ROS master and a rostopic echo to receive the Hello World messages:
At this moment, no topic is being published on the master at localhost:11312 so rostopic echo command shouldn't print any topic.
Download the Required Packages
Multi-master Synchronization
On the 1st console in the previous section, run the following code
Do exactly the same on the 2nd console:
Now both ROS masters are synchronized, and the 2nd console should start printing the message ('Hello World') being published on the ROS master at localhost:11311 on the 1st console.
Master running on different computers(hosts)
In this we will start two ROS masters on two different hosts
First, we will make sure we have the correct settings enabled. After that we will register the hostnames of the machines so that the two hosts can identify each other.
Enable the network settings
We will need to make sure two settings are working: IP forwarding and multicasting should be enabled. We can check if IP forwarding is enabled by executing the following command in a console on both hosts:
If this command returns 1 then IP forwarding is enabled. If it is not you can temporarily enable it using:
To find out whether multicasting is enabled you can execute the following command:
If this command returns 0 then multicasting is enabled. If it is not you can temporarily enable it using:
Now you can test the network setup utilizing the code from the first example on two machines. The nodes should be able to discover each other but a warning is expected: "Master discovered with not known hostname". You cannot yet send messages from one host to the other.
Set the necessary hostname information
Linux keeps a file that contains information on the IP addresses that the computer can connect to and their respective hostnames. This file can be found under /etc/hosts. The warning that we got in the previous subsection told us that the computer found an IP address for which no host was set. We will do that now.
You can discover the hostname of a computer and the corresponding IP address by executing the following commands:
Now we need to specify the IP and corresponding hostname in each host for the other host. Simply add a line to the /etc/hosts file in each host containing the IP address and the hostname seperated by a tab (you will need administrator rights for this).
Running the aforementioned commands should now allow you to send messages from one host to the other!
Connecting to WiFi through terminal
Check Your Wireless Interface Name
First, we need to identify the network devices that we are going to use to connect to our wifi network. We can list our interfaces with the following command
Interface should be like that starts with "wlan" or "wlp1s0". This is your wireless interface name.
Now check the WiFi radio status with the following command.
This should show enabled. If this is disabled then enable it by
You can check the status of your network interface cards with
If your wifi card is hard blocked on your Laptop/Computer, you need to execute the following commands and repeat the above steps
Scan For Available Wifi Networks
We need to scan for available wifi networks with which we can connect to
or
This should list out the names of all the available wifi networks around you.
Connect To The Wifi Network
You can connect to a network simply by the following command
or
Last updated