Table of Contents

Map a New Environment by Driving Around with a Joystick or via Keyboard

Create a map of a new environment by driving around with a joystick or via a keyboard. The map can be used with the flexible navigation stack.

Basic Information

Level Beginner
Role System builder, but also other roles like experienced users
Assumptions Having completed the tutorial Deploy a Simple System onto a P3DX (or a Robotino)
System Requirements Virtual Machine Image Installed, see ready-to-go virtual machine
You will learn - how to generate a 2D map of the environment
Options - SystemWebotsGmapping (any mobile robot with a laser ranger)

Introduction

This tutorial guides you through the steps to create a 2D map of the environment. The 2D map is the representation of the environment used by a robot for autonomous navigation, e.g. via the flexible navigation stack. The result of the mapping process is an Occupancy Grid Map.

We illustrate the mapping of an environment in the Webots simulator via a mobile robot equipped with a laser scanner. However, the same procedure can be used with physical mobile robots with a physical laser scanner to map the real-world environment.

Overview on the Steps

The next sections guide you through the following steps:

The output from this mapping process is a gray-scale image (e.g. laserMap.pgm) which contains the map of the environment and a configuration file (e.g. laserMap.yaml) which contains the information to interpret the image.

Both these files are needed by the components SmartAmcl and SmartMapperGridMap of the flexible navigation stack for navigating a mobile robot.

The System Architecture

The system architecture used for mapping the environment in the Webots simulator is as follows:

Preparation Steps for Mapping

Configuring the system project

Step 1.a: In SystemWebotsGmapping project, open the model folder and open SystemWebotsGmapping.systemParam file. Make sure that the parameters of the components are configured correctly.

Deploy the mapping system project

Step 2.a: Right click on the SystemWebotsGmapping project → Run Code-Generation

Make sure that there are no errors during the code generation.

Step 2.b: We now deploy the system by clicking the Deployment Action from the right-click menu of the project:

It depends on your configuration whether you are being asked for credentials of the configured login account. Finally, you see the following pop-up window which tells you that the deployment was successful:

Step 2.c: You can use either a joystick or the keyboard to drive the robot. If you want to use a joystick, make sure that you have connected the joystick to your computer. It is important that the joystick is connected before starting the system.

You can now start your system by clicking Yes. A terminal window will open and show the scenario control menu. Choose menu-start Start Scenario.

Step 2.d: Wait until the world is fully loaded in Webots.

Placement of the robot in the environment

Step 3.a: Click on the robot to see the coordinate system of the robot. This robot location will be the origin of the map you are going to create.

Step 3.b: Now check the position and heading of the robot. You can move the robot to any location and you can set it to any heading. This position and heading will be the origin of the map which is going to be created.

The initial position of the robot is very important for mapping. This initial position is used as origin of the map (i.e. x=0.0, y=0.0, heading = 0°) by the mapping algorithm. A right-handed coordinate system is the standard used for representing the coordinate system of the robot. Below figure shows the coordinate system of the robot:

Mapping the environment

Step 4.a: Look for the terminal which contains the ComponentTCLSequencer.

In the menu, select “1 - Start Mapping” to start the mapping.

Step 4.b: Look for the SmartVisualization window, it shows the map that is built so far. You can use your mouse to zoom and pan the view of the map in the SmartVisualization window.

Step 4.c

Step 4.d: Finally stop the mapping and save the map by selecting “1 - Stop Mapping - Save Maps” in the ComponentTCLSequencer. You will be asked to enter the path to store the map, you can enter the desired path or just press enter.

By default the generated map is stored in the folder “/temp/map-xxxx-x-xx_xx-xx-xx/”. This folder contains two files, laserMap.pgm and laserMap.yaml. The file laserMap.pgm is the generated grid map of the environment and laserMap.yaml is the specification of the generated map. The file laserMap.yaml contains the origin of the map and values specifying the size of a pixel in meters. laserMap.yaml must be available to interpret the generated grid map.

Step 4.e: Finally stop the system by selecting menu-stop Stop Scenario in the Gloabl Scenario Control window. It stops and closes all the components and the Webots simulator.

Post-Processing the Map

Any image processing tool (e.g. GIMP) can be used to post-process the generated map. There are several good reasons to do this, some of the common scenarios are the following:

What to do next?

Now you can proceed with tutorial Symbolic Names for Rooms - How to Update the Knowledge Base

Acknowledgements

DokuWiki Appliance - Powered by TurnKey Linux