TactivergeLite

Lite / Discovering How the World Works / 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 · Reviewed by the founders' mentors · Full interactive version

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?

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?

  1. It stops, because the sensor sees the person
  2. It drives into the person
  3. It slows down a little
Guess first, then reveal

It drives into them. It sensed and decided only once, then acted blindly. A real robot repeats sense–think–act many times a second, so a new obstacle is noticed within a fraction of a second.

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.

What the interactive shows (text version)

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.

You can also open the interactive on the full site when you have a faster connection.

Watch (optional)

Watch for: 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.

“Robots: Crash Course Computer Science #37” by CrashCourse (opens YouTube; streaming video uses a lot of data)

The video is optional. Everything you need is in this lesson's text.

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

Intuitive

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.

Technical

A controller runs a cycle: read inputs, compute outputs from the inputs and its rules, write outputs, repeat. The time for one cycle (the loop period) limits how quickly it can react.

Applied

A lift checks its door-edge sensor many times a second while the doors close. If someone's arm breaks the beam, the next cycle's decision is 'reopen', and the motors reverse almost instantly.

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

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

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?

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?

Reflect

Which part of sense–think–act do you think is hardest to get right in a real robot, and why?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Automatic or intelligent?Who decides: the robot or the human? →