Welcome to ROSMASTER M3 repository
13.Road Network Planning with Track Map
Road Network Planning with Track Map
Road Network Planning with Track Map1. Course Content2. Track Lane Network Analysis3. Start Agent4. Build Track Grid Map and Pose Map5. Annotate Road Network6. Start Road Network Navigation7. Test Track Road Network Navigation Case7.1 Point-to-Point Navigation Between Road Networks7.2 Arbitrary Pose Road Network Planning Navigation
1. Course Content
[!IMPORTANT]
- This course is an extended course for the track map and requires the use of the accompanying track map to proceed with the course case study
- This case study is not applicable to Raspberry Pi 5 users!!
- Use road network planning navigation, combined with functional track map to build urban road networks, allowing the vehicle to navigate and drive in the track while following lane traffic rules and planning paths that conform to the road network
- Subsequent courses will include AI large model combined with track autonomous driving and road network planning navigation case studies. This section explains how to build road network planning navigation in the track
2. Track Lane Network Analysis
- Here we can find that the outermost lane is a one-way lane, which can only travel clockwise in one direction, while the middle lane is a two-way lane. Therefore, we can use all corners and intersections as road points to connect edges and build the entire lane's topological network

- The lane traffic rules network is shown in the following figure
[!TIP]
The figure below shows an example lane traffic network. Users can also add more road points or modify the lane network direction according to their actual needs

3. Start Agent
- Use the following command to start the microROS agent and connect to the chassis
[!WARNING]
If you use the
start_agentcommand to start the microROS agent, you need to close the previous agent first. Note that this is different from the previous microROS agent startup command
start_kilted_agent

- Modify ROS communication middleware DDS
[!WARNING]
Open ~/.bashrc, uncomment this line, and change it to the DDS communication middleware as shown in the figure (only the road network planning navigation chapter needs to use cyclondds, please restore the environment variables after completing the road network chapter!!)
xxxxxxxxxxvim ~/.bashrc
- RDK mainboard
- ORIN mainboard
xxxxxxxxxx:wq #Save and exitsource ~/.bashrc #Update environment
4. Build Track Grid Map and Pose Map
- Enter command in terminal
(ORIN mainboard)
xxxxxxxxxxslam
(RDK mainboard) Run step by step, visualization is started on the accompanying virtual machine Rosmaster-M3-Ubuntu22.04,
xxxxxxxxxx#Virtual machine terminalrviz2 -d /home/yahboom/yahboomM3_ws/user_ws/src/m3_bringup/rviz/slam_toolbox_rviz.rviz#Host terminalros2 launch m3_bringup slam_toolbox.launch.py gui:=False
- Then start the keyboard control node (you can also use a controller for control)
xxxxxxxxxxkeyboard_controlControl the vehicle to move for mapping

- Save grid map
[!NOTE]
Here the naming is based on
citymap_4as an example, wherecitymap_4is the map name and can be set by yourself
xxxxxxxxxxros2 launch m3_bringup save_map.launch.py map_name:=citymap_4

- Save slam_toolbox pose map
xxxxxxxxxxros2 launch m3_bringup save_map.launch.py map_name:=citymap_4 map_type:=posegraph
5. Annotate Road Network
- Start navigation node on host machine
xxxxxxxxxxros2 launch m3_bringup nav2.launch.py map:=citymap_4.yaml pose_map:=citymap_4 localization_mode:=slam_toolbox gui:=False
- Start ros2_kilted container (skip for RDK mainboard)
xxxxxxxxxxbringup_ros2kilted
- Enter ros2_kilted container terminal (skip for RDK mainboard)
xxxxxxxxxxexec_ros2kilted
- Start road network annotation node, start in ros2_kilted container terminal (skip for RDK mainboard)
xxxxxxxxxxros2 launch road_net_route route_tool.launch.py yaml_filename:=citymap_4.yaml
- (RDK mainboard) Only need to start rviz, visualization is started on the accompanying virtual machine
Rosmaster-RoadNet-Ubuntu24.04,
xxxxxxxxxx#Virtual machine terminalrviz2 -d /home/yahboom/code_ws/src/road_net_route/rviz/route_tool.rviz- For specific operations of calibrating and saving the road network, refer to the
03-Road Network Annotationsection course in this chapter's tutorial - The following is an example calibrated lane network

6. Start Road Network Navigation
- Open a terminal on the host machine to start the vehicle's radar fusion node and odometer fusion
xxxxxxxxxxros2 launch m3_bringup car_base.launch.py- Start ros2_kilted container
xxxxxxxxxxbringup_ros2kilted
- Open a container terminal
xxxxxxxxxxexec_ros2kilted
- (RDK mainboard) Visualization is started on the accompanying virtual machine
Rosmaster-RoadNet-Ubuntu24.04,
xxxxxxxxxxrviz2 -d /home/yahboom/code_ws/src/road_net_route/rviz/nav2_view.rviz
- Start road network planning navigation node
xxxxxxxxxxros2 launch road_net_route roadnet_nav2.launch.py map:=citymap_4.yaml pose_map:=citymap_4 roadnet_file:=/root/map/citymap_4.geojson[!TIP]
Parameter description
Note: The map name passed in here should be changed to your actual saved map name. If it is the default name, you don't need to pass map parameters
map Grid map file name to be loaded, default value is
map.yamlpose_map Pose map file to be loaded. When navigation global positioning uses slam_toolbox pure positioning, the pose map must be passed in, default value is
maproadnet_file Road network description file, default value is:
map.geojson

7. Test Track Road Network Navigation Case
7.1 Point-to-Point Navigation Between Road Networks
- Here we demonstrate navigating from road network point 10 to road network point 1 as an example. Publish the topic in the terminal
xxxxxxxxxxros2 topic pub -1 /road_net_nav_id std_msgs/msg/Int16MultiArray "{data: [10, 1]}"


7.2 Arbitrary Pose Road Network Planning Navigation
- Here we demonstrate with the arrow direction in the figure as an example

- First control the vehicle to move to this pose

- Use the following command to view the current robot's coordinates in the map
xxxxxxxxxxros2 run tf2_ros tf2_echo map base_footprint

- Then let the vehicle return to road network point 10 (here we use road network point 10 as an example, it can be at any position in the map or in the road network)

- Publish target pose topic in terminal
xxxxxxxxxxros2 topic pub -1 /road_net_nav geometry_msgs/PoseStamped "{header: {frame_id: 'map'},pose: {position: {x: 2.648, y: -1.388, z: 0.0},orientation: {x: 0.0, y: 0.0, z: 1.000, w: 0.000}}}"
- The vehicle will first reach the road network point nearest to the target pose along the road network

- Then adjust to the target pose


