Welcome to ROSMASTER R2 repository
8. Rosmaster_R2 using the app to build maps
Rosmaster_ R2 uses APP to mapping
Quick to use tutorial
1、Rosmaster_ R2 power on
Turn on the power ofR2, as shown in the following figure, and turn it to the ON direction.。

Connecting to the network can be visualized through the R2's built-in touch screen display, connecting to WiFi within the local area network
2、Open the shell tool to connect to Rosmaster_ R2
Note: The IP address used during the writing of this tutorial is 192.168.2.102. The username is: jetson, and the password is: yahboom. The actual IP address used in this tutorial shall prevail.
Open the shell tool, and the shell tool I am using here is FinalShell. Enter information such as username, password, port, and connection name.

The connection steps are as follows:




3. Start ROSBridge and web service
For Raspberry Pi PI5 controller, you need to enter the docker container first. For Orin controller, you do not need to enter the docker and do not need to do these four steps. You can just run the command directly.
Enter the command in the terminal to create a docker environment.
~/run_docker.sh
Then enter the command:
xxxxxxxxxxdocker ps
View the docker environment just created.

Find the docker environment just created and find the CONTAINER ID. Enter the command in the terminal:
xxxxxxxxxxdocker exec -it CONTAINER ID bash
Note: CONTAINER ID is the ID of the latest docker environment just found.
Open the terminal and enter the following command to start rosbridge
xxxxxxxxxxros2 launch rosbridge_server rosbridge_websocket_launch.xml

Raspberry Pi 5 master control,Follow the above steps, reopen a terminal, and enter the docker environment. The docker entered is newly created, and there is no need to execute the ~/run_docker.sh command. Orin master control does not need to enter docker
Enter the command:
Start cartographer mapping
xxxxxxxxxxros2 launch yahboomcar_nav map_cartographer_launch.py
Or start gmapping to create images
xxxxxxxxxxros2 launch yahboomcar_nav map_gmapping_launch.py

Reopen a terminal and enter Docker, enter the following command.
xxxxxxxxxxcd ~/yahboomcar_ros2_ws/yahboomcar_wsxxxxxxxxxxsource install/setup.bashStart publishing robot position nodes
xxxxxxxxxxros2 launch robot_pose_publisher_ros2 robot_pose_publisher_launch.py

Note: If the point cloud information is not displayed after full startup, wait for the mapping module to start before restarting the robot position node
Reopen a terminal and enter Docker, enter the following command
Start the node for publishing laser data transfer points.
xxxxxxxxxxros2 run laserscan_to_point_pulisher laserscan_to_point_pulisher

Reopen a terminal , and enter the following command
xxxxxxxxxxcd ~/yahboomcar_ros2_ws/yahboomcar_wsxxxxxxxxxxsource install/setup.bashOpen another terminal and start the camera
xros2 launch usb_cam demo_launch.py #pi5 motherboard
ros2 launch usb_cam camera.launch.py #orin motherboard
Re-open a terminal , enter the following command
Start Save Map Service Node
xxxxxxxxxxros2 launch yahboom_app_save_map yahboom_app_save_map.launch.py

4、Open the APP and start the Graphical model
Install the app on your phone and open it. The following figure shows the APP opening interface:

Enter the IP address in the input box. The IP address here is the IP address of the car, such as 192.168.2.81. This address is the actual IP address of the car. Please enter it according to the actual situation during operation. After completing the input, click the Next button.

After starting the Graphical model, you can see the current laser point cloud and the laser scanned map

The right robot control area can be controlled by a joystick to move the robot forward, backward, left, and right.

After we control the robot to create the map, click the Save Map button.

Then enter the saved name in the pop-up box and click submit.

After saving, you can see the path of the map saved file printed by the terminal.

If an error is reported when saving the map, it may be due to the incorrect map path in the code and the missing xgo.db file in the folder.
xxxxxxxxxxcd ~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboom_app_save_map/yahboom_app_save_map/xxxxxxxxxxvim yahboom_app_save_map.pyMove the cursor to line 26 to see two paths, then press the button i to modify the two paths in the frame according to the path shown in the figure.

After completing the modifications, press the ESC button and then enter: wq to save the file.
Then enter the command:
xxxxxxxxxxcd ~/yahboomcar_ros2_ws/yahboomcar_ws/xxxxxxxxxxcolcon build --packages-select yahboom_app_save_mapxxxxxxxxxxsource install/setup.bashxxxxxxxxxxros2 launch yahboom_app_save_map yahboom_app_save_map.launch.pyJust save the map again.