Navigation Tutorials Review Note

brewmaster
newworld-kim
Published in
3 min readNov 19, 2020

Make sure that the robot itself is navigation ready.

This consists of three component checks: range sensors, odometry, and localization.

Range Sensors

  • Looks
  • Rate

Odometry

  • Rotation
  • Translation

Localization

  • Map
  • Tuning localization param
< The Costmap_2d. Red Cells: Obstacles in the costmap, Blue Cells: Obstacles inflated by the inscribed radius of the robot >

Each bit of funcionality exists in a layer. For instance, the static map is one layer, and the obstacles are another layer.

  • Static Map Layer
  • Obstacles Layer

Marking and Clearing,, Occupied, Free, and Unknown Space

The costmap automatically subscribes to sensors topics over ROS and updates itself accordingly. Each sensor is used to either mark (insert obstacle information into the costmap), clear (remove obstacle information from the costmap), or both.

  • Mark
  • Clear

Obstacle information each column is projected down into two dimensions when put into the costmap.

  • Projected down into two dimensions

Map Updates

The costmap performs map update cycles at the rate specified by the update_frequency parameter.

  • update_frequency : the rate to perform map update cycles
  • obstacle inflation is performed on each cell with a costmap_2d::LETHAL_OBSTACLE cost

TF

In order to insert data from sensor sources into the costmap, the costmap_2d::Costmap2DROS object makes extensive use of tf.

  • transform_tolerance : set the maximum amount of latency allowed between these transforms.
    - If the tf tree is not updated at this expected rate, the navigation stack stops the robot
  • Lethal: there is an actual (workspace) obstacle in a cell
  • Inscribed: a cell is less than the robot’s inscribed radius away from an actual obstacle.
  • Possibly circumscribed: robot’s circumscribed radius as cutoff distance, it depends on the orientation of the robot whether it collides with an obstacle or not.
  • Freespace: the cost is assumed to be zero.
  • Unknown: there is no information about a given cell.

All other costs are assigned a value between “Freespace” and “Possibly circumscribed” depending on their distance from a “Lethal” cell and the decay function provided by the user.

Map types

There are two main ways to initialize a costmap_2d::Costmap2DROS object.

  • Static Map
    > the costmap is initialized to match the width, height, and obstacle information provided by the static map.
    > allows the robot to register obstacles in the map frame and update its costmap from sensor data as it drives through its environment.
  • rolling_windows
    > keep the robot in the center of the costmap as it moves throughout the world
    > dropping obstacle information from the map as the robot moves too far from a given area

Component API

costmap_2d::Costmap2DROS object is a wrapper for a costmap_2d::Costmap2D object
Example creation of a costmap_2d::Costmap2DROS object specifying the my_costmap namespace:

costmap_2d node will run in the costmap instance’s namespace.

> Common Case Tip: the full Navigation Stack by launching the move_base node have 2 costmaps, each with its own namespace: local_costmap and global_costmap. On this case, We may need to set some parameters twice, once for each costmap.

Subscribed Topics

  • /footprint (geometry_msgs/Polygon)

Published Topics

  • /costmap (nav_msgs/OccupancyGrid)
  • /costmap_updates (map_msgs/OccupancyGridUpdate)
  • /voxel_grid (costmap_2d/VoxelGrid)

Parameters

Hydro and later releases use plugins for all costmap_2d layers.

If you don’t provide a plugins parameter then the initialization code will assume that your configuration is pre-Hydro and will load a default set of plugins with default namespaces. Your parameters will be moved to the new namespaces automagically. The default namespaces are static_layer, obstacle_layer and inflation_layer. Some tutorials (and books) still refer to pre-Hydro parameters, so pay close attention. To be safe, be sure to provide a plugins parameter.

  • Plugins
    ~/plugins (sequence, default: pre-Hydro behavior)
  • Coordinate frame and tf parameters
    ~/global_frame (string, default: “/map”)
    ~/robot_base_frame (string, default: “base_link”)
    ~/transform_tolerance (double, default: 0.2)
  • Rate parameters
    ~<name>/update_frequency (double, default: 5.0)
    ~<name>/publish_frequency (double, default: 0.0)
  • Map management parameters
    ~/rolling_window (bool, default: false)
    ~/always_send_full_costmap (bool, default: false)
  • The following parameters can be overwritten by some layers, namely the static map layer.
    ~/width (int, dafault: 10)
    ~/height (int, default: 10)
    ~/resolution (double, default: 0.05), (meters/cell)
    ~/origin_x (double, default: 0.0)
    ~/origin_y (double, default: 0.0)

--

--