A robot vacuum seems delightfully ordinary: place it on the floor, press a button, and watch it move. Underneath that motion, however, lies a compact meeting of geometry, probability, graphs, optimisation and measurement. The machine must represent where it believes free space and obstacles are, relate sensor observations to that representation, choose reachable movements, cover useful floor area and respond when the world changes.
This is why mathematics is important in robotics. It does not grant the robot magical certainty. It gives the system disciplined ways to represent uncertainty, compare routes and test whether a mission is complete enough. The same ideas appear in warehouse robots, mapping systems, search and rescue, computer games and geographic information systems, although real products differ in sensors, algorithms and design priorities.
For students, the topic turns school mathematics into a visible sequence of decisions. Coordinates locate the robot. Grids discretise a room. Percentages measure coverage. Graphs describe connectivity. Distances and costs compare routes. Probability records uncertain occupancy. Every model has limits, which makes the project as much about reasoning as calculation.
Did You Know? In an occupancy grid, a cell is not necessarily labelled with an unquestionable fact. A classical formulation stores an estimate of the probability that the corresponding region is occupied. A map can therefore be revised as new observations arrive.
Quick Navigation
- The short answer
- From a floor to a grid
- Occupancy as probability
- Robot size and obstacle inflation
- Coverage is not just shortest path
- A worked coverage example
- Graphs and route planning
- Turns, overlap and battery
- Localisation and changing rooms
- Common misconceptions
- How students can build the skill
- Guidance for parents and teachers
- Frequently asked questions
- Sources and next reading
The Short Answer
A robot vacuum needs more than one route from A to B. It needs a representation of the room, a model of its own footprint, a policy for exploring unknown areas, a way to visit the accessible floor, and rules for handling obstacles, energy and uncertainty. Mathematics makes each part explicit.
An occupancy grid divides space into cells. Each cell can carry a belief about whether it is occupied. Geometry transforms sensor observations and checks clearance. A graph connects allowable positions. A planner assigns movement costs and searches for a route. A coverage strategy chooses sweeps or regions so that the mission visits much of the reachable area. Performance measures such as coverage ratio, travel distance, turn count and revisit ratio help compare alternatives.
No single measure defines the best behaviour. A route with maximum early coverage may not be shortest. A route with few turns may revisit a corridor. A very fine grid may capture detail but demand more memory and planning. A high percentage can be misleading if the denominator includes unreachable floor or excludes inconvenient corners. The mathematical value lies in defining the question honestly before optimising it.
From a Floor to a Grid
A real room is continuous. The robot could, in principle, occupy infinitely many coordinate positions. A digital planner needs a finite representation, so a grid divides the floor into cells of declared size. Each cell stands for a small region rather than a mathematical point.
Resolution creates a trade-off. Suppose a 4 m by 3 m rectangular room is represented using 10 cm square cells. Ignoring boundaries for the illustration, the grid has 40 by 30 = 1,200 cells. With 5 cm cells, it has 80 by 60 = 4,800 cells—four times as many. The finer grid can represent narrower details, but it also increases storage and search work.
Coordinates need a convention. A student can number rows and columns from zero, place the origin at a selected corner, and define whether row numbers increase upward or downward. Without that convention, the cell (3,5) is ambiguous. The map also needs a transformation between world units and grid indices. If cell width is s metres, a simple mapping might use floor(x/s) and floor(y/s), with careful treatment of negative coordinates and boundaries.
Discretisation introduces approximation. A diagonal wall becomes a staircase of cells. A thin chair leg may occupy part of a cell. Marking the whole cell occupied is conservative but removes free space; marking it free risks collision. A probabilistic grid can express uncertainty, yet the physical footprint and safety policy still matter.
The representation should distinguish at least three conditions: free, occupied and unknown. Unknown is not the same as free. Treating unseen cells as open can lead the planner through unobserved obstacles. Treating all unknown cells as permanently blocked prevents exploration. An exploration policy must decide when gaining information is worth travel and risk.
This distinction also encourages intellectual honesty: a responsible map records uncertainty instead of converting every unanswered question into a convenient assumption.
Occupancy as Probability
The occupancy-grid approach models space as an array of cells with occupancy estimates. In Alberto Elfes's foundational account, it is a stochastic spatial representation intended to integrate range information for tasks including mapping, planning and obstacle avoidance. The important word is stochastic: sensor observations have uncertainty.
Let P(O) denote the estimated probability that a cell is occupied. A value near 1 expresses strong occupancy belief; a value near 0 expresses strong free-space belief; a value around 0.5 may express uncertainty under a chosen prior. These values are model outputs, not direct physical measurements.
When a sensor reports a range, cells along the observed ray may gain evidence of free space while the endpoint region gains evidence of an obstacle. Repeated observations can strengthen or revise belief. A full Bayesian update requires a sensor model and assumptions. Many implementations use log-odds because independent evidence can then be accumulated through addition, but a classroom activity can begin with a transparent update table.
Students should not invent precision. If an activity says a cell has occupancy probability 0.73, it needs a declared method or synthetic rule. The number is not automatically trustworthy because it has two decimal places. Calibration matters: among many cells assigned about 0.7, roughly 70% would be occupied under a well-calibrated interpretation and suitable test conditions.
A planner often converts probability into decisions using thresholds, for example treating high-probability cells as obstacles and low-probability cells as free. Middle values may remain unknown or carry extra traversal cost. The threshold is a policy choice. Moving it changes the balance between caution and access.
Robot Size and Obstacle Inflation
Planning only the robot's centre can create a dangerous illusion. A centre point might pass beside a table leg while the circular body collides with it. One mathematical solution is to inflate obstacles by the robot's effective radius and then plan the centre as a point in the remaining free space.
For a circular robot of radius r, every obstacle is expanded by distance r. This resembles a Minkowski sum: combine obstacle geometry with a reflected robot footprint. On a grid, inflation may mark all cells within an appropriate distance of an occupied cell as unavailable. A safety margin can be added for localisation and map uncertainty.
Imagine a corridor 70 cm wide and a robot 34 cm in diameter. Pure geometry leaves 36 cm total clearance, or 18 cm per side if perfectly centred. If mapping error and body protrusions require a 6 cm margin on each side, the effective diameter becomes 46 cm and the remaining clearance is 24 cm total. The route may still be feasible. If the corridor narrows to 44 cm, the raw body could fit, but the margin-aware model would reject it.
This is not a product specification. It is a modelling lesson: feasibility depends on the footprint and margins used. Students should state whether the radius includes brushes, protective clearance and uncertainty. A path declared safe for a point is not necessarily safe for a physical machine.
Obstacle inflation also reveals a topological change. Two separate inflated obstacles may merge and close a passage. A small increase in radius can therefore eliminate an entire route, not merely add a small cost. Sensitivity analysis is essential near narrow gaps.
Coverage Is Not Just Shortest Path
A shortest-path problem asks how to travel from a start to a goal with minimum cost. A coverage-path problem asks how to visit an area or set of targets sufficiently completely. Returning to the dock may then add a start-and-goal requirement, but the central task is different.
A lawnmower or boustrophedon pattern sweeps parallel strips and reverses direction at boundaries. It is easy to understand and can give systematic coverage in simple regions. Non-convex rooms, furniture islands and narrow passages complicate the sweep. Decomposition methods divide the environment into cells or regions that can be covered more simply, then plan transitions among them.
Turns matter. Research on coverage planning notes that turns can affect traversal time and operational quality. A horizontal sweep and vertical sweep may cover the same rectangle with identical straight-line distance but different numbers of row transitions if the rectangle is much longer in one direction. Choosing sweep orientation becomes a mathematical decision.
Overlap matters too. The cleaning footprint has width. Adjacent passes need enough overlap to avoid gaps under positioning error, but excessive overlap increases revisiting. Along irregular boundaries, a centreline that seems to cover the grid may leave small physical slivers if footprint geometry is ignored.
Coverage can be measured on cells, area, edges or targets. Each denominator needs a definition. If reachable free cells total R and uniquely visited reachable cells total V, cell coverage is 100V/R percent. This says nothing by itself about cleaning effectiveness, dirt pickup, edge quality or time.
A Worked Coverage Example
Consider a 6 by 8 grid containing 48 cells. Ten cells are occupied by furniture or walls, leaving 38 reachable free cells in this simplified example. Suppose a planned mission visits 35 distinct reachable cells. The cell-coverage ratio is
35 / 38 × 100% ≈ 92.1%.
If the robot made 52 free-cell visits in total, including repeats, then 17 visits were revisits because 52 − 35 = 17. One possible revisit fraction relative to all free-cell visits is
17 / 52 × 100% ≈ 32.7%.
That does not prove 32.7% of energy was wasted. Some repeated cells may connect separate regions or lead to the dock. The metric identifies behaviour for investigation; interpretation needs context.
Now suppose two of the three unvisited cells are actually isolated by inflated obstacles. If they are not reachable under the declared footprint, keeping them in the denominator unfairly depresses coverage. The corrected reachable count would be 36 and visited count 35, giving about 97.2%. A truthful report should not change the denominator after seeing the result. Reachability rules should be fixed first and the isolated cells documented.
Alternatively, suppose the planner labelled an unknown region as occupied without observation. The denominator shrinks and coverage rises, but the map may have hidden a navigable area. This is why coverage, explored fraction and map confidence should be reported separately.
Graphs and Route Planning
A grid can become a graph. Each traversable cell is a vertex. Edges connect allowed moves, commonly north, south, east and west. If diagonal motion is permitted, four diagonal edges may be added. Edge weights can represent distance, time, energy, risk or a combination.
With square cells of side s, an orthogonal move has length s. A diagonal between cell centres has length s√2. Assigning both cost 1 understates diagonal distance. Sometimes that simplification is intentional, but the modeller must say so.
Dijkstra's algorithm can find lowest-cost paths with non-negative edge weights. A-star adds a heuristic estimate h of remaining cost and orders exploration by f = g + h, where g is cost already travelled. For a four-neighbour grid with uniform costs, Manhattan distance is a natural heuristic. For eight-neighbour movement, a different estimate may be more appropriate.
A heuristic guides search; it does not change the physical map. If optimality is claimed, its conditions matter. An overestimating heuristic can produce a useful route quickly but may lose the standard optimality guarantee. Students should avoid repeating “A-star is always shortest” without specifying costs, heuristic properties and implementation.
Coverage adds another layer. The robot may plan a sequence of regions, then use shortest paths to connect them. A greedy choice of the nearest unvisited cell can fail because it ignores future structure. It may enter a cul-de-sac, then make a long return. This resembles the difference between local and global optimisation.
The graph can also encode orientation. A state becomes (cell, heading), and turning changes heading at a cost. Two paths of equal geometric length can then have different total costs. This richer state space is larger but better represents a robot for which rotations consume time and create overlap.
Turns, Overlap and Battery
Imagine two coverage routes each travel 40 metres. Route A has 12 ninety-degree turns; Route B has 28. If a training model assigns 0.6 seconds to each turn beyond straight travel, Route A's turning allowance is 7.2 seconds and Route B's is 16.8 seconds. The difference is 9.6 seconds. The numbers are fictional, but the method shows how an ignored action can change comparison.
Energy models can include distance, turns, cleaning power, sensor activity and surface conditions. A simple classroom model might set energy E = aD + bN, where D is distance and N is number of turns. This is not a product battery law. It is a transparent objective for comparing synthetic paths.
Return-to-dock planning introduces a reserve constraint. If remaining capacity is estimated at 20 units and the cost to the dock is 8, a policy may protect a declared reserve rather than spend all 12 spare units exploring. Uncertainty should widen the margin. A plan that is optimal under exact costs can be fragile when wheel slip or detours occur.
Overlap connects geometry with coverage quality. If the effective cleaning swath is w and adjacent path centre lines are separated by d, nominal overlap is w − d when d ≤ w. With w = 30 cm and d = 27 cm, overlap is 3 cm, or 10% of swath width. But boundary following, turning and localisation error can change actual coverage.
Students should keep path coverage and cleaning performance separate. Visiting a cell does not prove all dirt was removed. A map-based study can validly investigate planning without making unsupported claims about cleaning quality.
Localisation and Changing Rooms
The robot needs an estimate of its pose: position and orientation. Wheel encoders can accumulate error through slip. Range observations can be ambiguous. A chair may move. A door may open. Mapping and localisation therefore interact.
Simultaneous localisation and mapping, or SLAM, addresses the coupled problem of estimating a map while estimating pose within it. This article does not attempt a full SLAM derivation. The transferable idea is that measurements are interpreted relative to an uncertain pose, while landmarks in the map can help correct that pose.
Suppose a synthetic robot believes it moves 25 cm per command but actually moves 24.5 cm. After 20 commands, the estimated distance is 5.00 m while actual distance is 4.90 m, producing 10 cm error. A landmark observation can reduce the discrepancy, but if the landmark is misidentified, the correction may be wrong.
Dynamic obstacles require classification. A person standing in a corridor should block the immediate path. It should not necessarily become a permanent wall in the long-term map. A newly placed cabinet may be persistent. The robot needs time, repeated evidence or policy to distinguish these cases.
Replanning can be local or global. A local detour is efficient when the map is mostly unchanged. A global plan may be necessary when an important passage closes and region order must change. Bounded computation matters because the robot is moving in real time.
The best response can include stopping. Mathematics helps compare alternatives, but a safe policy may refuse a route when uncertainty is too high. Optimisation always sits inside constraints.
Common Misconceptions
“The map is a photograph of the room.”
An occupancy grid is a spatial model at a chosen resolution. It stores cell beliefs, not visual appearance. It may be incomplete, uncertain and time-dependent.
“The shortest route cleans the most.”
A shortest path connects locations. Coverage requires visiting an area. A short route to the dock may cross little new floor; a longer systematic sweep may provide more coverage.
“A smaller grid cell is always more accurate.”
Finer resolution captures more detail but increases computation and may exceed sensor certainty. Accuracy depends on the entire measurement and modelling pipeline.
“One hundred percent means perfect cleaning.”
Cell coverage means the defined reachable cells were visited under the model. It does not certify dirt removal, edge performance or real-world effectiveness.
“The robot only needs to avoid occupied cells.”
It must consider its footprint, clearance, unknown space and localisation error. Obstacle inflation or configuration-space reasoning connects cell labels with physical feasibility.
“A plan stays valid once computed.”
Rooms change and estimates drift. Useful systems detect obstacles, update beliefs and replan. A route is conditional on a map version and assumptions.
How Students Can Build the Skill
Begin on graph paper. Draw one room with a doorway and obstacle. Choose grid size, origin and coordinate convention. Classify cells as free, occupied or unknown. Then represent the same plan at a different resolution and explain the differences.
Progress through these stages:
- count reachable cells and calculate coverage;
- inflate obstacles for a circular footprint;
- convert free cells into a graph;
- compare breadth-first or Dijkstra paths with an A-star search;
- generate horizontal and vertical sweep routes;
- add turn and revisit costs;
- insert a dynamic obstacle and replan;
- vary parameters and report sensitivity.
Use synthetic data before relying on a real product. A spreadsheet or short program can model cell states and paths. If a physical toy robot is used, maintain safe supervision and follow its instructions. Do not modify safety systems or infer product capabilities from a classroom model.
Students can connect the route problem to school commutes, maps and route planning. For perception and movement in images, read optical flow, image gradients and motion estimation. The Mathematics Learning Hub links these ideas with geometry, probability and computing.
An excellent report includes the raw map, parameters, algorithm description, path, metrics, failures and limitations. A colourful route image without the denominator or footprint is not enough.
Guidance for Parents and Teachers
Ask “what does this cell mean?” If the learner answers only “black is blocked,” continue: blocked with what confidence, at what resolution, for which robot radius, and at what time? The questions turn a picture into a model.
Reward honest uncertainty. A student who marks cells unknown and explains what observation would resolve them shows stronger reasoning than one who fills the map with invented certainty. Encourage confidence labels and versioned maps.
Separate algorithm performance from product judgement. A classroom planner on a rectangular grid cannot fairly rank commercial devices. It can compare two declared strategies under the same synthetic conditions.
Use multiple measures. Coverage, path length, turns, revisits, clearance and compute time describe different features. Have students explain the trade-offs rather than collapse everything into a mysterious composite score.
Keep career advice open. Robotics draws on mathematics, computing, mechanical and electrical engineering, design, safety, testing and human factors. Learning grids and graphs is valuable preparation, but one topic does not guarantee a course place or occupation.
Frequently Asked Questions
What is an occupancy grid?
It is a spatial representation that divides an environment into cells and associates each cell with information about occupancy, often probabilistic. The grid is a model with chosen resolution, not a perfect copy of the room.
Why use probability instead of only free or occupied?
Sensors and poses are uncertain. Probabilities or related confidence representations allow evidence to accumulate and be revised. Decisions can still apply thresholds, but the underlying uncertainty remains visible.
What mathematics is used in robot vacuums?
Useful topics include coordinates, geometry, trigonometry, probability, graphs, algorithms, optimisation, percentages, vectors and statistics. Real systems may use much more, but these foundations already explain important mechanisms.
Is A-star always the best algorithm?
No. Its suitability depends on the state space, costs, heuristic, map changes and performance needs. It is a powerful route-search method, not a universal solution to mapping and coverage.
Why inflate obstacles?
The robot has a body rather than being a dimensionless point. Expanding obstacles by the footprint and margins lets a point-centre planner reject routes that would cause the body to collide.
How is coverage calculated?
One simple measure is unique visited reachable cells divided by all reachable cells. The report must define reachability, cell resolution and whether unknown regions are included.
Are repeated cells always wasteful?
No. Revisits may be needed to connect regions, return to the dock or navigate around obstacles. A high revisit ratio is a prompt for investigation, not automatic proof of failure.
Can a student test a real robot vacuum?
Only within safe, ordinary use and its instructions. A school investigation can instead use paper maps, simulations or a toy platform. Do not alter safety features or create hazardous obstacles.
Sources and Next Reading
Alberto Elfes's paper Occupancy Grids: A Stochastic Spatial Representation for Active Robot Perception describes the occupancy-grid framework and its use in sensor integration, mapping, planning and obstacle avoidance. A Roomba coverage-path planning simulation paper provides a documented research example connecting household robotics with coverage planning.
Research on partitioning non-convex environments for minimum-turn coverage discusses the relevance of turns and sweep directions. A review and algorithmic study of smooth complete-coverage trajectories gives further context on continuous paths and coverage design. These sources support mechanisms; they do not imply that any particular commercial robot uses the same implementation.
Continue with Why Mathematics? | Jigsaw Puzzles, Edge Matching and Search Complexity to compare spatial constraints and search, or visit the Mathematics Learning Hub for more routes through problem-solving skills and mathematics in technology.
The hopeful lesson is simple: a room that looks messy to a robot can become a structured question. Mathematics helps the machine keep track of what it knows, what it does not know, where it can go and how much useful work a proposed path is likely to accomplish.
A Practical Mathematics Studio
These investigations use drawings, synthetic data or simple sound-making. They are for learning and comparison, not for operating equipment or certifying a product. Complete a few carefully, record assumptions, and make each result reproducible.
Investigation 1: Draw an occupancy grid
Overlay a square grid on a simple room plan and label each cell free, occupied or unknown. Change the cell size and compare memory, geometric detail and the number of planning steps. A finer grid is not automatically better if sensor uncertainty and computation do not justify the extra precision.
Investigation 2: Update belief
Assign prior occupancy probabilities to a few cells, introduce a synthetic sensor observation and update the values with a stated rule. Keep the observation model explicit. The aim is to see that a map stores uncertain belief, not perfect knowledge painted in black and white.
Investigation 3: Inflate obstacles
Represent the robot as a disk with a declared radius and expand obstacles by that radius on the grid. Then plan the centre point as if it were dimensionless. Compare the raw and inflated maps to see why a path through free-looking cells may still be physically impossible.
Investigation 4: Measure coverage
Count reachable cells and visited reachable cells, then calculate coverage percentage. Mark revisited cells separately. Verify that obstacles and genuinely unreachable regions are not quietly included in the denominator, because a polished percentage is meaningless when its population is wrong.
Investigation 5: Compare sweeps
Run horizontal, vertical and diagonal lawnmower patterns on the same toy room. Count travel distance, turns and uncovered cells. Avoid declaring a universal winner: room geometry and turn cost can reverse the ranking.
Investigation 6: Build a cell graph
Turn free cells into graph vertices with edges between allowed neighbours. Try four-neighbour and eight-neighbour movement and state the cost of a diagonal. Explain why changing connectivity changes both reachable paths and the meaning of shortest.
Investigation 7: Use A-star honestly
Assign g as cost travelled, h as an estimated remaining cost and f = g + h. Trace a tiny search by hand. Check that the heuristic does not overpromise if optimality is claimed; otherwise describe the result simply as a useful search order.
Investigation 8: Penalise turns
Add a cost when heading changes and compare paths with equal distance but different numbers of turns. Discuss why rotation, deceleration and brush overlap can make turn count operationally relevant even though a point robot on graph paper ignores those effects.
Investigation 9: Model battery reserve
Give each move and turn a fictional energy cost, reserve enough to return to a dock and plan a partial mission. Recalculate after one blocked corridor. The task separates route length from resource feasibility and shows why a complete-looking plan may be unsafe to start.
Investigation 10: Insert a moving obstacle
Place a temporary object in the next planned cell. Replan locally, then remove it and decide whether the stored map should change. Distinguish a persistent map update from a transient obstacle so one passing person does not permanently erase a route.
Investigation 11: Track localisation drift
Add a small coordinate error after each synthetic move and compare estimated with true position. Introduce a landmark correction and observe the jump. State that this is an illustration, not a complete SLAM algorithm, but use it to show why mapping and localisation influence each other.
Investigation 12: Find frontier cells
Mark free cells adjacent to unknown cells and treat them as exploration candidates. Score candidates by travel cost and expected new area. Vary the weights and record when the chosen frontier changes, revealing that exploration policy contains priorities rather than one inevitable answer.
Investigation 13: Test a narrow passage
Create two routes, one short and narrow and one longer with more clearance. Change robot radius and localisation uncertainty. Explain why the geometric shortest path may not be the robust path when small errors have large collision consequences.
Investigation 14: Audit revisit ratio
Compute total cell visits, unique visited cells and revisit ratio for two strategies. Interpret some revisiting as necessary for turns, docking or transit rather than automatically calling it waste. A metric helps only when its exceptions are understood.
Investigation 15: Separate map from plan
Give two teams the same map but different objectives: minimum time and maximum early coverage. Compare their paths. This makes clear that the occupancy grid describes estimated space, while the planner adds goals, costs and constraints.
Investigation 16: Run sensitivity checks
Change grid resolution, obstacle inflation, turn penalty and sensor confidence one at a time. Record the chosen route and coverage result. When a tiny change causes a large plan change, report that instability instead of presenting the original route as certain.
Investigation 17: Write a mission log
Store map version, start pose, parameters, planned path, detected obstacles, replans, coverage and stopping reason. A peer should be able to replay one decision. Reproducibility matters because a final floor trace alone cannot reveal which assumptions produced it.
