Skip to content
Tactiverge

School/◇ Explorer/Week 19

Sense, think, act

A robot vacuum bumps a chair leg, backs off and turns. In that half second it did three different jobs. What were they?

About 25 min · 3 goals · Checked by automated tests; not yet reviewed by an educator

1.Why should I care?

Sense–think–act is the skeleton of every robot ever built, from a toy line-follower to a Mars rover. Once you can see it, you can understand any intelligent machine by asking three questions: what does it measure, how does it decide, and what can it change?

  • ◇ Describe the three stages of the sense–think–act loop.
  • ◇ Identify each stage in a real machine.
  • ◇ Explain why the loop must repeat, not run once.

2.Predict

A robot checks its distance sensor once at the start of a corridor, decides 'all clear', then drives for 10 seconds. Someone steps out in front of it after 3 seconds. What happens?

Guess first. Being wrong here is how the surprise works.

3.Discover

This robot's 'think' step is one rule. Slide the sensor reading towards the wall and watch the decision change. Each time you move the slider, you are doing one more turn of the loop.

If / else rule tester

A robot has a distance sensor on its nose. Write its rule, then move the reading and watch which branch runs. Try readings exactly on the threshold.

IF distance < 20 cm THEN Stop ELSE Drive forward

Comparison
20 cm
35 cm

Is 35 < 20? No, so the ELSE branch runs: Drive forward.

Every reading from 0 to 100 cm (lime = THEN, cobalt = ELSE):

050100 cm
Test cases (good testers always try the edges)
ReadingConditionAction
5 cmtrueStop
19 cmtrueStop
20 cmfalseDrive forward
21 cmfalseDrive forward
60 cmfalseDrive forward
100 cmfalseDrive forward
Can't use the interactive? Read a description instead

The rule tester can be replaced by this description: the rule is 'IF distance < 20 cm THEN stop ELSE drive forward'. At 35 cm the condition is false so the robot drives; at 15 cm it is true so it stops; at exactly 20 cm, 20 < 20 is false, so it still drives.

4.Watch

→ Watch for robots that sense, decide and move again and again, and the one example that does not sense at all.

From factory arms to rovers: how robots sense, decide and move, including a first look at feedback control.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

5.Understand

Sense

Measure something about the world: a distance, a temperature, a colour, whether a button is pressed. A machine can only react to what it can measure.

Think

Compare the measurement with what you want and choose an action. At this level the thinking is usually a rule: if the wall is closer than 20 cm, stop. Rules can be simple and still produce clever-looking behaviour.

Act

Change something in the world: spin a motor, open a valve, sound a buzzer, light an LED. The parts that do this are called actuators.

Then do it again

Acting changes the world, so the next measurement is different. The loop goes round and round, often hundreds of times a second. That repetition is what lets a robot notice surprises and correct itself.

Explain it another way

Crossing a road is sense–think–act: you look (sense), judge whether the gap is big enough (think) and walk or wait (act). And you keep looking while you cross.

Worked example 1

Split a smart greenhouse fan into sense, think and act.

Sense: a thermometer reads 31 °C. Think: the rule says 'if hotter than 28 °C, run the fan'; 31 > 28, so run it. Act: the fan motor turns on. Then the loop repeats: when the reading falls below 28 °C, the rule switches the fan off.

Common mix-ups

  • A robot senses once, makes a plan and follows it.
    ✓ Reliable robots sense again and again while they act, so they can react to changes.
  • Only motors count as actuators.
    ✓ Anything that changes the world on the machine's command counts: valves, heaters, lights, speakers.

6.Practice

Practice, not a test. Wrong answers get a hint and another try.

Practice 1

A robot counts how many times its wheel has turned. Which stage is that?

Practice 2

'If the soil is drier than 30%, open the water valve.' Which stage is this sentence?

Practice 3

Why must the sense–think–act loop keep repeating?

Practice 4

A robot runs its sense–think–act loop 50 times every second. How many times does it run the loop in 3 seconds?

7.Apply it

Design the sense–think–act loop for an automatic cat-flap that only lets your cat in. Name the sensor, write the rule as an IF sentence, and name the actuator. What should happen if the sensor can't tell?

8.Reflect

Concepts: The sense–think–act loop · Open-loop and closed-loop control