Welcome to Muto RS Robot repository
3.Road network annotation
3.Road network annotation
3.Road network annotation1. Course Content2. Road network labeling2.1Start Docker2.2 Start navigation node2.3Start the ros2_kilted docker container2.4 Start road network labeling nodes2.5 Add Waypoints2.5 Add edge3. Save road network description file4.Loading and modifying road network descriptions4.1Load the road network description file4.2Editing the road network
1. Course Content
1.Use the route_tool tool to annotate and describe the .geojson format file of the road network.
2. Road network labeling
2.1Start Docker
- Start the terminal of Humble version of Docker
start_muto_humble

2.2 Start navigation node
- When marking the road network, we need to know the exact location of the vehicle's navigation system on the map. Therefore, we first need to start the navigation node on Humble's Docker container. The location of the vehicle's navigation system on the map can be determined by its position in the base_link coordinate system.
xxxxxxxxxxros2 launch yahboomcar_nav navigation_slam_toolbox_launch.py map:=/root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/road_map
[!NOTE]
Startup parameter description
- map The name of the raster map to be loaded; here, the map saved in the previous lesson (road_map) is selected.
2.3Start the ros2_kilted docker container
- Start the ros2_kilted container (it only needs to be started once and does not need to be started repeatedly).
xxxxxxxxxxpi@raspberrypi:~ $ ./kilted_docker_start.shFound yahboom workspace, mounting...Found code_ws directory, mounting...Launching container...Container started: 819a6a99aaabEntering container...------------------------------------ROS_DOMAIN_ID: 38my_robot_type: Muto | my_lidar: a1------------------------------------root@raspberrypi:~#
2.4 Start road network labeling nodes
- Start in the terminal inside the ros2_kilted container
xxxxxxxxxxros2 launch road_net_route route_tool.launch.py yaml_filename:=/root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/road_map.yaml
- The
**yaml_filename**parameter is the path to the raster map file containing the road network to be annotated. This uses the map built in the previous lesson. - rviz will display the map and two coordinate systems:
mapis the map coordinate system, andbase_linkis the coordinate system of the projection point of the vehicle's chassis center onto the ground.
For easier display, we disable unnecessary TF functions in rviz, only keeping base_link.

2.5 Add Waypoints
- Click the
Publish Pointtool in the RViz toolbar to enter waypoint selection mode.

- Then, left-click the small blue dot at the center of the base_link coordinate system. The
positionfield in theRoute Tooltab at the bottom left will automatically be filled with the coordinates of the current point. Then click "Create" to create a waypoint.


- Next, we move the vehicle's infotainment system to the next location where a waypoint needs to be marked. In this demonstration, we simply move the infotainment system to the next location where a waypoint needs to be marked.
[!TIP]
Here, the mobile robot can be controlled via keyboard, gamepad, or 2D Goal Pose navigation in RViz. It can even be directly moved to the next location that needs marking, as a pose map allows for quick and accurate global positioning of the robot.
- As we can see, the global localization was lost because the vehicle's infotainment system was moved directly, and the laser contour and map environmental features no longer match. Here, we can use the pose map in conjunction with the 2D Pose Estimate tool for rapid relocalization.

- The vehicle's location will then be restored to its accurate position on the global map immediately.
[!TIP]
- The fast relocalization principle here utilizes pure localization from slam_toolbox and pose map for fast scan-map matching.
- Note: If a discrepancy is observed between the laser outline and map environment features during subsequent waypoint marking (due to cumulative errors in the odometer, wheel slippage, human movement, or other factors causing local positioning errors), this method can be used to quickly restore the vehicle's accurate positioning.
- Repeat the above steps until all waypoints that need to be marked are completed (mark waypoints according to the user's actual needs).
- After marking, you can turn off the left-side TF and LaserScan to check waypoints.

2.5 Add edge
- Select Edge in the
Route Tooltab.

- Enter the starting path point of the edge in
Start Node IDand the ending path point of the edge inEnd Node ID, then click Create to create an edge between the path points.
[!IMPORTANT]
Attention!!!
A road network is a topological structure composed of points and edges. Edges have directions. Here, creating an edge from 1 to 0 is unidirectional. If a bidirectional edge is needed, an edge from 0 to 1 must also be created.
- Repeat the above steps to create all edges (whether to create unidirectional or bidirectional edges depends on the specific needs of the scenario).

3. Save road network description file
- In the
Route Tooltab, click "save". In the pop-up window, select the path to save the file. Here, choose the same path as the map file. - Then, enter the file name in the "File name" field. It's recommended to keep the same name as the raster map for easy identification. The file extension must be .geojson. Finally, click "save" to save the road network description file.

- The terminal will print a notification message after successful saving.

- We can then find the road_map.geojson road network description file that we just saved on the host machine. The file contains a JSON format description of waypoints and edge information.

4.Loading and modifying road network descriptions
Here we will use another saved road network annotation file and map as an example.
4.1Load the road network description file
- If you need to modify the previous road network description file later, such as adding, removing, or editing points and edges, you can load the previous road network description file for editing.
- Start in the terminal inside the ros2_kilted container
xxxxxxxxxxros2 launch road_net_route route_tool.launch.py yaml_filename:=map.yaml
- The
yaml_filenameparameter is the path to the raster map file containing the road network to be annotated.
In the Route Tool tab, click Load, then select the road network description file you want to edit, and click open to load it.


4.2Editing the road network
- To add new waypoints and edges, follow the same steps as before.
- Click
Editto edit existing waypoints or edges.

- Clicking
Removeallows you to edit existing waypoints or edges.
