2 Multi-machine navigation

2.1 Introduction

For the problem of how to configure multi-machine communication and synchronization time, please refer to the lesson [Multi-machine handle control] for details; if there is a network, the network system time can be directly synchronized without setting.

When using multi-machine handle control, it is first necessary to ensure that the robot is under the same local area network and configured with the same [ROS_MASTER_URI]; for multiple robots to control motion, there can only be one host. The example in this section sets the virtual machine as the host, and other robots as the slaves. There are several slaves. Of course, you can also set one robot as the master and others as the slaves.

According to different models, you only need to set the purchased model in [.bashrc], X1(ordinary four-wheel drive) X3(Mike wheel) X3plus(Mike wheel mechanical arm) R2(Ackerman differential) and so on. Section takes X3 as an example

Open the [.bashrc] file

Find the [ROBOT_TYPE] parameter and modify the corresponding model

2.2 use

Take the virtual machine as the host and the three robots as slaves as an example; a map must be available before use.

1.2.1 Turn on the robot

virtual machine side

Start the command(robot1 side), for the convenience of operation, this section takes [mono + laser + yahboomcar] as an example.

Start command(robot2 side), for the convenience of operation, this section takes [mono + laser + yahboomcar] as an example.

More bots and so on.

1.2.2 Enable multi-machine navigation

For the process of opening the handle control, please refer to the lesson [Multi-machine handle control].

virtual machine side

image-20220303102707202

After the multi-machine navigation is turned on, it is densely packed, and the pose of each robot is incorrect. First, set the initial pose for each robot.

1.2.3 Set the communication topic

image-20220303103526172

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

image-20220303103719432

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

What if there are 4 or more robots and the initial pose and navigation icons seem to be insufficient?

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

1.2.4 Set the initial pose

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

image-20220303103345297

2.3 launch file

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

2.4 frame analysis

1225

There are a lot of node graphs, which look complicated, but are actually very organized. The internal nodes are almost the same for each robot, as is the navigation for a single robot. It should be noted here that the map loading only needs to be loaded once, and every robot does not need to be loaded. At the same time, I also opened the node controlled by the handle. One handle controls multiple robots at the same time, and only needs to start the [joy_node] node once.

1226

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