Setting up rviz for the navigation stack

It is good practice to visualize all possible data that the navigation stack does. In this section, we will show you the visualization topic that you must add to rviz to see the correct data sent by the navigation stack. Discussions on each visualization topic that the navigation stack publishes are given next.

The 2D pose estimate

The 2D pose estimate (P shortcut) allows the user to initialize the localization system used by the navigation stack by setting the pose of the robot in the world.

The navigation stack waits for the new pose of a new topic with the name initialpose. This topic is sent using the rviz windows where we previously changed the name of the topic.

You can see in the following screenshot how you can use initialpose. Click on the 2D Pose Estimate button, and click on the map to indicate the initial position of your robot. If you don't do this at the beginning, the robot will start the auto-localization process and try to set an initial pose:

  • Topic: initialpose
  • Type: geometry_msgs/PoseWithCovarianceStamped
The 2D pose estimate

The 2D nav goal

The 2D nav goal (G shortcut) allows the user to send a goal to the navigation by setting a desired pose for the robot to achieve. The navigation stack waits for a new goal with /move_base_simple/goal as the topic name; for this reason, you must change the topic's name in the rviz windows in Tool Properties in the 2D Nav Goal menu. The new name that you must put in this textbox is /move_base_simple/goal. In the next window, you can see how to use it. Click on the 2D Nav Goal button, and select the map and the goal for your robot. You can select the x and y position and the end orientation for the robot:

  • Topic: move_base_simple/goal
  • Type: geometry_msgs/PoseStamped
The 2D nav goal

The static map

This displays the static map that is being served by map_server, if one exists. When you add this visualization, you will see the map we captured in Chapter 5, The Navigation Stack – Robot Setups, in the Creating a map with ROS section.

In the next window, you can see the display type that you need to select and the name that you must put in the display name:

  • Topic: map
  • Type: nav_msgs/GetMap
    The static map

The particle cloud

This displays the particle cloud used by the robot's localization system. The spread of the cloud represents the localization system's uncertainty about the robot's pose. A cloud that spreads out a lot reflects high uncertainty, while a condensed cloud represents low uncertainty. In our case, you will obtain the following cloud for the robot:

  • Topic: particlecloud
  • Type: geometry_msgs/PoseArray
The particle cloud

The robot's footprint

This shows the footprint of the robot; in our case, the robot has a footprint, which has a width of 0.4 meters and a height of 0.4 meters. Remember that this parameter is configured in the costmap_common_params file. This dimension is important because the navigation stack will move the robot in a safe mode using the values configured before:

  • Topic: local_costmap/robot_footprint
  • Type: geometry_msgs/Polygon
The robot's footprint

The local costmap

This shows the local costmap that the navigation stack uses for navigation. The yellow line is the detected obstacle. For the robot to avoid collision, the robot's footprint should never intersect with a cell that contains an obstacle. The blue zone is the inflated obstacle. To avoid collisions, the center point of the robot should never overlap with a cell that contains an inflated obstacle:

  • Topic: /move_base/local_costmap/costmap
  • Type: nav_msgs/OccupancyGrid
    The local costmap

The global costmap

This shows the global costmap that the navigation stack uses for navigation. The yellow line is the detected obstacle. For the robot to avoid collision, the robot's footprint should never intersect with a cell that contains an obstacle. The blue zone is the inflated obstacle. To avoid collisions, the center point of the robot should never overlap with a cell that contains an inflated obstacle:

  • Topic: /move_base/global_costmap/costmap
  • Type: nav_msgs/OccupancyGrid
    The global costmap

The global plan

This shows the portion of the global plan that the local planner is currently pursuing. You can see it in green in the next image. Perhaps the robot will find obstacles during its movement, and the navigation stack will recalculate a new path to avoid collisions and try to follow the global plan.

  • Topic: TrajectoryPlannerROS/global_plan
  • Type: nav_msgs/Path
    The global plan

The local plan

This shows the trajectory associated with the velocity commands currently being commanded to the base by the local planner. You can see the trajectory in blue in front of the robot in the next image. You can use this display to see whether the robot is moving, and the approximate velocity from the length of the blue line:

  • Topic: TrajectoryPlannerROS/local_plan
  • Type: nav_msgs/Path
    The local plan

The planner plan

This displays the full plan for the robot computed by the global planner. You will see that it is similar to the global plan:

  • Topic: NavfnROS/plan
  • Type: nav_msgs/Path
    The planner plan

The current goal

This shows the goal pose that the navigation stack is attempting to achieve. You can see it as a red arrow, and it is displayed after you put in a new 2D nav goal. It can be used to find out the final position of the robot:

  • Topic: current_goal
  • Type: geometry_msgs/PoseStamped
    The current goal

These visualizations are all you need to see the navigation stack in rviz. With this, you can notice whether the robot is doing something strange. Now we are going to see a general image of the system. Run rqt_graph to see whether all the nodes are running and to see the relations between them.

The current goal
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset