By the end of this lesson you will be able to
- describe control as a repeating cycle of sensing, deciding and acting
- tell the difference between acting blindly (open loop) and acting on measurements (closed loop)
- explain why a robot's program runs as a fast, repeating cycle
- explain why a person still needs to understand robot code, even when an AI tool has written it
- find your way around the course: Bramble, the workshop, and how the exercises work
You are Eleanor Price, a technician at the Ashdown Robotics Workshop. In the earlier courses you learned to find faults in Bramble, the workshop's humanoid robot, and how its motors, sensors and batteries work. Now Henry Wren, your mentor, wants you to learn the part that ties it all together: the programs that tell Bramble what to do. “Hardware is the body,” he says. “Control is how the body is used.”
This course does not assume that you have taken the other two courses, or that you have ever written a program. Everything you need is explained as you go.
Meet Bramble and the people
Bramble (model HR-7) is a humanoid robot about 1.6 metres tall with a mass of 70 kilograms. It works as a guide in a small museum. It greets visitors, walks them round the rooms and, when asked, carries things. The people you will meet are:
| Person | Role |
|---|---|
| Henry Wren | Senior technician at the workshop, and your mentor. |
| Margaret Ellis | The workshop manager. She decides what may be tried on the real robot. |
| Alice Bennett | The curator of the museum where Bramble works. She asks for new things for Bramble to do. |
| Oliver Grant | Bramble's daily operator at the museum. He tells you what the robot actually does. |
| Thomas Hale | The previous technician, who has left, but whose old programs and notes you will sometimes read. |
Bramble, the workshop and the people are invented for this course. Bramble's figures are realistic for a robot of its size, but they are not taken from any real product.
What “control” means
To control something is to make it do what you want, even though the world keeps interfering. A person carrying a full cup of tea is controlling it all the time: watching the surface of the tea, feeling the weight, and making small corrections so it does not spill. Nobody plans every muscle movement in advance; they notice and correct, over and over.
A robot does the same thing in three steps, repeated again and again:
- Sense. Read the sensors: where each joint is, which way the body is leaning, how hard the feet press on the floor.
- Decide. Compare what the sensors say with what is wanted, and work out what to do about the difference.
- Act. Send commands to the motors.
Open loop and closed loop
There are two basic ways to make a machine do something.
- Open loop means acting without checking the result. “Run the elbow motor for half a second” is open loop: the program hopes that half a second is the right amount. If the arm is carrying something heavy, or the joint is stiff on a cold morning, it will end up somewhere else, and the program will never know.
- Closed loop means measuring the result and correcting. “Keep moving the elbow until its sensor reads 90°” is closed loop. The sensor’s reading is fed back into the decision, which is why this is also called feedback control.
Open loop is simple and sometimes good enough. Closed loop copes with the unexpected, which is why almost everything a humanoid robot does, from holding a joint still to standing upright, uses feedback. Module 3 shows open loop and its weaknesses; Module 4 builds feedback control step by step.
The control cycle runs fast
A control program does not run once. It runs as a loop, typically 100 to 1000 times a second. Each pass through the loop is one control cycle: read the sensors, decide, send commands, then do it all again. The time between passes is short enough that the robot seems to react smoothly and at once.
Why so fast? A standing robot is always starting to topple. If Bramble checked its balance only once a second, it could lean far enough to fall before it noticed. Checking a hundred times a second, it notices a lean of a fraction of a degree and corrects it before it grows. Lesson 8.3 lets you see what happens when the cycle is too slow.
How this course works
Almost every lesson has short programs for you to run and change, and exercises that are checked automatically. Your programs control a simulated Bramble: a model that lives inside the page and draws what the robot does. When you run a program, you see a replay of Bramble moving, the messages your program printed, and anything worth knowing that happened, such as a joint reaching the end of its travel or the robot falling over.
The programs are written in JavaScript. You do not need to know it already: Module 2 teaches all the programming this course uses.
The simulator is a simplified teaching model, not a full physics engine. It is realistic about the things this course teaches: joint limits, speed limits, feedback loops, sensor noise, balance on a small foot. But some parts are deliberately simplified. Walking, in particular, is modelled as a sequence of checked steps rather than as real contact between feet and floor. The ideas and habits you learn are the real ones; the exact numbers on a real robot would differ.
Why understand the code when an AI can write it?
AI tools can now write working programs from a description in plain words, including programs for robots. So why should you learn to read and write control code yourself? There are four good reasons, and they matter more for robots than for most software.
- Code that looks right can be wrong in ways that hurt. An AI tool can produce a program that runs without errors but uses the wrong unit, turns a joint the wrong way, or forgets to check the stop button. On a web page, a mistake shows a wrong number. On a 70 kg robot next to a visitor, a mistake moves a heavy arm.
- Someone must be responsible. Before a program runs on the real Bramble, Margaret Ellis wants a person who can explain what every line does and why it is safe. “The computer wrote it” is not an answer she accepts, and nor would an employer, an insurer or an inspector.
- Faults show up as behaviour, not as code. When Oliver reports that Bramble’s arm “shivers” when it holds a tray, you need to connect that to a gain that is too high in a feedback loop (Module 4). That needs understanding, not just the ability to ask for new code.
- You can only check what you understand. AI tools are genuinely useful for drafting and explaining code. Using them well means reading what they produce, testing it on a simulator, and spotting what is missing. This course gives you the knowledge to do that.
So the aim is not to compete with AI tools, but to be the person who can judge their work. Lesson 9.4 returns to where AI and machine learning fit into robot control.
What you will learn
- Modules 1 and 2: the console, safe habits, and the programming you need: values, decisions, loops and functions.
- Modules 3 and 4: moving a single joint, first blindly, then with feedback, ending with the PID controller used in most robot joints.
- Module 5: reading sensors in code, including noisy ones.
- Modules 6 to 8: arms and reaching, standing balance, and walking.
- Module 9: writing programs that are safe and reliable when things go wrong.
- Module 10: a final project that uses everything: Bramble fetches a teacup.
Quick check
This lesson has no exercises. Four questions to confirm the main ideas. Choose an answer to see the explanation.
Which list puts the steps of the control cycle in the right order?
The robot first reads its sensors, then works out what to do about the difference between what it measured and what is wanted, then sends commands to its motors, and repeats.
“Run the knee motor for 0.3 seconds and assume the knee is now bent to 40°.” What kind of control is this?
Nothing checks where the knee actually ended up, so this is open loop. A heavier load or a stiff joint would leave it somewhere else, and the program would not know.
Why does a balance program check the robot's lean about a hundred times a second, rather than once a second?
A standing robot is always starting to topple. Checking often lets it correct a lean of a fraction of a degree; checking rarely would let the lean grow too large to recover.
An AI tool writes a program for Bramble that runs without any errors. What is the best next step before it goes near the real robot?
A program can run without errors and still use a wrong unit or forget a safety check. A person must understand and test it, and take responsibility for it. AI tools are useful, but their work still needs checking.
Summary
- Control means making something do what you want despite interference, by repeatedly sensing, deciding and acting.
- Open loop acts without checking; closed loop (feedback) measures the result and corrects.
- A control program runs as a fast loop, often 100 or more cycles a second, so that small errors are corrected before they grow.
- The course uses a simulated Bramble programmed in JavaScript. It is a simplified model, and it says so where it matters.
- AI tools can write robot code, but a person must still understand, test and take responsibility for it.
Found a mistake on this page, or something unclear? Report a problem and mention “Control Lesson 1.1”.
