Navigation - fontysrobotics/ARMinor-2020-Opensource-Virtual-Learning-Environment-AROVLE GitHub Wiki

7.1 Intro

For the navigation of our robot, we will be making use of the ROS navigation stack. The Navigation Stack is fairly simple on a conceptual level. It takes in information from odometry and sensor streams and outputs velocity commands to send to the mobile base. The navigation stack consists of two planners, a global and a local one. Both of these have their own costmap. A costmap is a method of planning paths around obstacles. Areas close to obstacles, and paths through these areas, are assigned a higher ‘cost’ than those free from obstacles. In this tutorial, we will look at what these planners do, and tune how exactly this costmap is made and evaluated, along with other parameters of the navigation stack. Below is a graph that describes the architecture of the ROS navigation stack.

Looking at the graph we find that we already have the following; Odom topic where gazebo is publishing odometry messages. Scan topic that we created in the previous tutorial using ira laser tools. A map that was created using ros map server. To finish our navigation setup we still need to do the following: Setting up a Local planner. Setting up a Global planner. Creating configuration files of the planners. Creating launch files.

7.2 Global planner:

The global planner is responsible for looking at the map, and finding a path to reach the set navigation goal. In finding this path, the global planner only uses the map that was generated before, and not any additional sensor data. Adjusting to obstacles found by sensors that were not previously known is where the local planner comes in. In these tutorials, we will be using NavfnROS as a global planner, which is installed in the ROS workspace by default.

7.3 Local planner:

The local planner takes the path made by the global planner, and is responsible for actually executing it. This means that the local planner tries to find ways to move the robot that are close to the global path, while avoiding obstacles. The local planner we will be using in this tutorial is called Teb_local_planner. For more information about this package, please refer to the ROS wiki Launch a terminal and install teb planner using the command: $ sudo apt install ros-melodic-teb-local-planner

7.4 configuration files:

When using the navigation stack, move base has to be started with some parameters that will describe the behaviour of both global and local planners. These parameters are usually stored in .yaml configuration files. These files have to be created in the navigation package, and called in the navigation launch file. you can download the files in github and copy them to the cfg folder in the example urdf package. You can find a full description of the used parameters here.

7.5 launch files:

In this section we will make some minor adjustments to our gazebo.launch file, and create a teb.launch file.

Navigate to the launch folder in the example urdf package, and open gazebo.launch in an editor to apply the needed changes: the file can be found under tutorial_files/navigation/launch.

When launched, this file is going to start 4 nodes: A move_base node with parameters stored in yaml configuration files. A map_server nodes with the created map in the previous tutorial. An amcl node to help localize the robot. An Rviz node to visualise navigation paths and cost maps. Now let’s launch our navigation package: $ roslaunch example_urdf gazebo.launch $ roslaunch example_urdf teb.launch

Now we can send navigation goals through rviz using the ‘2D Nav Goal’ button in the toolbar. Go ahead and test yours by doing so! Depending on the goal you have selected the robot might collide with an obstacle or act in a different way than expected. In the next section we will tune the planner parameters to achieve the behaviour we want,using the RQt reconfigure plugin.

7.6 Tuning the navigation stack parameters:

7.6.1 Footprint:

When you start the package for the first time, you’ll notice that the robot is represented as a circle in rviz. This is because the robot’s size is defined by the robot radius parameter in costmap_common_params.yaml. Let’s override that parameter by adding the following line in the file: footprint: [-0.36,-0.2],[0.4,-0.2],[0.4,0.2],-0.36,0.2 This will create a rectangle that will represent the robot footprint and will be used in the path planning.

7.6.2 Local cost map:

Notice the inflation, the area around an obstacle in the cost map, is quite large. For example the inflation around the table legs is .

This can be changed in the same file under the inflation layer section. With every change that we are making in the configuration files we will have to restart the package again, that is when rqt_reconfigure becomes crucial in the tuning process.

start a new terminal and run the following command: $ rosrun rqt_reconfigure rqt_reconfigure In the left panel select move_base -> global_costmap -> inflation_layer and change inflation radius value to 0.2 which will change the distance of inflation to 20 cm. Notice the costmap visualization in rviz becomes smaller.

Before copying our parameters please go ahead and try tuning the parameters yourself, read the effect of each parameter and experiment with changing it.

Below are the tuned parameters using rqt_reconfigure notice that you will have to write the changes to the yaml files for permanent change. For more information about tuning teb planner please refer to ros-wiki