Skip to content

Autonomous navigation

Hint

The operating environment and software and hardware configurations are as follows:

  • OriginBot robot(Navigation Version)
  • PC:Ubuntu (≥20.04) + ROS2 (≥Foxy)

Configure the map

Autonomous navigation will be completed on the map established by the previous SLAM, and the OriginBot navigation package contains a default map, which needs to be modified to the map of your own environment before navigation, and the modification method is as follows:

  • Copy the map file(*.pgm)and map configuration file(*.yaml)created by your SLAM and place them in the originbot_navigation/maps directory;
  • Change the name of the map called in the originbot_navigation/launch/nav_bringup.launch file to ensure that it is the same as the name of the map configuration file copied in the previous step:

image-20220926172042601

  • After the modification is complete, the terminal returns to the root directory of the workspace and recompiles it.

At this point, the map is configured, and you can use your own map to navigate.

Start the chassis and lidar

After SSH is connected to OriginBot, enter the following command in the terminal to start the robot chassis and lidar:

$ ros2 launch originbot_bringup originbot.launch.py use_lidar:=true use_imu:=true
$ ros2 launch originbot_bringup originbot.launch.py use_lidar:=true

image-20220822151217130

Hint

Since the chassis will automatically record odom data after starting, the chassis needs to be restarted before running the navigation function each time, otherwise it may cause an error in the TF tree transformation.

Visualized display of the upper computer

In order to facilitate the release of the target point of navigation, on the PC side under the same network, start the upper computer visualization software:

$ ros2 launch originbot_viz display_navigation.launch.py
Hint

Make sure that you have downloaded and compiled the originbot_desktop code repository on the PC side. If it is not convenient to use originbot_desktop code repository, you can also use "ros2 run rviz2 rviz2" to start Rivz2 separately and manually add display plug-ins such as map, tf, and laserscan, which can also achieve a similar effect.

Start the navigation feature

Connect to OriginBot via SSH and enter the following command in the terminal to start the Nav2 navigation package:

$ ros2 launch originbot_navigation nav_bringup.launch.py
image-2x_nav

$ ros2 launch originbot_navigation nav_bringup.launch.py
image-20220822151254160

This function has been enabled on NodeHub. For details, see: Nav2 mobile robot autonomous navigation

After the startup is successful, you will see the continuous output information in the terminal, this is because the initial pose of the robot is not set, and it will be set after starting Rviz in the future, which can be ignored for the time being.

Attention

If you run the navigation first and then start Rviz, you may not be able to see the static map in Rviz, please make sure to start Rviz on the PC first, and then start the navigation function on the robot side.

Single-target point navigation

Configure the display item in the open Rviz, click the "2D Pose Estimate" button in the toolbar, select the initial pose of the robot in the map,the warning in the previous terminal will also stop, and then click the target location and select the "2D Goal Pose" button, select the navigation target point on the map, and then start autonomous navigation.

e69be30fab

Multi-target point navigation

Click on the Panels option in the Rviz menu bar, select the Navigation2 plugin from it, and click OK.

img

Hint

If you can't find the Navigation2 plugin here, please use “sudo apt install ros-${ROS_DISTRO}-nav2*” to install it.

In the navigation plug-in window that pops up on the left, click "Waypoint mode" to enter the multi-way point selection mode. img

Use the "Navigation2 goal" function to select multiple waypoints that need to be navigated, and after the selection is completed, click the "Start Navigation" button in the plug-in, and the robot navigation movement will start, passing through the selected waypoints in turn. img

Fixed-point navigation

After the feature pack has been successfully compiled, you can see the send_goal feature pack in the originbot_navigation, which integrates the fixed-point navigation program.

You can use the following programs to run it:

ros2 run send_goal GoalCoordinate

send_goal

图片1