Welcome to ROSMASTER M3 repository
11.Navigation2 multi-point navigation avoid
Navigation2 Multi-Point Navigation
Navigation2 Multi-Point Navigation1. Course Content2. Start the Agent3. Run the Example3.1 Multi-Point Navigation4. Principle Analysis4.1 View Waypoint Data4.2 Data Sending and Execution
1. Course Content
- Run the sample program to learn how to manually mark multiple waypoints for navigation and obstacle avoidance.
2. Start the Agent
Note: If it is already running, you do not need to start it again.
Enter the command in the vehicle's terminal:
start_agent
The terminal will print the following information, indicating a successful connection:

3. Run the Example
3.1 Multi-Point Navigation
- Start the navigation function:
For Raspberry Pi 5 users, if the ROS container is not started, you need to start it first,
xxxxxxxxxxbringup_m3
Open a terminal inside the container,
xxxxxxxxxxexec_m3
(ORIN board)
xxxxxxxxxxros2 launch m3_bringup nav2.launch.py(RDK & PI5 boards) Run in separate steps, with visualization launched on the accompanying virtual machine Rosmaster-M3-Ubuntu22.04,
xxxxxxxxxx# On the virtual machinerviz2 -d /home/yahboom/yahboomM3_ws/user_ws/src/m3_bringup/rviz/nav2.rviz# On the host machineros2 launch m3_bringup nav2.launch.py gui:=False
- At this point, you can see the map loaded. Then, click on "2D Pose Estimate" to set the initial pose of the car. Based on the car's actual position in the environment, click and drag with the mouse in RViz. The car model will move to the position we set. As shown in the figure below, if the Lidar scan area roughly coincides with the actual obstacles, the pose is accurate.

- After the pose is initialized, the robot model and the red 2D Lidar point cloud will appear in the RViz interface.

- Click on [Waypoint/Nav Through PoseMode] in the lower-left corner to enter multi-point navigation mode.

- Check the MarkerArray in the left options panel to display the waypoints, then click Nav2 Goal and use the mouse to mark multiple target points on the map.

Click Start Waypoint Following in the lower-left corner to begin multi-point navigation.

- The robot car will navigate sequentially to the marked points.

4. Principle Analysis
4.1 View Waypoint Data
After the user opens [Waypoint/Nav Through PoseMode] and enters multi-point navigation mode, the marked point information will be published to the /waypoints topic (the RViz waypoint navigation plugin will add extra waypoints between the target waypoints to smooth the path). We can view this waypoint data through the RQT interface.
Launch command in the virtual machine terminal:
xxxxxxxxxxrqtClick Plugins -> Topic -> Topic Monitor

- In the RQT interface, you can see the
/waypointstopic. After checking it, you can observe the data on the topic (you need to check the topic first, then publish the waypoints in the RViz interface). - The waypoints we manually mark in RViz will be published to this topic. You can expand one of the waypoints to view its data. Taking [0] as an example,
posecontains the coordinate data.


4.2 Data Sending and Execution
- After setting the waypoint coordinates, when you click Start Waypoint Following, the RViz plugin will package the sequence of waypoint coordinates into a
FollowWaypointsaction request and send it to the/follow_waypointaction server to execute all the waypoints sequentially. - View the node relationship graph:
xxxxxxxxxxros2 run rqt_graph rqt_graph- In the node relationship graph, you can see the
/follow_waypointaction server, which receives the waypoint sequence and navigates through them in order.
