Introduction

ROS is a distributed software framework. Nodes are combined by loose coupling. In many application scenarios, nodes can run on different computing platforms and communicate through topic and service. However, only one master is allowed in ROS. In a multi machine system, a master can only run on one machine. Other machines need to contact the master through SSH. Therefore, some configuration is required in the multi machine ROS system.

Usage

We took a drone and a computer equipped with Ubuntu operating system for testing. (the user name of the UAV onboard host is Ubuntu, and the user name of the personal computer is handsfree)


It is necessary to ensure that the system version of the UAV onboard host is consistent with the Ubuntu version of the personal computer, that is, to ensure that the ROS version is consistent. After our test, if the ROS version is inconsistent, although communication can be achieved, there will be many problems in the actual operation.


Nodes can run on different computing platforms. Only one master node is allowed in ROS. In a multi machine system, the master node can only run on one machine. We take the onboard host (hereinafter referred to as the onboard host) of the UAV as the operating location of the master node. Before starting the configuration, make sure that both devices are connected to the same LAN.


The first step is to obtain the IP address of the airborne host We can use the following command in the terminal to obtain the IP address of the airborne host:

ifconfig

master ifconfig After running this command, you can get the IP address of the airborne host as 192.168.3.161 Then, enter the following in the ~ /. Bashrc file:

export ROS_MASTER_URI=http://192.168.3.161:11311
export ROS_IP=192.168.3.161

master_communication_setup

(the two lines in the above figure are annotated. The user needs to cancel the annotation and change the IP address to the corresponding IP address during use.) Where: ROS_MASTER_URI is the IP address of the master node in the multi machine communication system, ROS_IP is the IP address of the current device.

Then let's operate the personal computer. Similarly, first use the ifconfig command to obtain the IP address of the personal computer The obtained IP address is 192.168.3.179 Then, enter the following in the ~ /. Bashrcfile:

export ROS_MASTER_URI=http://192.168.3.161:11311
export ROS_IP=192.168.3.179

ros_sub_settings ROS_MASTER_URI is IP address of the master node, so it is' 192.168.3.161 ', ROS_IP is the local IP, i.e. 192.168.3.179

After setting, please use the following command in the home directory to make the setting effective:

cd
source .bashrc

This completes the setting of ROS multi machine communication

测试

ROS multi machine communication enables all devices in the multi machine communication system to share resources. Let's test it. After connecting the two devices to the same LAN and completing the steps in the above settings, we can perform the following tests.

First, start roscore in the airborne host start_up_ros_master After that, we use the rostpoic command in the terminal of the personal computer sub_ros_topic_01 You can see that the topics published in the master node can be received. After that, start the radar of the UAV master_start_up_lidar Let's check the rostatic of the PC again` sub_ros_topic_02
Subscribe to the radar topics published in the Master node on the personal computer subscribe_lidar_scan sub_receive_lidar_scan_data

It can be seen that the personal computer can normally receive the data released under the topic of /scan of the UAV.

Users can use the function of ROS multi machine communication to conduct data interaction among multiple devices

results matching ""

    No results matching ""