1. Multi-machine navigation

1. Multi-machine navigation1.1. Introduction1.2. Use1.2.1, start the robot1.2.2, open multi-machine navigation1.2.3, Set the communication topic1.2.4, Set initial pose1.3. launch file1.4, Framework Analysis

1.1. Introduction

For how to configure multi-machine communication and synchronize time, please refer to the [ROS Distributed Communication] lesson; if there is a network, synchronize the network system time directly without setting.

When using multi-machine control, first make sure that the robots are in the same LAN and configure the same [ROS_MASTER_URI]; there can only be one master for multiple robots to control movement. In this section, the virtual machine is set as the master and other robots as slaves. There can be several slaves; of course, you can also set one robot as the master and the others as slaves.

1.2. Use

Case demonstration: A virtual machine is the master and three robots are slaves,a map must be available before use.

1.2.1, start the robot

Virtual machine side

Stop the radar service (robot side - indoor version execution)

Start command (robot1 side), for the convenience of operation, this section takes [chassis + depth camera] as an example.

Start command (robot2 side), for the convenience of operation, this section takes [chassis + depth camera] as an example.

More robots can be deduced in the same way.

1.2.2, open multi-machine navigation

Virtual machine side

image-20240629184422773

After opening the multi-machine navigation, it is a dense mass, and the position of each robot is incorrect. First, the initial position of each robot must be set.

Tip: If my_map error is prompted during startup

The terminal content path of the .yaml file should be changed correctly

1228

1.2.3, Set the communication topic

image-20240629184449077

Right-click on the toolbar (green frame) to pop up a dialog box (red frame), as shown in the figure above, right-click on [2D Pose Estimate], and then select [Tool Properties], as shown in the figure below, a dialog box pops up.

image-20240629184611946

From top to bottom, [2D Pose Estimate] and [2D Nav Goal] correspond to the [rviz] toolbar from left to right. Set the topic name pointed by the red arrow. This method is fast and convenient.

If there are 4 or more robots, the initial pose and navigation icons seem to be insufficient. What should I do?

At this time, you need to open the [navigation_multi.rviz] file (open whichever rviz you use, take [navigation_multi.rviz] as an example) and find the following content. These contents correspond to the icons in the rviz toolbar one by one. If you want to add an icon, copy the entire [Class] content of that icon. Nothing must be missing, and the format must be correct.

1.2.4, Set initial pose

There are too many robots and the information on the map is very complicated. In this case, you can uncheck the check mark behind the robot in the display item list on the left [Displays] and set the pose for each robot in turn. The effect after setting is as follows. You can navigate after setting.

image-20240629184739910

1.3. launch file

You can modify it according to your own needs. If there are 4 or more robots, just add relevant content according to the first 3 cases.

1.4, Framework Analysis

multi2rosgraph

There are a lot of node graphs, which look complicated, but they are actually very organized. The internal nodes of each robot are almost the same, and the navigation of a single robot is also the same. It should be noted here that the map only needs to be loaded once, and it is not necessary to load it for each robot.

multitfframes

There are also a lot of tf coordinate systems, which need to be enlarged. There is only one [map] in the world, and each [amcl] locates each robot separately. From then on, it is the same as the navigation of a single robot.