Find a course

Module 5: Robots in the WorldLesson 9 of 1011 min

Autonomy, Navigation and AI

Explore how robots find their way: dead reckoning, landmarks, mapping and SLAM, plus where machine learning helps robots see and decide.

Step 1 of 11Learn

Lost in a warehouse

A warehouse robot carries shelves from storage to packing stations, hundreds of trips a day, among dozens of other robots. It can't drift by even a few centimeters, or it will miss the shelf it's supposed to lift. How does it know exactly where it is?

If it relied only on its wheel encoders (dead reckoning), errors would pile up with every meter: a tiny slip here, a slightly worn wheel there. After an hour of driving, it could be meters off. So many warehouse robots use landmarks: small codes stuck to the floor in a grid. Each time a camera under the robot spots one, the robot knows its exact position and resets its dead-reckoning error to nearly zero. Between codes, the encoders fill in the gaps.

This is the basic idea behind most robot navigation: combine a sensor that's smooth but drifts with a sensor that's occasionally exact. Encoders and gyros give smooth, fast estimates that slowly drift; landmarks, GPS, lidar maps or cameras give absolute corrections. Merging different sensors into one better estimate is called sensor fusion.

Autonomy describes how much a robot can do without human help. It ranges from fully remote-controlled, through robots that handle some tasks alone (like a Mars rover driving to a point a scientist picked), to robots that plan and work for long periods on their own.

Step 2 of 11Practice · Choose one

Why do many warehouse robots read codes on the floor even though they have wheel encoders?

Step 3 of 11Practice · Chart

Dead-reckoning drift, with and without floor codes

Tap the distance where the encoder-only robot is first off by more than 5 cm.

Tap the point that answers the question, then press Check.

Dead-reckoning drift, with and without floor codesLine chart with 11 categories: 0: Encoders only 0 cm, Encoders + code every 2 m 0 cm; 1: Encoders only 0.5 cm, Encoders + code every 2 m 0.5 cm; 2: Encoders only 1.1 cm, Encoders + code every 2 m 0 cm; 3: Encoders only 1.8 cm, Encoders + code every 2 m 0.5 cm; 4: Encoders only 2.6 cm, Encoders + code every 2 m 0 cm; 5: Encoders only 3.5 cm, Encoders + code every 2 m 0.5 cm; 6: Encoders only 4.5 cm, Encoders + code every 2 m 0 cm; 7: Encoders only 5.6 cm, Encoders + code every 2 m 0.5 cm; 8: Encoders only 6.8 cm, Encoders + code every 2 m 0 cm; 9: Encoders only 8.1 cm, Encoders + code every 2 m 0.5 cm; 10: Encoders only 9.5 cm, Encoders + code every 2 m 0 cm.0 cm2 cm4 cm6 cm8 cm10 cmPosition error012345678910Distance driven (m)
Illustrative numbers.
Dead-reckoning drift, with and without floor codes
Distance driven (m)Encoders onlyEncoders + code every 2 m
00 cm0 cm
10.5 cm0.5 cm
21.1 cm0 cm
31.8 cm0.5 cm
42.6 cm0 cm
53.5 cm0.5 cm
64.5 cm0 cm
75.6 cm0.5 cm
86.8 cm0 cm
98.1 cm0.5 cm
109.5 cm0 cm

Step 4 of 11Learn

Mapping and path planning

To navigate a space it has never seen, a robot needs two abilities: building a map and planning a path through it.

Many robots map with lidar or cameras, often as a grid of small squares marked free, occupied or unknown. The tricky part is that to build an accurate map, the robot needs to know where it is, and to know where it is, it needs a map. Roboticists solve both at once with SLAM (simultaneous localization and mapping): as the robot moves, it matches new sensor readings against what it has already seen, updating both its map and its estimate of its own position. Robot vacuums with lidar or cameras use SLAM to clean in neat rows instead of bouncing around randomly.

