Welcome to ROSMASTER A1 repository
3. Road Network Labelling
Road Network Description File Annotation
Road Network Description File Annotation1. Course Content2. Road Network Annotation2.1 Start Navigation Node2.2 Add Waypoints2.3 Add Edges3. Save Road Network Description File4. Load and Modify Road Network Description4.1 Load Road Network Description File4.2 Edit Road Network
1. Course Content
- Use the route_tool tool to annotate .geojson format files that describe the road network
2. Road Network Annotation
Open ~/.bashrc, uncomment this line and change it as shown in the figure (after learning the road network planning function, please restore this comment to avoid affecting previous cases)
vim ~/.bashrc:wq #Save and exitsource ~/.bashrc #Update environment 
2.1 Start Navigation Node
- When marking the road network, we need to know the specific position of the vehicle in the map, so we need to use the global positioning of the navigation node here
- (Host side) Chassis radar driver
xxxxxxxxxxros2 launch yahboomcar_nav laser_bringup_launch.py
- Start visualization on the orin road network docker side
Start docker (need to run this when entering for the first time, no need to operate after subsequent startup)
xxxxxxxxxxcd ros2_kilted/docker compose up -d

For subsequent docker startup, you can run the following command in the terminal
xxxxxxxxxxbringup_ros2kilted
Enter docker, run in terminal
xxxxxxxxxxexec_ros2kilted

Modify do_main_id to be consistent with the host machine
xxxxxxxxxxnano .bashrc
After modification, press ctrl+x, type y and press enter to save and exit.

Enter the following command in the terminal for visualization
xxxxxxxxxxsource ~/.bashrcros2 launch road_net_route route_tool.launch.py

- Start visualization navigation node on the rdk virtual machine side
xxxxxxxxxxros2 launch road_net_route rviz_only.launch.py tools:=true- (Host side) Navigation node
xxxxxxxxxx#orinros2 launch yahboomcar_nav navigation_teb_launch.py map:=/home/jetson/map/map.yaml#rdkros2 launch yahboomcar_nav navigation_teb_launch.py map:=/home/sunrise/map/map.yaml[!NOTE]
Startup parameter description
- map The name of the grid map to be loaded, here we select the map saved from the previous lesson
- The host machine's map will be saved by default in the
~/mappath. This path will be automatically mounted into the/root/mapdirectory in the ros2_kilted container, so map files saved on the host machine can be used directly in the ros2_kilted container
- The map and two coordinate systems will be displayed in rviz, where map is the map coordinate system and base_footprint is the coordinate system of the projection point of the vehicle chassis center on the ground. We first give the initial pose of the car on our built map through
2D Pose Estimate, roughly at the position on the map.

- After giving the approximate position, you can move the robot vehicle through keyboard control, handle control, or
2D Goal Posenavigation in rviz to make the radar laser contour completely match the map.

2.2 Add Waypoints
- Click the
Publish Pointtool in the rviz toolbar to enter waypoint selection mode

- Then click the left mouse button at the center of the car, the
positionin theRoute Tooltab at the bottom left will automatically fill in the coordinates of the current point, then clickCreateto create a waypoint

- After that, we move the vehicle to the next position that needs to be marked with a waypoint. In this demonstration, we directly move the vehicle to the next position that needs to be marked with a waypoint
[!TIP]
Here you can move the robot vehicle through keyboard control, handle control, or
2D Goal Posenavigation in rviz

[!WARNING]
- The positioning principle here uses amcl global positioning and pose map matching
- Note: When subsequently marking waypoints, if you observe deviation between the laser contour and map environment features (due to accumulated odometer errors or wheel slippage causing local positioning errors), you can first move and rotate for a distance to let amcl positioning take effect, making the radar laser contour data completely match the map.
- Repeat the above steps until all required waypoints are completed (mark waypoints according to the user's actual needs)

2.3 Add Edges
- Select Edge in the
Route Tooltab

- Fill in the starting waypoint in
Start Node IDand the ending waypoint inEnd Node ID, then clickCreateto create an edge between waypoints
[!IMPORTANT]
Attention!!!
A road network is a topological structure composed of points and edges, and edges are directional. Creating edge 10-9 here is unidirectional. If bidirectional edges are needed, you also need to create edge 9-10.
- After that, we create edge 9-10 to enable bidirectional driving between waypoints 9 and 10

- Repeat the above steps to complete the creation of all edges (whether the edges created here are unidirectional or bidirectional depends on the user's actual needs)

3. Save Road Network Description File
- Click
savein theRoute Tooltab, then select the path to save the file in the pop-up window. Here we choose to directly overwrite thismap.geojsonand save it in this path

- If you don't choose to overwrite, you can also fill in the file name in File name. It is recommended to keep it consistent with the grid map name for easy distinction. The file suffix must be .geojson. Finally, click
saveto save the road network description file

- After successful saving, the terminal will print prompt information

- After that, we can view the
map.geojsonroad network description file. The file contains JSON format descriptions of waypoint and edge information

- Maps saved on the virtual machine side must be transferred to the host side
xxxxxxxxxx#rdkTransfer to this path /home/sunrise/map/#orinTransfer to this path /home/jetson/map/
4. Load and Modify Road Network Description
4.1 Load Road Network Description File
[!TIP]
- If you need to modify the previous road network description file later, such as adding, removing, editing points and edges, you can load the previous road network description file for editing
Still follow the startup in 2.1 Start Navigation Node,
Click Load in the
Route Tooltab, then select the road network description file that needs to be edited, and clickopento load


4.2 Edit Road Network
- If you need to add new waypoints and edges, the operation is the same as before
- Click
Editto re-edit existing waypoints or edges

- Click
Removeto re-edit existing waypoints or edges
