Welcome to ROSMASTER A1 repository
2.Multi-vehicle navigation
Multi-vehicle navigation
1. Program Description
This function allows you to assign two cars different navigation points in RVIZ. The two cars will plan routes based on their respective positions on the map and navigate to the designated locations, avoiding obstacles in real time.
1.1. Functional Requirements
For more information, please refer to [12.Multi-vehicle Course] -- [1.Multi-vehicle control] -- [1.1. Functional Requirements]
1.2. Navigation Map
Before starting a multi-car platoon, you need to place the map file on the mainboard or in a virtual machine.
xxxxxxxxxx~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/yahboomcar.yaml~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/yahboomcar.pgm
The map file includes a .yaml parameter file and a .pgm image file.
Note: Both cars require the same map file
2. Program Startup
Using the Raspberry Pi 5 as an example, due to performance issues, a virtual machine is required for visualization.
The virtual machine must be on the same local area network as both robots, and the ROS_DOMAIN_ID must be set to the same for both robots. Modify the contents of ~/.bashrc and refresh the environment variables after the modification.
For Raspberry Pi and Jetson-Nano boards, open a terminal on the host machine and enter the command to enter the Docker container. Once inside the Docker container, enter the commands mentioned in this lesson in the terminal. For instructions on entering the Docker container from the host machine, refer to [01. Robot Configuration and Operation Guide] -- [5.Enter Docker (For JETSON Nano and RPi 5)].
For Orin boards, simply open a terminal and enter the commands mentioned in this lesson.
This example uses two robots, Robot1 and Robot2. Please place them nearby in advance to ensure smooth network connectivity. This example requires a high data transfer rate.
2.1. Starting Chassis Data
On Robot1, open the terminal and enter the following command to start chassis data fusion, including radar data, filtered IMU and ODOM data, and EKF fusion.
xxxxxxxxxxros2 launch yahboomcar_multi A1_laser_bringup_multi_launch.xml robot_name:=robot1

Similarly, on Robot2, open the terminal and enter the following command to start chassis data fusion.
xxxxxxxxxxros2 launch yahboomcar_multi A1_laser_bringup_multi_launch.xml robot_name:=robot2

2.2. Launching rviz and Publishing Map Data
In the virtual machine configured for multi-machine communication, open a terminal and enter the following command to launch rviz.
xxxxxxxxxxros2 launch yahboomcar_multi display_multi_nav_launch.py
After launching, the image below appears.

Then launch the map loading program. The default map launched is yahboomcar.yaml, and the file path is:
xxxxxxxxxx~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/yahboomcar.yaml
Enter the following command in the terminal to launch (you only need to load the map service in one robot's terminal).
xxxxxxxxxxros2 launch yahboomcar_multi map_server_launch.py

Next, on the virtual machine, our rviz visualization loads the created map.
(Due to network issues, the map may not be transferred to the virtual machine. Press Ctrl+C to shut it down and then restart the map loading service.)

2.3. Start AMD positioning
Open the terminal on robot1 and enter the following command to start AMD positioning.
xxxxxxxxxxros2 launch yahboomcar_multi A1_amcl_robot1_launch.py

Open the terminal on the robot2 car