Single roscore and common networks

The simplest method to establish communication between different machines in the same network is through network configurations. Let's consider the example here:

Communicating between different machines in the same network

Let's assume this example is an Industry 4.0 use case. The robot has a compute that is responsible for its control and mobility operations and the robot shares its status and health to the server compute, which analyzes the robot's health and helps predict the possible failure of an event or the robot itself. Both the robot and server computes are in the same network.

For ROS to understand and communicate between both of them, let's assume that the server compute is the master compute. Hence, the roscore would run on the server compute and the robot compute would provide any necessary topic information to this ROS master. To achieve this, you would need to set up a hostname and IP for each compute individually to help differentiate both and help them communicate with each other. Assuming that the server compute is 192.168.1.1 and the robot compute is 192.168.1.2, and roscore is run on the server compute and the robot compute to connect to it, set up the following environment variables in each compute system:

In the server compute, use the following commands:

$ export ROS_MASTER_URI=http://192.168.1.1:11311
$ export ROS_IP=http://192.168.1.1

In the robot compute, use the following commands:

$ export ROS_MASTER_URI=http://192.168.1.1:11311
$ export ROS_IP=http://192.168.1.2

So, what did we do here? We set ROS_MASTER_URI to the server compute's IP and are connecting other computes (such as our robot compute) so that they connect to that specific ROS master. Also, to help us differentiate between the computes, we set explicit names for the computes through the ROS_IP environment variable.

You could also use ROS_HOSTNAME instead of ROS_IP, with the robot's name defined as an entry in /etc/hosts. Refer to the example at http://www.faqs.org/docs/securing/chap9sec95.html to learn how to set up robot names.

You could copy the preceding environment variable entries into their respective bash files to avoid recalling the variables every time a new Terminal is opened.

There is a possibility of timing issues and topic synchronization from occurring, and you may sometimes see a TF warning about extrapolation in the future. These are usually a result of a possible mismatch in system times across the computes.

You can verify this by using ntpdate, which can be installed using the following command:

$ sudo apt install ntpdate

Run the following command to test the date of the other compute:

$ ntpdate -q 192.168.1.2

In the case of discrepancies, you could install chrony using the following command:

$ sudo apt install chrony

You can edit the configuration file of the robot compute to get its time from the server compute by making the following change in /etc/chrony/chrony.conf:

$ server 192.168.1.1 minpoll 0 maxpoll 5 maxdelay .05
Take a look at https://chrony.tuxfamily.org/manual.html for more information.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.218.215