Welcome to ROSMASTER M3 PRO repository
3. Road Network Annotation
Road Network Annotation Description
Road Network Annotation Description1. Course Contents2. Prerequisites2.1 Start Agent2.2 Modify DDS2.3 Start Road Network Container3. Road Network Annotation3.1 Start Road Network Annotation Node3.2 Add Waypoints3.3 Add Edges4. Save Road Network Description File5. Load and Modify Road Network Description5.1 Load Road Network Description File5.2 Edit Road Network
1. Course Contents
Use the route_tool tool to annotate
.geojsonformat files describing road networks
2. Prerequisites
2.1 Start Agent
Start the microROS agent and connect to the chassis. If already started, no need to restart
sh start_agent.sh

2.2 Modify DDS
Modify the ROS communication middleware DDS to use cyclonedds. Only modify when using road network features
xxxxxxxxxxroadnet DDS on

Check DDS status
xxxxxxxxxxroadnet DDS status

Refresh Environment Variables
Orin board
xxxxxxxxxxsource ~/.bashrcRaspberry Pi board, restart container
xxxxxxxxxxshut_m3probringup_m3pro
2.3 Start Road Network Container
xxxxxxxxxxroadnet start

3. Road Network Annotation
When annotating road networks, we need to know the exact position of the vehicle on the map. Therefore, we need to start the navigation node on the host machine first. The position can be known through the base_footprint coordinate system (PI5 users should start in the
m3pro container)
xxxxxxxxxxros2 launch M3Pro_navigation toolbox_location_nav.launch.py gui:=False
Note
Startup Parameter Description
gui Whether to start rviz. Here we choose not to start; it will be started in the docker container later
3.1 Start Road Network Annotation Node
Start in the roadnet container terminal
xxxxxxxxxxroadnet bash
xxxxxxxxxxros2 launch road_net_route route_tool.launch.py yaml_filename:=map.yamlNote
The map on the host machine is saved by default in the ~/map path, which is automatically mounted to the /root/map directory inside the roadnet container. Therefore, map files saved on the host machine can be used directly in the roadnet container
In rviz, the map and two coordinate frames will be displayed. The map is the map coordinate frame, and base_footprint is the coordinate frame of the projection point of the vehicle chassis center on the ground. Through base_footprint, we can know the exact position of the vehicle on the map in real-time

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

Then click the left mouse button on the blue dot at the center of the base_footprint coordinate frame. The
positionin theRoute Tooltab at the bottom left will automatically fill in the current point's coordinates. Then click Create to create a waypoint


Next, move the vehicle to the next position where a waypoint needs to be annotated. In this example, the vehicle is directly moved to the next position where a waypoint needs to be marked
Tip
The vehicle can be moved through keyboard control, gamepad control, 2D Goal Pose navigation in rviz, or even by directly physically moving the vehicle to the next position where a waypoint needs to be marked. Since there is a pose map, the vehicle's global position can be quickly and accurately located
As you can see, directly moving the vehicle causes the global localization to be lost, and the laser outline no longer matches the map environmental features. Here we can use the pose map for rapid relocalization

Click the
2D Pose Estimatetool in the rviz toolbar

Then provide an estimated position near the approximate location of the vehicle

After this, the vehicle's accurate position in the global map will be immediately restored
Tip
The rapid relocalization principle here is to use slam_toolbox pure localization and pose map for rapid scan-map matching
Note: When observing deviation between the laser outline and map environmental features during subsequent waypoint annotation (due to cumulative odometry errors, wheel slippage, manual movement, or other factors causing local localization errors), this method can be used to quickly restore the vehicle's accurate position.

Repeat the above steps until all waypoints that need to be annotated are completed (annotate waypoints according to your actual needs)
After annotation is complete, you can first close the left TF and LaserScan to inspect the waypoints

3.3 Add Edges
Select Edge in the
Route Tooltab

Fill in the starting waypoint in
Start Node ID, fill in the ending waypoint inEnd Node ID, and then click Create to create an edge between waypoints
Important
Attention!!!
The road network is a topological structure composed of points and edges. Edges have direction. For example, creating an edge 0---->1 here is unidirectional. If bidirectional edges are needed, you also need to create edge 1---->0.

Next, we create the 1-0 edge so that waypoints 0 and 1 can travel bidirectionally

Repeat the above steps to complete all edge creation (whether to create unidirectional or bidirectional edges depends on the actual scenario requirements)

4. Save Road Network Description File
Click save in the
Route Tooltab, then select the file path in the pop-up window. Here we select the/root/mappath because this path is bound to the host machine's~/mappath. Later, you can directly view the saved file on the host machine

Then fill in the file name in File name. It is recommended to keep the same name as the raster map for easy identification. The file suffix must be .geojson. Finally, click save to save the road network description file

After successful save, the terminal will print a prompt

Afterwards, we can directly view the map.geojson road network description file from the host machine's
~/mappath. The file contains a json format description of waypoint and edge information

5. Load and Modify Road Network Description
5.1 Load Road Network Description File
If you need to modify a previous road network description file later, such as adding, removing, editing points or edges, you can load the previous road network description file for editing
Start in the roadnet container terminal
xxxxxxxxxxros2 launch road_net_route route_tool.launch.py yaml_filename:=map.yaml
yaml_filename Parameter is the raster map file path of the road network to be annotated


5.2 Edit Road Network
If you need to add new waypoints and edges, the operation is the same as the previous steps
Click
Editto re-edit information for existing waypoints or edges

Click
Removeto remove existing waypoints or edges
