Mapping

Summary

This section gives details about constructing a map with DE NIRO. This is accomplished using the Hokuyo laser scanner and the Hector Mapping package. The following two figures show the end result: Above, a static map, below, a dynamic map - both are further explained below.

_images/static_map.png
_images/dynamic_map.png

Hardware Requirements

  • Hokuyo laser scanner

Software Requirements

External Packages:

  • hector_mapping: to create a map with the laser scanner.
  • map_server: to save a map.
  • urg_node: laser scanner drivers.

Custom software:

  • Robot state transforms: publishes transformation information between laser and robot base
  • odometry_publisher.py: script to publish odometry information

Installation Steps

  1. Install Hector Mapping
  1. Install Urg Node
  1. Install Map Server

Setup Tests

To create a map, you will first need the correct driver for the laser scanner. This can be installed by running sudo apt-get install ros-<distro>-urg-node. Next hector_mapping must be installed. This package uses the laser scanner information to build a map. It can be installed with the following command sudo apt-get install ros-<distro>-hector-mapping.

Finally, Map Server will be required to save a map. This can be installed by running sudo apt-get install ros-<distro>-map-server. Details on how to save a map are given below.

Implementation

The mapping package works by feeding laser scanner information to the Hector Mapping package which builds a probability occupancy map of the space i.e. free space and obstacles are indicated by varying shades of grey.

To convert the information laser scans into accurate information about the location of objects, it is important that the tf between the laser and the robot’s base has been configured correctly (Please see XXXXXXXXXXX for more information). The transformations for DE NIRO are currently located in the deniro description package. These do not need modifying.

Usage

To begin building a map, start the launch file in the mapping_2d package with the command roslaunch mapping_2d mapping_2d.launch.

Note

The laser scanner’s IP address is currently set to 192.168.0.31. If this changes, the mapping_2d.launch file will need to be updated.

If all is working correctly, RViz will launch and you’ll be able to see a rainbow line which is the trace from the laser scan.

Note

Before moving the mobile base, record its position using a landmark or by placing tape on the floor to indicate the postion of the wheels. This will make it easier to place the base in the exact same position when launching the navigation package.

To view the map which is being built, press the ‘Add’ button at the bottom left of the window and add the ‘Map’ topic. Once the display is adjusted, you can begin moving the robot around the room to build a map. It is recommended that you perform multiple laps of the room in both directions in order to build a reliable map.

Once you are satisfied with the map, it can be saved by running rosrun map_server map_saver -f <filename>. This will save the map image and the associated metadata .yaml file in the directory where the command was run.

You now have a map which can be loaded by including the following line in a launch file <node name="map_server" pkg="map_server" type="map_server" args="$(find <package>)<path from pkg root>.yaml"/>.