This chapter needs to be used with a car chassis and other sensors to operate. This is just an explanation of the implementation method. In fact, it cannot be run. It needs to be used with the company's rosmaster-X3 car to achieve this function.

If you need to transplant it to your own motherboard, you need to install other dependency files.

1. Function description

After the program starts, the system will open rviz to display the map.

By setting target points, single-point and multi-point navigation of the car can be achieved.

2. Install Navigation 2 package

Take ros2-foxy as an example, Input following command:

3. Code path

launch source code, the function source code is located in the Yahboom virtual machine file.

4. Start

4.1 Start rviz display

Input following command:

At this time, the map will not be displayed on the screen.

Don't worry about the errors reported by each node topic on the left, because the navigation node has not been started yet.

4.2 Start the lidar

Input following command:

4.3 Start navigation node

Input following command:

The DWB navigation algorithm is used here.

image-20231109170436977

A map will appear in rviz.

Click [2D Pose Estimate] on rviz.

Then compare the position and posture of the car and mark an initial position and posture for the car on the map.

image-20231109170504042

Compare the overlap between the lidar scanning point and the obstacle, and set the initial pose of the car multiple times until the lidar scanning point and the obstacle roughly overlap.

4.4 Single point navigation

After the initial pose is set, you can click [2D Goal Pose] to set a navigation target point, and the car will start single-point navigation.

image-20231109170553127

4.5 Multi-point navigation

After setting the initial pose, click [Waypoint mode] in the lower left corner.

Then, click [Navigation2 Goal] on rviz, and we can mark a target point on the map.

Click [Navigation2 Goal] again to mark the second target point on the map. By continuing the cycle, you can mark multiple target points at once.

image-20231109170643086

image-20231109170657453

After marking multiple target points, click [Start Navigation] to start multi-point navigation.

image-20231109170737309

After the multi-point navigation is completed, the car will stay at the last target point.

For some parameters of DWB, you can refer to: