Computer science
Sensors & robots
Measure, decide, act: the loop that brings machines to life.
What you need first
A robot vacuum weaves through the living room, stops at the stairs, and finds its way back to the charging dock on its own. No human is steering it, and it has no eyes like yours. How does it do that? The answer lies in three building blocks that work inside almost every smart machine, from lifts to lawn mowing robots.
Three building blocks: sensor, program, actuator
A robot is made of three parts. Sensors measure the world: distance, brightness, temperature, or touch. The program decides: it reads the measurements and picks the next action according to its rules. Actuators act: motors, wheels, grippers, or speakers carry out the decision. Remember the chain: sensors are the senses, the program is the brain, actuators are the muscles.
Steps: 0
The loop: measure, decide, act
The special part is that these three steps run in a loop nonstop, many times per second. The vacuum measures the distance to the wall, decides to turn, turns, and immediately measures again. A traffic light with an loop buried in the asphalt measures whether a car is waiting, decides on the green phase, and switches. The autofocus in your phone camera measures sharpness, decides which way to adjust, and moves the lens. Without this loop, a robot would just be a machine blindly running its program, no matter what happens around it.
When the senses deceive
Sensors are not perfect. A distance sensor gives five slightly different values across five measurements, sunlight blinds sensors, and a black carpet swallows the signal so much that some vacuums mistake it for a cliff. Good programs expect this: they measure several times, take averages, and combine multiple sensors before deciding. So whoever builds robots needs not only programming skills but also a sense of how much to trust their measurements.
Exercises
0 of 6 solvedTime to try it yourself. You can't break anything, every attempt counts.
What is the job of a sensor?
The motor that turns the robot vacuum is an example of which building block?
How many steps does the measure, decide, act loop consist of?
Match each building block with its job.
A robot on the grid drives 3 cells to the right, turns, and drives 4 cells up. How many cells does it travel in total?
Put the loop of a robot vacuum in the correct order.
- 1The motor turns the robot
- 2The sensor measures the distance to the wall
- 3The program decides to turn
Where this leads