Once there's a map, path planning finds a route from start to goal that avoids obstacles. A common family of methods searches the grid like a maze, expanding outward from the start until it reaches the goal, preferring squares that head toward the goal. One well-known algorithm of this type is called A* (pronounced "A-star"), also used for characters in video games.

Finally, the robot must handle surprises: a person stepping into the path or a box left on the floor. Local obstacle avoidance reacts to these in real time, while the planner recalculates the route if the way is blocked.

Step 5 of 11Practice · Put in order

A new robot vacuum explores an unknown apartment and then cleans the kitchen. Put its tasks in a sensible order.

Drag the items, or use the arrow buttons, to put them in order.

  1. Scan the surroundings with its lidar
  2. Follow the path, avoiding unexpected obstacles
  3. Clean the kitchen in rows using the map
  4. Plan a path from its current spot to the kitchen
  5. Build a map while tracking its own position (SLAM)

Step 6 of 11Learn

Where AI fits in

"AI robot" can mean many things, so it helps to be precise. Much of what robots do uses classic, hand-written algorithms: the state machines, feedback controllers and path planners you've seen. These are predictable and well understood.

Machine learning (ML) is different: instead of writing rules, engineers train a model on lots of examples. ML shines where rules are hard to write:

  • Vision: recognizing people, packages, weeds or fruit in camera images. Nobody can write precise rules for "this is a ripe strawberry," but a model trained on thousands of labeled images can learn it.
  • Speech: understanding spoken commands.
  • Grasping: learning how to pick up oddly shaped objects through many attempts, sometimes in simulation first.
  • Walking: some legged robots learn balance and gait through trial and error in simulated worlds before running on real hardware.

ML also brings challenges. Models can fail in situations unlike their training data, such as a camera model trained in daylight struggling at night. It can be hard to explain why a model made a choice, which matters when safety is at stake. So real robots usually mix both: ML for perception and hard-coded safety rules (stop if anything is too close) that always override it.

Step 7 of 11Practice · Diagram

Hand-coded algorithms and machine learning in robots

Where do most real-world robots belong?

Tap the shape that answers the question, then press Check.

Hand-coded algorithms and machine learning in robotsVenn diagram: Hand-coded, Machine learning, Hand-coded only, Machine learning only, Hand-coded + Machine learning (overlap).Hand-codedMachine learning• Speed control• Path planning• Spotting weeds in photos• Grasping odd shapes• Self-driving cars• Warehouse robots
Hand-coded

Hand-written, predictable, easy to test.

Machine learning

Learned from examples; good with messy real-world data.

Hand-coded only

State machines and feedback controllers live here too: predictable and easy to test.

  • Speed control
  • Path planning
Machine learning only
  • Spotting weeds in photos
  • Grasping odd shapes
Hand-coded + Machine learning (overlap)

Most real robots combine both: learning for perception, classic code for control and safety.

  • Self-driving cars
  • Warehouse robots

Step 8 of 11Note

Step 9 of 11Practice · Chart

One-way radio delay from Earth

Tap the case where a "stop!" command would take longest to arrive.

Tap the bar that answers the question, then press Check.

One-way radio delay from EarthBar chart with 4 categories: Moon: 0.02 min; Mars, closest: 3 min; Mars, average: 12.5 min; Mars, farthest: 22 min.0 min5 min10 min15 min20 min25 minMinutesMoonMars, closestMars, averageMars, farthest0.02 min3 min12.5 min22 min
Approximate; the Moon is about 1.3 seconds away by radio.
One-way radio delay from Earth
ItemOne-way delay
Moon0.02 min
Mars, closest3 min
Mars, average12.5 min
Mars, farthest22 min

Step 10 of 11Practice · Select all that apply

Which tasks are especially good fits for machine learning in robots? Select all that apply.

Select all that apply.

Step 11 of 11Practice · True or false

Because they can learn, machine learning models in robots never need hard-coded safety rules.