TactivergeLite

Lite / Textbooks / Robotics From First Principles / Chapter 1

1. Sense, think, act

Version 1 · Technically checked (automated checks only) · 4 source lessons · Full interactive version

Introduction

Every robot, from a robot vacuum to a Mars rover, runs the same loop: read its sensors, decide what to do, drive its actuators, and go round again many times a second. This chapter takes the loop apart. What makes a machine automatic rather than intelligent, what sensors can and cannot tell you, what actuators do, and why the loop rate sets a hard time budget for everything inside it.

Figure 1.1. 50 Hz means 20 ms per pass (described in words)

A 20 ms time bar for a 50 Hz loop split into sense 4 ms, think 6 ms and act 2 ms, with 8 ms spare. An arrow returns to the start: then round again, forever. Used 12 of 20 ms.

Explanation

Built from 4 School lessons. Each part is the lesson's own explanation.

1.1 Automatic or intelligent?

A music box plays the same tune perfectly every time. A robot vacuum never cleans your room the same way twice. Which one is smarter?

Automatic machines repeat

A music box, a toaster with a timer, or a wind-up toy does the same steps in the same order, whatever is happening around it. That is automatic. It can be precise and useful, but if the world changes, it carries on regardless.

Intelligent machines respond

An intelligent machine senses something about the world, decides what to do using rules, and acts. A robot vacuum feels a bump and turns. A night light measures darkness and switches on. Change the world and its behaviour changes too.

Smart is a spectrum

Engineers rarely mean 'thinks like a person'. They mean 'does the right thing in more situations'. A light that turns on at 7 pm is automatic. One that turns on when it gets dark is a little intelligent. One that also learns when you usually come home is more intelligent still.

Common mix-ups

Open the Lite lesson: Automatic or intelligent?

1.2 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?

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.

Common mix-ups

Open the Lite lesson: Sense, think, act

1.3 Sensors: how machines feel the world

Bats find moths in the dark by shouting and listening. Which robot sensor copies them?

A sensor turns the world into a number

A sensor measures something physical and reports it as a reading the controller can use: a distance in cm, a temperature in °C, pressed or not pressed. Without sensors, a machine is blind and deaf.

A sensor zoo

On/off or a number

Some sensors give just two answers (digital: pressed or not). Others give a whole range (analogue: 0 to 100 cm). A bump switch only tells you that you hit something; a distance sensor tells you how close it is before you hit it.

Common mix-ups

Open the Lite lesson: Sensors: how machines feel the world

1.4 Actuators: how machines change the world

A robot hand must hold an egg and a steel bolt. Same motor, same fingers. How can it crush one and drop the other?

Actuators make things happen

An actuator is a part that the controller switches or drives to change the world. Common ones:

Joints are degrees of freedom

Each motor-driven joint gives a robot one way to move, called a degree of freedom. A gripper finger with a knuckle and a middle joint has two. More joints mean more possible poses, and more motors to control.

Actuators need feedback

A motor alone doesn't know how far it turned or how hard it's pushing. Pair it with a sensor (an encoder for angle, a pad for touch) and the controller can stop at the right place or the right squeeze.

Common mix-ups

Open the Lite lesson: Actuators: how machines change the world

Worked examples

Automatic or intelligent?: example 1

Is a microwave that runs for exactly 2 minutes automatic or intelligent? What would make it intelligent?

Solution

Automatic: it runs for 2 minutes whether the food is frozen or already hot. Adding a steam or temperature sensor and a rule like 'stop when the food reaches 70 °C' would make it respond to the food, which is intelligent.

Sense, think, act: example 1

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

Solution

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.

Sensors: how machines feel the world: example 1

A robot must stop before touching a wall and also know if it has been bumped from behind. Choose sensors.

Solution

Front: a distance sensor (ultrasonic or infrared), because it warns before contact. Back: a bump switch is enough, because it only needs to know that a bump happened.

Actuators: how machines change the world: example 1

Choose an actuator for: (a) the wheels of a robot car, (b) a robot's elbow joint, (c) an automatic door lock.

Solution

(a) DC motors: they spin continuously. (b) A servo: it turns to a chosen angle and holds it. (c) A solenoid: a short push or pull is all a lock bolt needs.

Interactive figures, in words

Figure 1.2 from Sense, think, act

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.

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.

Figure 1.3 from Sensors: how machines feel the world

Sort each part into Sense, Think or Act. Read the explanation after each choice, especially for any you got wrong.

The sorting activity can be replaced by this list. Sense: ultrasonic distance sensor, bump switch, thermometer, wheel encoder. Think: microcontroller. Act: DC motor, buzzer, servo motor, heater.

The interactive versions are in the full chapter.

Laboratory

These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.

Practice

Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.

  1. Which of these machines is intelligent rather than just automatic?
    Answer it in “Automatic or intelligent?”
  2. 'If the soil is drier than 30%, open the water valve.' Which stage is this sentence?
    Answer it in “Sense, think, act”
  3. A robot runs its sense–think–act loop 50 times every second. How many times does it run the loop in 3 seconds?
    Answer it in “Sense, think, act”
  4. A greenhouse needs to know when the soil is dry. Which sensor fits?
    Answer it in “Sensors: how machines feel the world”
  5. Is a speaker a sensor or an actuator?
    Answer it in “Sensors: how machines feel the world”
  6. Which actuator is best for pointing a camera at a chosen angle and holding it there?
    Answer it in “Actuators: how machines change the world”
  7. A robot arm has a shoulder, an elbow and a wrist, each turned by its own motor. How many degrees of freedom does it have?
    Answer it in “Actuators: how machines change the world”

Engineering applications

Robot vacuums

A robot vacuum senses bumps, cliffs and dirt, decides whether to turn, reverse or keep cleaning, and drives two wheels and a brush. Its whole behaviour is that loop repeated many times a second.

Missed deadlines

If the think step sometimes takes longer than the loop period, commands arrive late and the robot reacts to an old world. Engineers measure the worst case, not the average, and leave spare time in every pass.

Watch (optional)

Streaming video uses a lot of data. Everything you need is in the text.

Summary

Glossary

Sense–think–act loop
Most robots run a repeating cycle: read sensors, decide what to do, command actuators, then repeat, usually at a fixed rate. Field Guide
IMU (inertial measurement unit)
An IMU combines an accelerometer, which measures acceleration including gravity, and a gyroscope, which measures angular velocity; some add a magnetometer. Field Guide
Encoder counts and resolution
A rotary encoder reports rotation as a count of ticks. Its resolution is the number of counts per revolution (CPR), often four times the pulses per revolution with quadrature decoding. Field Guide
Degrees of freedom
The degrees of freedom of a mechanism are the number of independent ways it can move. A rigid body free in space has 6: three translations and three rotations. Field Guide

Project: A loop on paper

Design the sense–think–act loop for a robot that follows a line on the floor. List its sensors and actuators, write the rule it applies each pass in plain words, choose a loop rate and give a time budget for each stage with some spare.

Deliverables

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

References

← Contents2. Actuators and drives →