Robot vacuum: rules and touch sensors

A top view: the robot bounces off furniture and picks up crumbs. A touch sensor removes each crumb and timer rules change its course.

2D Age 8+15 min Logic & robotsMomentum & collisions
Robot vacuum: rules and touch sensors
Loading simulation…

Press “Run”. Bodies move by the laws of physics: gravity, friction, elasticity.

What the experiment shows

A robot vacuum can’t see the whole room: it drives, bumps into an obstacle and turns away. Sensors and simple “if — then” rules let it clean most of the room.

How to run it

  1. Press “Run” and watch the crumbs disappear.
  2. Open the “Logic” tab: find the timed turn rules and the crumb sensors.
  3. Add another turn rule at the 36 second mark.

Questions to discuss

  • Which spots does the robot clean worst? Why?
  • How could it avoid getting stuck behind the sofa?

The science

A simple robot has no map: it drives straight and bounces elastically on contact. Random bounces and occasional timed turns cover the room, though not perfectly. The longer it runs, the more it covers — an example of a random walk.

Try it at home

Put a few boxes on the floor and push a toy car around: it never covers everything, but touches a lot.

What to change in the editor

  • Make the robot faster.
  • Rearrange the furniture to create dead ends.