Level 1 · Explorer · Middle school introduction. No prerequisites. · about 20 min
Sense, think, act: why robots need sensors
A robot can only get somewhere if it keeps checking how far it still has to go.
You'll be able to
- Describe the sense–think–act loop using a robot you have seen or used.
- Explain the difference between acting from a plan alone and acting on what a sensor reports.
- Work out the gap between where a robot is and where it wants to be, with units.
- Use a ratio to decide how often a moving robot needs to check its sensor.
Builds on
Nothing — start here.
01The problem
A small delivery robot has to stop in front of a classroom door so a student can lift a parcel out of its basket. Its designer measured the corridor, worked out that the wheels should turn exactly 40 times, and programmed exactly that.
On Monday it stopped in the right place. On Tuesday the floor had just been polished, the wheels slipped a little on every turn, and the robot stopped a hand's width short. On Wednesday someone left a bag in the corridor and the robot drove straight into it.
Nothing in the robot was broken. The plan was correct for the corridor the designer measured, but the corridor on Tuesday and Wednesday was different, and the robot had no way to notice. How can a robot reach the right place when the world doesn't match its plan? That question is where all of robotics control begins.
Watch the idea in action
before you read on
A short, verified video on exactly this idea. Pause whenever you want, then carry on with the explanation below.
In one minute, NASA engineers explain why rovers can't be joysticked from Earth and must plan drives carefully.
→ One minute. Notice why the rover can't be steered live from Earth, so it has to sense and decide for itself.
1 min · captions on YouTube · source
Nothing loads from YouTube until you press play.
02The idea
Sense, think, act
Every robot, from a robot vacuum to a Mars rover, repeats the same three steps many times a second:
- Sense: measure something about the world, such as the distance to a wall.
- Think: compare that measurement with what it wants and decide what to do.
- Act: turn a motor, move a joint or switch something on.
Then it goes straight back to step 1. That repetition is what makes a machine a robot rather than a wind-up toy.
Two ways to get somewhere
Imagine walking to a door with your eyes closed. You could count steps: "the door is 12 steps away, so I'll take 12 steps." That is acting from a plan. It works when everything goes exactly as expected, but if one step is shorter than usual, you never find out.
Now walk to the door with your eyes open. You keep looking, see how far is left, and adjust. If you slip, you notice and take an extra step. That is acting on feedback: the result of what you did is fed back into what you do next.
Engineers call the first way open loop and the second closed loop, because the information goes round in a circle: sense, think, act, sense again.
The most important number: the gap
The thinking step in a closed loop usually boils down to one subtraction:
gap = where I want to be − where I am
If the gap is large, the robot still has a long way to go. If the gap is zero, it has arrived. If the gap is negative, it has gone too far and should back up. The robot doesn't need to know why it is off target, whether it was slippery wheels, a slope or a push. It only needs to see the gap and keep making it smaller.
Why checking often matters
A sensor reading is a snapshot. Between two snapshots the robot is moving "blind". If a robot drives at 50 cm every second and checks its distance sensor 5 times a second, it travels 10 cm between checks. An obstacle that appears in that 10 cm stretch is only noticed afterwards. Checking more often makes the loop more alert, but it also needs a faster sensor and more thinking time.
Sensors are not perfect
Real sensors are a little bit wrong every time. A distance sensor might say 31 cm when the truth is 30 cm, and 29 cm a moment later. Good robots expect that and don't overreact to one odd reading. You will come back to this idea at every level of this expedition.
Recap
A robot gets somewhere by repeating sense–think–act. Following a plan alone fails as soon as the world changes. Measuring the gap between where it is and where it wants to be, and acting on that gap, lets it recover from slips and pushes it never expected.
03See it move
Predict before you experiment
At 5 seconds a steady push of −0.4 arrives. Which line do you think gets knocked further from where it was?
04The maths
Gaps, speeds and ratios
At this level the maths is subtraction, division and keeping track of units.
The gap has the same unit as the measurement:
gap = target − reading
If a robot on a straight track wants to be at the 100 cm mark and its sensor says it is at the 35 cm mark, the gap is 100 − 35 = 65 cm still to go. If it reads 110 cm, the gap is 100 − 110 = −10 cm: it has gone 10 cm too far and should back up.
Distance between checks is a ratio. Speed tells you centimetres per second; the check rate tells you checks per second. Divide one by the other and the "per second" cancels:
distance between checks = speed ÷ checks per second
(50 cm/s) ÷ (5 checks/s) = 10 cm per check
Turning it round: if you know the most a robot may travel blind, you can find how often it must check:
checks per second = speed ÷ largest allowed distance between checks
Always write the units next to each number. If the units don't come out right, the arithmetic is almost certainly wrong.
05Worked example
A robot starts 120 cm from its charging dock and should stop 20 cm from it. It drives at 25 cm/s and checks its distance sensor 5 times a second. How far must it travel, how far does it move between checks, and about how many checks happen before it arrives?
Show the worked solution
Distance to travel. gap = 120 cm − 20 cm = 100 cm.
Distance between checks. 25 cm/s ÷ 5 checks/s = 5 cm per check.
Number of checks. 100 cm ÷ 5 cm per check = 20 checks. At 5 checks a second that is 20 ÷ 5 = 4 seconds, which matches 100 cm ÷ 25 cm/s = 4 s.
Why it matters. Because the robot checks every 5 cm, it can never be more than 5 cm past the stopping point before it notices. If it only checked once a second it could overshoot by up to 25 cm.
06Your experiment
- Open the feedback lab and press Reset. The controller is P with Kp = 2 and “Compare with open loop” is on.
- Just before 5 seconds, read the height of each line from the graph: the bright closed-loop line and the dashed open-loop line.
- Open “More controls” and switch on the load disturbance at 5 s, keeping its size at −0.40.
- Read the height of each line again near the end of the run, at 10 seconds.
- Work out how far each line dropped after the push.
Record: Write down the four heights and the two drops. Then write one sentence explaining why the line that measures dropped less than the line that follows a plan.
07Guided practice
A robot vacuum moves at 30 cm/s and checks its bump sensor 10 times a second. How far does it travel between checks?
Hint
Divide the speed by the number of checks per second. The “per second” cancels.
Answer
30 cm/s ÷ 10 checks/s = 3 cm between checks.
A robot should stop 30 cm from a wall. Its sensor reads 80 cm. What is the gap, and should it move towards or away from the wall?
Hint
Subtract the target from the reading, and think about which way makes the reading smaller.
Answer
80 cm − 30 cm = 50 cm. The reading is bigger than the target, so it should move 50 cm towards the wall.
In the lab, the push lowered the open-loop line by about 0.39 and the closed-loop line by about 0.13. Roughly how many times smaller was the closed-loop drop?
Hint
Divide the bigger drop by the smaller one.
Answer
0.39 ÷ 0.13 = 3, so the robot that measures was knocked about three times less.
08Check your understanding
09Technical challenge
A delivery robot drives towards a doorway at 50 cm/s. To be safe, it must never travel more than 2 cm between sensor checks. What is the smallest number of checks per second it needs?
10Engineering & research
Every working robot is built around this loop. Robot vacuums check their bump and cliff sensors many times a second; warehouse robots check where they are against markers on the floor; robot arms in factories check the angle of every joint.
Tactiverge's proposed research study, TV-01, starts from the same idea. It asks whether two robot arms carrying a soft object together can keep going when the camera they rely on stops seeing clearly, for example when an arm blocks the view. The proposal is to add small, inexpensive force sensors to the grippers so the robots can still "feel" what is happening when they can't see it.
TV-01 is a proposed study. It has not been run and has no results yet. What it shows for now is how a big research question grows from the simple question in this lesson: what should a robot sense, and what should it do when that sense disappears?
Feedback · as a Explorer
A robot that keeps checking where it is can notice when it has slipped or been pushed, and fix it. Following a fixed plan without checking can't.
Something unclear or not working here? Tell us.
Original Tactiverge material, not yet externally reviewed by educators. CC BY 4.0.