Welcome to MicroROS V2 Robot Car repository
11. Navigation2 Multi Point Navigation
Navigation2 Multi-Point Navigation
Navigation2 Multi-Point Navigation1. Course Content2. Preparation3. Case Demo4. Principle Analysis4.1 Viewing Waypoint Data4.2 Data Sending and Execution
1. Course Content
- Run the example program to learn how to manually mark multiple waypoints for navigation with obstacle avoidance.
2. Preparation
[!WARNING]
Note: This course requires at least one grid map for navigation. If you have not built a map yet, please refer to the previous SLAM mapping course to build a grid map first.
3. Case Demo
- The default AMCL localization navigation mode can be quickly launched by double-clicking the desktop application icon

- Command-line launch method
ros2 launch microros_v2_bringup nav2.launch.py

- At this point you can see that the map has been loaded. Then click "2D Pose Estimate" to set the initial pose of the car. Based on the car's actual position in the real environment, click and drag with the mouse in rviz; the car model then moves to the position you set. As shown in the figure below, if the area scanned by the lidar roughly coincides with the actual obstacles, the pose is accurate.

- After pose initialization is complete, the robot model and the red 2D lidar point cloud will appear in the rviz interface.

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

- Check MarkerArray in the left option panel to enable waypoint display, then click Nav2 Goal and use the mouse to mark multiple goal points on the map.

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

- The robot car navigates to the marked points in sequence.

4. Principle Analysis
4.1 Viewing Waypoint Data
After the user opens [Waypoint/Nav Through PoseMode] and enters multi-point navigation mode, the marked waypoint information will be published to the /waypoints topic (the rviz waypoint navigation plugin adds some extra waypoints along the path between goal waypoints to smooth the path). We can use the rqt interface to view this waypoint data.
Virtual machine terminal launch command:
xxxxxxxxxxrqtClick Plugins——>Topic——>Topic Monitor

- In the rqt interface, you can see the /waypoints topic. 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 manually marked in rviz will be published to this topic. Click on one of the waypoints to view the waypoint data. Here, [0] is used as an example, where pose is the coordinate data.


4.2 Data Sending and Execution
- After you set the waypoint coordinates and click Start Waypoint Following, the rviz plugin wraps the waypoint coordinate sequence into a
FollowWaypointsaction request and sends it to the /follow_waypoint action server to execute all the waypoints in sequence. - View the node relationship graph
xxxxxxxxxxros2 run rqt_graph rqt_graph- In the node relationship graph, you can see the /follow_waypoint action server. This action server receives the waypoint sequence and then navigates to each waypoint in sequence.
