In this tutorial, we will show you how to configure many rovers in one network, so that they will see each other and will communicate.
In such setup, we need every rover, to have its own robot namespace for ROS nodes and topics, and only one ROS master. We also need to connect all the rovers to the same network, and know their IP addresses.
Once all rovers are connected to the same network, we can start configuring them.
First, we need to know the IP address of the rover in the network with all other rovers. To get it, you have to connect to the rover via ssh, and type in the terminal
This will show addresses assigned to all network interfaces, we just need to check the correct interface. If you didn't make many changes to the network setup before, then you need to find the wlan_int interface (if you did some changes and don't have this interface, you need to find the interface connected to the network). There, you can find the address next to inet tag.
You need to remember or write somewhere this address.
Now, we need to configure some environment variables. We can do this by changing the setup.bash file in the /etc/ros directory. To do so, type:
Here, we need to change a few things:
We also need to change the robot.urdf.xacro file in the /etc/ros/urdf directory. If we don't make changes in this file, all rovers will have the same tf frames, which will give some error readings when doing something with tf tree. To edit it, type
In this file, you need to provide the link_prefix variable. This way we will have distinct tf trees for every rover, as the frames will have the prefix. You can set it to the same value that you gave to ROS_NAMESPACE environment variable. You can find the link_prefix variable inside xacro:leo tag.
In the previous paragraph, we were making changes required for working tf tree, but those changes were not enough. We also need to change the robot.launch file in /etc/ros directory, to make it work correctly. To edit it, type
In this file, we include another launch file. The included launch file has ros argument tf_frame_prefix, so we can set it here in the <include> tag, to our value. To add it, you need to include this line in the file:
Your robot.launch file in the end should look like this: