30% off your first 3 months

Get the deal

How robot vacuums plan their cleaning paths

by DuckyHelperNov 12, 20265 min read
Robotics

TL;DR:

  • Cleaning a floor is a coverage problem: visit every free cell of a map at least once, with as little overlap as possible.

  • A back-and-forth lane pattern covers an open rectangle; obstacles split it into regions that are covered one by one.

  • The robot tracks battery use and must keep enough charge to reach its dock.

Going from point A to point B is a path-planning problem with a clear answer. A vacuum robot has a different job: it must pass over every bit of floor, not just reach a place. That is called coverage path planning, and it is why a good robot drives in neat lines rather than wandering.

What it does on a robot

The robot first builds a map of the room, using sensors such as a LiDAR, a camera or bump sensors, and its wheel odometry to track where it has been. The simplest useful map is a grid: the floor cut into square cells, each marked free, blocked or already cleaned.

The cell size is tied to the robot. If the cleaning width is 0.3 m, using cells 0.3 m wide means one pass along a row of cells cleans that whole row.

Coverage patterns

The common pattern is the boustrophedon, a word for going back and forth like an ox plowing: travel along a lane, step sideways one cell, and come back the other way. It leaves no gaps and little overlap in an open rectangle. Spirals, wall-following and random bounce are other patterns. Wall-following is often used first to trace the room's edge.

Worked example: covering a room with a 2D map

Take a room 3.0 m by 2.4 m and a robot with a 0.3 m cleaning width. The grid is 3.0 / 0.3 = 10 cells across and 2.4 / 0.3 = 8 cells down, so there are 10 × 8 = 80 cells.

  1. Start in the top-left cell and drive along row 1 to the right: 9 moves.

  2. Step down one cell (1 move), then drive along row 2 to the left: 9 moves.

  3. Repeat for all 8 rows. Each row is 9 moves, and there are 7 steps down between rows.

  4. Total moves: 8 × 9 + 7 = 79, which is one fewer than the 80 cells, so every cell is entered exactly once.

Each move is 0.3 m, so the path is 79 × 0.3 = 23.7 m. At a speed of 0.3 m/s that takes 23.7 / 0.3 = 79 s. Real robots turn at the end of each lane, slow down and overlap lanes a little, so the real time is longer.

Now add a chair leg group that blocks a 2 by 2 block of cells (0.6 m by 0.6 m) in the middle. That leaves 80 − 4 = 76 cells to clean. The straight lanes that hit the block are cut into two pieces. The planner can treat the room as two or more regions and sweep each one, or it can sweep the whole room and drive around the block with a short detour along its edge. Either way, the target is 76 cells visited, plus the extra moves needed to travel between pieces.

Obstacles you did not know about

A map is never complete. A cable, a sock or a pet bowl appears where the map says free floor. The robot detects the obstacle with a bumper or a distance sensor, marks that cell blocked, and re-plans around it. Cliff sensors, which look down, mark the top of stairs as blocked so the robot does not fall.

Persistent objects like furniture are remembered in the map. Temporary ones may be cleared after a while, so the cell is checked again on the next run.

Docking and battery

The robot tracks its battery and estimates the energy needed to get home. If the remaining charge is only just enough for the trip back to the dock, it stops cleaning and drives there. Many robots then recharge and go back to the first uncleaned cell, since the map records exactly where cleaning stopped.

To dock, the robot drives toward the charger's location from the map and then uses a close-range signal, such as infrared beams or a visible marker on the dock, to line up its contacts.

Where it goes wrong

  • Wheel slip. Odometry drifts on rugs, so the map shifts. Robots correct this with their other sensors.

  • Reflective or dark floors. Cliff and distance sensors can be fooled.

  • Tangles. Cables, fringes and long hair can wrap around brushes and wheels.

  • Doors that change. A closed door that was open when the map was made splits the room in two.

  • Dock blocked. If a chair is in front of the dock, the robot cannot line up.

Safety: Before you clean brushes or touch wheels, switch the robot off and take it off the dock. If you build your own, use a battery pack with built-in protection, never charge it unattended, and keep spinning brushes covered so fingers and hair cannot reach them.

How real robots use it

Warehouse robots, lawn mowers and floor scrubbers face the same coverage problem. Each combines a map, a coverage pattern, local obstacle avoidance and battery management. For a robot that moves between places rather than covering them, see how mobile robots navigate a warehouse floor.

Try it yourself

Draw a 10 by 8 grid on paper, block out a few cells for furniture, and trace a back-and-forth path with a pencil. Count cells visited versus cells entered twice. Then try the same room with a spiral and compare the totals. Notice where the pattern forces you to cross cells you already cleaned.

Frequently asked questions

Why not drive randomly?

Random motion eventually covers a room but wastes time and battery, and leaves no guarantee that every cell was visited. A planned pattern is faster and can be checked against the map.

How does the robot know a cell is clean?

It does not sense dirt in the map. It marks a cell as covered when it has driven its cleaning width over it.

Get started

DuckyHelper can
do more

It sees your screen and works in any app you use. Try it for 10 minutes, no card.

Get it for Mac, Windows or Linux

Share

Questions and jobs

Do anything

Ask it a question or hand it a job, in any app.

Doing jobs for you is in early access on Mac. Asking works on Mac, Windows and Linux.