ROS Robot APP mapping

Note: The virtual machine needs to be in the same LAN as the car, and the ROS_DOMAIN_ID needs to be consistent. You can check [Must read before use] to set the IP and ROS_DOMAIN_ID on the board.

1. Program function description

The car connects to the agent, runs the program, opens the [ROS Robot] app downloaded on the mobile phone, enters the IP address of the car, selects ROS2, and clicks connect to connect to the car. You can control the car by sliding the wheel on the interface, and slowly control the car to complete the mapped area. Finally, click Save Map, and the car will save the currently constructed map.

2. Start and connect to the agent

Taking the supporting virtual machine as an example, enter the following command to start the agent:

image-20240102120120341

Then, turn on the car switch and wait for the car to connect to the agent. The connection is successful, as shown in the figure below.

image-20231219100456522

3. Start the program

First, start the car to process the underlying data program and enter the terminal.

image-20231219101637748

Start the APP mapping command and enter it in the terminal,

The mobile APP displays as shown below, enter the IP address of the car, [zh] means Chinese, [en] means English; select ROS2, the Video Tpoic below can be selected at will, and finally click [Connect]

image-20231219143224710

After successful connection, the following is displayed:

image-20231219143427091

Use the sliding wheel to control the car to move slowly through the area that needs to be mapped, then click to save the map, enter the map name and click submit to save the map.

image-20231219143658951

The location where the map is saved is,

image-20231219143847102

4. Code analysis

Here is an explanation of the launch file that opens the APP mapping, taking gmapping mapping as an example.

map_gmapping_app_launch.xml

The following launch files and nodes are run here: