Note: The VM must be in the same LAN as the trolley, and the ROS_DOMAIN_ID must be the same. You can set the IP address and ROS_DOMAIN_ID on the board by referring to the Required Read Before Using the VM.
Connect the car to the agent, run the program, open the [ROS Robot] app downloaded on the mobile phone, enter the IP address of the car, select ROS2, click Connect, and then connect the car. The car can be controlled by sliding the roulette wheel in the interface, and the car can be slowly controlled to complete the area of map construction. At last, click Save map, and the car will save the map currently built.
Take the matching VM as an example, enter the following command to start the agent (the agent can be started once without shutting down, do not need to start again).
#Car agency
sudo docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 8090 -v4
#Camera agent (Start the agent and then turn on the car switch)
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 9999 -v4
Then, open the car switch and wait for the car to connect to the agent. The connection is successful as shown in the figure below,
First start the car to process the underlying data program, terminal input,
xxxxxxxxxx
ros2 launch yahboomcar_bringup yahboomcar_bringup_launch.py
Start the APP drawing command, enter the terminal,
xxxxxxxxxx
# Choose one of the following two drawings
ros2 launch yahboomcar_nav map_gmapping_app_launch.xml
ros2 launch yahboomcar_nav map_cartographer_app_launch.xml
# Make the camera steering level
ros2 run yahboom_esp32_mediapipe control_servo
# Start ESP32 camera
ros2 run yahboom_esp32_camera sub_img
The mobile APP shows the following picture. Enter the IP address of the car, 【zh】 indicates Chinese, 【en】 indicates English; Select ROS2, Video Tpoic select /usb_cam/image_raw/compressed, and click "Connect".
After the connection is successful, the following information is displayed,
By sliding the roulette wheel control car slowly move through the area that needs to be built, then click save map, enter the map name and click submit, you can save the map
Where the map is saved is,
xxxxxxxxxx
/home/yahboom/yahboomcar_ws/src/yahboomcar_nav/maps
This section describes how to start the launch file for creating an APP diagram. The gmapping diagram is used 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>
The following launch files and Node nodes are run: