Welcome to PALMSLAM repository
6. APP mapping
ROS Robot App Map Building
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 view the [Expansion Board Parameter Configuration] to set the IP and ROS_DOMAIN_ID on the board.
1. Program Function Description
The car connects to the proxy, runs the program, opens the [ROS Robot] app downloaded on the mobile phone, enters the IP address of the car, selects ROS2, clicks Connect, and the car can be connected. Place the handheld radar in parallel and slowly control the walking area to complete the map building. Finally, click Save Map, and the car will save the current built map.
2. Start and connect the agent
If you are using the factory virtual machine system, you can enter in the terminal:
xxxxxxxxxxsh ~/start_agent_computer.sh
If you are using a third-party virtual machine system, you need to install the docker development environment first, and open the terminal and enter:
xxxxxxxxxx#CarAgencysudo docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 8090 -v4
Then, turn on the car, select the warning level and radar model, and wait for the car to connect to the proxy. The connection is successful as shown in the figure below.

3. Start the program
If it is the Raspberry Pi desktop version and the Jetson Nano desktop version, you need to enter docker in advance and enter the terminal.
xxxxxxxxxxsh ~/ros2_humble.sh
When the following interface appears, it means that you have successfully entered docker.

Then enter in docker separately, (see [Enter the same docker terminal] section)
xxxxxxxxxxros2 launch yahboomcar_bringup yahboomcar_bringup_launch.py #underlying data programros2 launch rf2o_laser_odometry rf2o_laser_odometry.launch.pyros2 launch yahboomcar_nav map_gmapping_app_launch.xmlTake the matching virtual machine as an example, first start the car to process the underlying data program, terminal input,
xxxxxxxxxxros2 launch yahboomcar_bringup yahboomcar_bringup_launch.py
Start the laser odometer, input in the terminal,
xxxxxxxxxxros2 launch rf2o_laser_odometry rf2o_laser_odometry.launch.py

Start the APP map building command, input in the terminal,
xxxxxxxxxxros2 launch yahboomcar_nav map_gmapping_app_launch.xmlThe mobile APP is displayed as shown below. Enter the IP address of the car. [zh] means Chinese and [en] means English. Select ROS2. Select /usb_cam/image_raw/compressed in the Video Tpoic below. Finally, click [Connect].

After successful connection, the display is as follows.

Control the handheld radar to slowly move through the area where the map needs to be built, and then click Save Map. Enter the map name and click Submit to save the map

The map is saved in,
xxxxxxxxxx/home/yahboom/yahboomcar_ws/src/yahboomcar_nav/maps

4. Code analysis
Here is the launch file for opening the APP map, taking gmapping map as an example,
map_gmapping_app_launch.xml
xxxxxxxxxx<launch> <include file="$(find-pkg-share rosbridge_server)/launch/rosbridge_websocket_launch.xml"/> <node name="laserscan_to_point_publisher" pkg="laserscan_to_point_publisher" exec="laserscan_to_point_publisher"/> <include file="$(find-pkg-share yahboomcar_nav)/launch/map_gmapping_launch.py"/> <include file="$(find-pkg-share robot_pose_publisher_ros2)/launch/robot_pose_publisher_launch.py"/> <include file="$(find-pkg-share yahboom_app_save_map)/yahboom_app_save_map.launch.py"/></launch>Here are several launch files and nodes:
- rosbridge_websocket_launch.xml: Open rosbridge service related nodes. After startup, you can connect to ROS through the network
- laserscan_to_point_publisher: Publish the point cloud conversion of the radar to the APP for visualization
- map_gmapping_launch.py: gmapping map building program
- robot_pose_publisher_launch.py: Car pose publishing program, car pose is visualized in the APP
- yahboom_app_save_map.launch.py: program for saving maps