myAGV-Map Navigation

Previously we have built a spatial map and obtained two map files, map.pgm and map.yaml, in the home directory

地图文件

Now let's see how to use the created map to navigate the car

1.Copy the map file to the corresponding location in the project folder

  1. Click on the File system icon on the desktop to open the file manager, click on "ubuntu" on the right to enter the /home/ubuntu directory.
  2. You can see that the map we created before is saved in this path, select these two files.
  3. Right-click and click Copy to copy these two files.

复制地图1

  1. Click the File system icon on the desktop to open another file manager and enter the following path, paste the map files you just copied into that path:

    /home/ubuntu/myagv_ros/src/myagv_navigation/map/

复制地图2

2. Modify the launch file

  1. Click to open Visual Studio Code in the top left corner to open the code editor.

vscode图标

  1. Open the navigation_active.launch file in /home/ubuntu/myagv_ros/src/myagv_navigation/launch/ path.

修改launch文件1

  1. Replace the myroom2.yaml in line 5 with our own map file name map.yaml.

修改launch文件2

  1. Save the modified file and exit (VScode is more memory intensive when running, it is recommended to close VScode after modifying the code, otherwise the running carsystem will be very laggy, you can also use vim and other lightweight editors.)

    3.Run the launch file

  2. After opening the car, open the console terminal (shortcut Ctrl+Alt+T) and enter the following command on the command line:

    cd myagv_ros
    roslaunch myagv_odometry myagv_active.launch
    
  3. Open another console terminal (shortcut Ctrl+Alt+T),and type the following command:

    roslaunch myagv_navigation navigation_active.launch
    

终端显示

  1. You can see that an Rviz simulation window is opened.

Note: The initial position of the car is best placed at the starting position of the car when we build the map

If the car on the Rviz interface does not correspond to the actual car, click "2D Pose Estimate" on the top toolbar to adjust, so that the car on the Rviz interface and the realized car can correspond, and navigate after adjustment.

运行launch文件1

  1. Click on "2D Nav Goal" in the top toolbar.

运行launch文件3

  1. Click on the point we want to reach on the map, the carwill start towards the target point, and you can also see in the rviz a planned path of the carbetween the starting point and the target point, the carwill move along the route to the target point.

运行launch文件4

results matching ""

    No results matching ""