Robot Foundations · Module 6: Building a Map
What Is a Map?
A map is the robot's memory of the world, simplified on purpose. The right kind of map depends on the question it must answer.
Without a map, Pip knows only what its scanner shows at this instant. It cannot plan a route round a wall it is not looking at, and it cannot tell a room it has been in from a room it has not. A map is memory: what the robot has seen, kept in a form a program can use. This lesson asks what a map is for, and shows three kinds, since a map that is perfect for one job can be useless for another.
What you will be able to do
- Say what a robot uses a map for.
- Describe a grid map, a landmark map and a map of places.
- Choose the kind of map that fits a task.
- Explain why a map is always a simplified copy, and what the third state "unknown" means.
The idea
A map is a description of the surroundings that the robot keeps between sensor readings. It does three jobs:
- Planning. Module 5's planner needs to know where walls and obstacles are, including ones not in view now.
- Remembering. What a scan showed a minute ago is still true, and the map keeps it.
- Locating. Matching what the sensors see now against the map says where the robot is. That is module 7.
There is no single best way to write a map down. The three common ways answer different questions.
| Kind of map | What it stores | Good for | Weak at |
|---|---|---|---|
| Grid map (occupancy grid) | Every cell of the floor: free, occupied or unknown | Planning a route round obstacles, checking whether a spot is free | Size: it grows with the area and with how fine the cells are |
| Landmark map | A short list of recognisable things and where each one is | Working out where the robot is, from what it can recognise | It says nothing about the space between landmarks, so it cannot plan a route |
| Map of places (topological map) | Named places and which are connected | Choosing a route between rooms: "dock, hall, shelf" | It has no shape: it cannot say how wide a door is or how to steer through it |
Many real robots carry several at once: a grid for avoiding the pallet in front, a list of landmarks for knowing where it is, and a map of places for choosing which room to go to. This module builds the grid map, because it is the one lab 3 used (as a given) and the one lab 4 asks you to build.
Three states, not two
A cell of the grid is not just free or blocked. Before the robot has looked, it does not know, and "I do not know" is different from "free". A cell can be:
- Free: a beam passed through it, so nothing is there.
- Occupied: a beam stopped in it, so something is there.
- Unknown: no beam has reached it. Behind a wall, round a corner, or beyond the sensor's range.
A map has three answers, not two: free, occupied and unknown. Unknown is not free.
How fine should the grid be?
A grid of fine cells follows the real shapes closely but needs more cells. Halving the cell size makes four times as many. Take a 20 by 12 m hall:
| Cell size | Cells in the hall | Compared with 0.5 m |
|---|---|---|
| 0.5 m | 960 | the starting point |
| 0.25 m | 3 840 | 4 times as many |
| 0.1 m | 24 000 | 25 times as many |
| 0.05 m | 96 000 | 100 times as many |
The lab uses 0.5 m cells: coarse enough to be fast and fine enough for a robot 0.35 m across to find its way. Robots that squeeze through narrow gaps use cells of a few centimetres.
Every map is a simplified copy. A cell marked "free" may hold a thin cable, and a cell marked "occupied" may be half empty. The map is good enough for the job, and the robot must treat it as an estimate.
Words to know
- Map
- The robot's remembered description of its surroundings. On Pip: a grid of the workshop floor.
- Occupancy grid
- A map made of cells, each marked free, occupied or unknown. On Pip: cells of 0.5 m, as in lab 4.
- Landmark
- A recognisable thing with a known place, such as a pillar, a doorway or a marker on the wall. On Pip: a post at a known spot, like the lab's landmarks.
- Topological map
- A map of places and the connections between them, without shape. On Pip: dock, hall, shelf and the routes between them.
- Unknown
- A cell no sensor reading has covered yet. On Pip: the space behind the box in a scan.
- Resolution (of a map)
- The size of one cell. Smaller cells mean finer detail and more cells. On Pip: 0.5 m in the lab.
A worked example: which map for which job?
Pip has three jobs in one afternoon. Choose a map for each.
- Squeeze past a pallet that was not there this morning. This needs the exact shape and place of the obstacle in the space ahead. A grid map, kept up to date from the scanner.
- Work out its position after being switched on in a corridor. It needs to recognise something it already knows. A landmark map: the doorway and the pillar are in the list, the scanner finds them, and their known places give the robot's.
- Decide whether to go to the shelf room by the north or the south corridor. This needs only which places connect, and roughly how long each link is. A map of places: it does not matter how wide the corridors are, only that both lead there.
Now size the first one. The workshop is 20 by 12 m. With 0.5 m cells that is 960 cells, which a computer handles in a blink. With 5 cm cells it is 96 000: still fine for a modern computer, but the planner of module 5 now has 100 times as many cells to label, and a robot on a small board may be too slow. The right resolution is the coarsest one that still lets the robot do its job.
Try it yourself
Draw a map of your own room in three ways. (a) A grid: use squared paper with each square 0.5 m and shade the squares that contain furniture. (b) A landmark map: list three recognisable things (the door, the window, the bed) and their positions measured from one corner. (c) A map of places: draw the rooms of your home as dots and join those that have a door between them. Which of the three would you use to (i) plan a path round the bed, (ii) tell someone where you are, (iii) plan a route from the bedroom to the front door?
Answer
(i) The grid: it shows the free space round the bed. (ii) The landmark list: "about 2 m from the window and 3 m from the door" fixes a position. (iii) The map of places: bedroom, hall, front door. It is the simplest map and the one you use without thinking when you decide where to walk.
Common mistakes
"The best map is the most detailed one."
More detail costs memory and time. The best map answers the robot's questions with the least detail that is safe.
"Unknown cells are free until proved otherwise."
For planning, the lab's planner does assume that, as a choice (module 5). But the map must still record that the cell is unknown, so that the robot knows what it has not yet checked.
"One kind of map does everything."
A grid cannot easily say "this is the pillar by the door". A landmark list cannot plan round a wall. Robots combine maps for this reason.
Remember this
- A map is the robot's memory of its surroundings. It serves planning, remembering and locating.
- Grid maps store every cell, landmark maps store recognisable points, maps of places store connections.
- A grid cell is free, occupied or unknown. Unknown is not free.
- Finer cells follow the world more closely and need many more cells: halving the size means four times as many.
Check yourself
Three questions. Write an answer in your own words, then reveal the explanation. Nothing you type leaves your browser.
Question 1
A robot needs to decide which of two corridors leads to the loading bay faster. Which kind of map is enough?
Explanation
A map of places: it needs only which places connect and roughly how far each link is. A grid map would work too, but it carries far more detail than the decision needs.
Question 2
A grid uses 0.25 m cells. The robot changes to 0.125 m cells. By what factor does the number of cells grow, and why?
Explanation
By four. Each cell side is halved, so each old cell becomes 2 by 2 = 4 new cells. Halving the cell size multiplies the cell count by four, which is why fine grids get big quickly.
Question 3
After one scan, a cell behind a box is "unknown". Why is that different from "free"?
Explanation
No beam reached it: the box blocked the view. The robot has no evidence either way, so it could hold a person or a wall. Marking it free would make the robot believe it had checked a space it has never seen.
What’s next
You know what a map is and what a grid map contains. The next lesson builds one from a single laser reading, cell by cell.
Where this goes on the site
Nothing below is needed to continue this course. These pages take the topic of this module further, and most assume more mathematics or Python than this course does.
- LaterLocalization & SLAM
Mapping and localization together, the full problem.
- LaterOccupancy Grids for Planning
How a planner reads the grid you built.