Lessons¶
The lessons live in their own place, built for students: each lesson mixes short explanations with live code cells. Press Run and the robot moves on the mat right there in the page, and the tasks are checked by the simulator, including what your program prints.
Any task can be embedded in your own site with an iframe: the embed builder gives you the snippet.
The course has 51 modules and 404 lessons in GCSE, Robot club, A level and University, with 19 games to play along the way.
GCSE¶
The whole GCSE computer science course, matched to the OCR, AQA and Edexcel specifications. Pick this if you are working towards a GCSE. 13 modules, 109 lessons.
Module F1: Programming basics¶
Sequence, output, functions, errors, variables, input, data types and arithmetic: the start of GCSE programming, with a robot that talks, drives and plays notes.
| Lesson | What you learn |
|---|---|
| F1.1 What a program is | Instructions, one at a time, top to bottom. Running code and reading what comes back. |
| F1.2 Output: print | Print text and numbers, several things at once. |
| F1.3 Calling functions | Arguments, telling and asking, and notes on the robot's buzzer. |
| F1.4 Errors: syntax, runtime and logic | Reading an error message, and the three kinds of error by their exam names. |
| F1.5 Comments and readable code | Comments, names, blank lines: code a person can read and change. |
| F1.6 Variables, constants and assignment | Storing, changing and naming values, and constants that never change. |
| F1.7 Input from the user | Asking questions with input(), and why every answer is text. |
| F1.8 Data types and casting | Integer, real, Boolean, character and string, and converting between them. |
| F1.9 Arithmetic operators | The seven operators, integer division and remainder, and the order they work in. |
| F1.10 Project: ask and drive | Plan, build and test one program that asks, drives a square, plays notes and reports. |
Module F2: Decisions and loops¶
Blocks, selection with if, elif and match, Boolean operators, for and while loops and the patterns they make: the robot starts reacting to what its sensors say.
| Lesson | What you learn |
|---|---|
| F2.1 Blocks and indentation | How Python groups lines: the colon and the indent. |
| F2.2 Selection: if | Relational operators, and a block that runs only when a condition is true. |
| F2.3 else, elif and Boolean operators | Choosing between outcomes, and joining conditions with and, or and not. |
| F2.4 Nested selection and match | Decisions inside decisions, and choosing by exact value with a case statement. |
| F2.5 Count-controlled loops: for | range, the loop variable, and repeating a known number of times. |
| F2.6 Condition-controlled loops: while | Looping until something changes, break, and loops that never end. |
| F2.7 Loop patterns | Running totals, counting, finding the largest, nested loops and trace tables. |
| F2.8 Project: parking sensor | A while loop, decisions and the buzzer: beep faster as the wall gets closer, and park. |
Module F3: Strings, lists and records¶
Strings taken apart and joined, character codes, lists and 2D arrays, records and random numbers: the robot's readings and messages as data.
| Lesson | What you learn |
|---|---|
| F3.1 String handling | Length, indexing, slicing, searching and joining strings, and f-strings. |
| F3.2 Character codes and conversion | ord and chr, ASCII, comparing strings, and a Caesar cipher. |
| F3.3 Lists: one-dimensional arrays | Making, indexing and changing a list; append, remove, in, split and join. |
| F3.4 Iterating over a list | Loops over items and indexes, totals, counts, min and max, and linear search. |
| F3.5 Two-dimensional arrays | Rows and columns: the depth grid as a list of lists. |
| F3.6 Records | Grouping related fields: a sensor reading as a record, and a list of records as a table. |
| F3.7 Random numbers | randint, choice and seeds: dice, random tunes and a robot that wanders. |
| F3.8 Project: survey the room | Look in eight directions, store the survey as records, report on it and head for open space. |
Module F4: Functions and structured code¶
Writing functions, parameters and return values, scope, decomposition and abstraction, libraries and modules: a robot program broken into named pieces.
| Lesson | What you learn |
|---|---|
| F4.1 Writing functions | def, calling, and why subprograms help. |
| F4.2 Parameters and return values | Information in and an answer out; procedures and functions. |
| F4.3 Local and global variables | Scope: where a variable exists, and why passing values beats global. |
| F4.4 Decomposition and abstraction | Structure diagrams, and hiding the details of a job behind a function. |
| F4.5 Libraries and your own modules | import, Python's own libraries, and a module file of your own. |
| F4.6 Project: the patrol | A complete program built a function at a time: patrol to the wall and come home. |
Competitions after this module: Print race: No driving. Noisy sensors, one question at a time: average enough readings to be right, but not so many you are slow.
Module F5: Algorithms¶
What an algorithm is, flowcharts, pseudocode and trace tables, then the standard searches and sorts, heard on the robot's buzzer and compared for speed.
| Lesson | What you learn |
|---|---|
| F5.1 What an algorithm is | Inputs, processes and outputs; what makes an algorithm precise; programs implement algorithms. |
| F5.2 Flowcharts | The standard symbols, and turning a flowchart into code. |
| F5.3 Pseudocode and the exam reference language | Reading and writing your board's pseudocode, and translating it into Python. |
| F5.4 Trace tables | Following an algorithm line by line, and tracing to find a logic error. |
| F5.5 Linear search | Checking every item: finding a marker in the robot's sightings. |
| F5.6 Binary search | Halving a sorted list, and why it needs sorted data. |
| F5.7 Bubble sort | Passes and swaps, stopping early, and hearing a tune become a scale. |
| F5.8 Insertion sort | Building a sorted part one item at a time, on the robot's readings. |
| F5.9 Merge sort and comparing algorithms | Splitting and merging, and choosing between the searches and sorts. |
| F5.10 Project: sort the readings | Survey the room, sort the records, answer questions from sorted data, and choose the algorithms. |
Module F6: Robust programs¶
Validation, authentication, testing and debugging, then the languages and translators behind it all and the IDE: a robot that survives bad commands.
| Lesson | What you learn |
|---|---|
| F6.1 Defensive design and validation | Anticipating misuse; presence, type, range, length, format and look-up checks. |
| F6.2 Authentication | Usernames and passwords, limiting attempts, and stronger ways to prove who someone is. |
| F6.3 Testing and test data | Iterative and final testing; normal, boundary, invalid and erroneous data; test plans in code. |
| F6.4 Debugging logic errors | Finding the mistake that gives no message: watching, printing, stepping and common bugs. |
| F6.5 Languages and translators | High and low level, machine code and assembly; compilers, interpreters and assemblers. |
| F6.6 The IDE | Editors, error diagnostics, the run-time environment and the translator, in the cell you use. |
| F6.7 Project: the fail-safe controller | A command program that authenticates, validates every command, and is tested against a plan. |
Module F7: Files and databases¶
Reading and writing files, relational databases and SQL: logging the robot's runs and asking questions of the log.
| Lesson | What you learn |
|---|---|
| F7.1 Reading and writing files | Open, read, write, append and close: a run log in a CSV file. |
| F7.2 Relational databases | Tables, records, fields, primary and foreign keys, and avoiding redundancy. |
| F7.3 SQL: SELECT | SELECT, FROM, WHERE and ORDER BY on the class's robot runs. |
| F7.4 SQL: two tables and changing data | Queries across two tables; INSERT, UPDATE and DELETE, and the robot logging its own runs. |
| F7.5 Project: the logbook | Log every run to a file, load the file into a table, and find the best run with SQL. |
Module F8: Data representation¶
Bits and units, binary, hex, binary arithmetic, characters, images, sound and compression: the robot's camera pixels, LED colours and buzzer notes as data.
| Lesson | What you learn |
|---|---|
| F8.1 Bits, bytes and units | Why computers use binary, and the units from bits to petabytes. |
| F8.2 Binary and denary | Converting 8-bit numbers both ways, and hearing them on the buzzer. |
| F8.3 Hexadecimal | Base 16, converting to binary and denary, and the LED's colour codes. |
| F8.4 Binary addition, overflow and shifts | Adding in binary with carries, overflow, and shifting to multiply and divide. |
| F8.5 Negative numbers: two's complement | Signed 8-bit integers, and why the same adder works for them. |
| F8.6 Characters: ASCII and Unicode | Character sets, bits per character, and why Unicode was needed. |
| F8.7 Images | Pixels, resolution, colour depth, metadata and file size, from the robot's camera. |
| F8.8 Sound | Sampling, sample rate, bit depth and file size, and finding a note from its samples. |
| F8.9 Compression | Lossy and lossless; run length encoding and Huffman coding. |
| F8.10 Project: send a picture | Capture a camera frame, make it 1-bit, compress it with RLE and send it by radio. |
Module F9: Logic and computer systems¶
Logic gates and circuits, the von Neumann machine, the CPU and its performance, memory, storage, embedded systems and operating systems, with BugBot opened up as the example.
| Lesson | What you learn |
|---|---|
| F9.1 Logic gates and truth tables | AND, OR and NOT, their symbols and truth tables, and a robot decision as a circuit. |
| F9.2 Logic circuits and expressions | Combining gates, Boolean expressions, XOR, and the half adder. |
| F9.3 Hardware, software and von Neumann | Hardware and software, and the stored program concept in a tiny computer. |
| F9.4 The CPU and fetch-execute | The ALU, control unit, registers and buses, and tracing the fetch-decode-execute cycle. |
| F9.5 CPU performance | Clock speed, cores and cache, measured with models. |
| F9.6 Memory | RAM, ROM, cache and virtual memory. |
| F9.7 Secondary storage | Magnetic, optical, solid state and cloud storage, and choosing between them. |
| F9.8 Embedded systems: inside BugBot | What makes a system embedded, the robot's three boards, and the sense-decide-act loop. |
| F9.9 Operating systems and utilities | What an operating system does, scheduling, and utility software. |
Module F10: Networks¶
LANs and WANs, network hardware, performance, topologies, addresses and packets, DNS and the cloud, protocols and layers, with the robots on the mat as a working network.
| Lesson | What you learn |
|---|---|
| F10.1 What is a network? | Why networks, LAN, WAN and PAN, client-server and peer-to-peer. |
| F10.2 Network hardware and connections | NICs, switches, routers and access points; copper, fibre and wireless; Wi-Fi, Ethernet and Bluetooth. |
| F10.3 Network performance | Bandwidth, transfer time calculations, what slows a network, and measuring latency with a ping. |
| F10.4 Network topologies | Star, bus, ring and mesh, and routing around a failure in a mesh of robots. |
| F10.5 Addresses and packets | MAC and IP addresses, IPv4 and IPv6, and packet switching. |
| F10.6 The internet, DNS and the cloud | The internet and the web, DNS, web servers and hosting, and the cloud. |
| F10.7 Protocols | Standards, and TCP, UDP, IP, HTTP, HTTPS, FTP, SMTP, POP and IMAP. |
| F10.8 Layers | The four-layer TCP/IP model, encapsulation, and why layers are used. |
| F10.9 Project: reliable delivery | Deliver a report over a lossy radio with packets, acknowledgements and resending. |
Module F11: Cyber security¶
Threats and defences: malware, social engineering, network attacks, passwords, encryption, firewalls and secure programming, with the robot's radio as the thing to attack and protect.
| Lesson | What you learn |
|---|---|
| F11.1 Why cyber security | Confidentiality, integrity and availability, who attacks and why, and ranking risk. |
| F11.2 Malware | Viruses, worms, trojans, ransomware and spyware, and a signature scanner. |
| F11.3 Social engineering | Phishing, pharming, shouldering and blagging, and a filter that flags them. |
| F11.4 Network attacks | Brute force, denial of service, data interception and SQL injection, and detecting a flood. |
| F11.5 Passwords and authentication | Ways to authenticate, strong passwords, 2FA, CAPTCHA and hashing. |
| F11.6 Encryption | Plaintext, keys and ciphertext, the Caesar cipher, symmetric and asymmetric, and a secret over the radio. |
| F11.7 Defending a network | Firewalls, anti-malware, access levels, updates, backups, penetration testing and policies. |
| F11.8 Writing secure programs | Validating input, access levels in code, and testing for security. |
| F11.9 Project: secure the robot | Authenticate with a password, decrypt an encrypted command, and act on it. |
Module F12: Technology and society¶
The impacts of computing: privacy and the law, copyright and licences, the environment, the digital divide, accessibility, AI and bias, work and daily life, ending with an impact report on the robots themselves.
| Lesson | What you learn |
|---|---|
| F12.1 Impacts of technology | Ethical, legal, cultural, environmental and privacy impacts, stakeholders, and weighing them up. |
| F12.2 Personal data and privacy | What personal data is, the Data Protection Act 2018, and anonymising a log. |
| F12.3 Computer misuse and the law | The Computer Misuse Act 1990, the Data Protection Act 2018 and the Copyright, Designs and Patents Act 1988. |
| F12.4 Copyright and licences | Proprietary and open source software, common licences, and Creative Commons. |
| F12.5 Technology and the environment | Making, running and disposing of devices: materials, data centres, e-waste and what helps. |
| F12.6 The digital divide and accessibility | Who is shut out of technology, designing for disability, and measuring colour contrast. |
| F12.7 AI, robots and bias | What AI is good for, where it goes wrong, and auditing a training set for bias. |
| F12.8 Technology, jobs and daily life | Automation and work, how daily life changed, and how automatable a job is. |
| F12.9 Project: an impact report | Read the trial log, anonymise it, cost its energy and carbon, and publish a report. |
Module F13: Exam preparation¶
Getting the marks: how the papers work, command words, trace tables, pseudocode, programming and long answers, where marks are lost, revision that works, and a robot that tests you.
| Lesson | What you learn |
|---|---|
| F13.1 How your exam works | The papers for each board, command words, and planning your time by the marks. |
| F13.2 Trace tables | Being the computer: a row for every change, and the checks that catch a slip. |
| F13.3 Pseudocode in the exam | Reading and writing exam pseudocode and flowcharts, and translating both ways. |
| F13.4 Programming questions | Taking a question apart, the jobs that come up again and again, and how the marks are given. |
| F13.5 Number and data questions | Conversions, units and file sizes at speed, with the checks that catch mistakes. |
| F13.6 Long answer questions | Point, because, so: a structure for discuss and evaluate questions, and a conclusion that decides. |
| F13.7 Where marks are lost | The ten commonest mistakes, checking on paper, and repairing a broken program. |
| F13.8 Revision that works | Retrieval practice, spacing and interleaving, and a planner that schedules them. |
| F13.9 Project: the revision robot | A robot that asks you questions, marks your answers and tells you what to revise. |
Robot club¶
Robots for the fun of it: driving, sensing, vision, behaviours, machine learning and robots that talk to each other. No exam specification, no marking, and games to play at the end of each module. 11 modules, 72 lessons.
Module 0: Python quick start¶
The Python this club needs, taught on the robot: commands, variables, loops, decisions, functions and lists. An hour, then straight on to driving.
| Lesson | What you learn |
|---|---|
| 0.1 Your first program | The two lines at the top, drive, wait, stop, print, and the rule that stops the robot on its own. |
| 0.2 Numbers and names | Variables, arithmetic, and driving an exact distance instead of counting seconds. |
| 0.3 Doing it again | for and while, indentation, and a square drawn with three lines instead of eight. |
| 0.4 Deciding | if, else, comparisons, and a robot that looks with distance() before it moves. |
| 0.5 Your own commands | def, parameters and return: naming a piece of work so the program reads like what it does. |
| 0.6 Lists of readings | Lists, len, min and max, slices and looping over the 64 readings of the depth grid. |
Module 1: Driving¶
How BugBot moves: by time, by distance, by turning, and sideways. Why it never goes quite straight, and the rule that keeps it safe.
| Lesson | What you learn |
|---|---|
| 1.1 Your first move | Drive, wait, stop, the LED, and the safety rule. |
| 1.2 Driving by distance | Tell the robot how far, not how long. Where it thinks it is. |
| 1.3 Turning and heading | turn_left() and turn_right() by an angle, heading() as a compass, and turning on the spot. |
| 1.4 Sideways | Strafing: moving without turning, the thing wheels cannot do. |
| 1.5 Speed and precision | Coasting, overshoot, and why fast and accurate pull in different directions. |
| 1.6 Project: draw a letter | Plan a path, drive it, leave a trail. |
Competitions after this module: Precision Park: Park in three bays, each smaller than the last and facing a set way. Points for being dead centre and square.; Sprint and Stop: Eight lanes and a stop box that moves every race. Your time only counts if you stop inside it.; Shuttle Relay: Teams of two. Stop in the handover box to send your partner off; they stop in the finish box.
Module 2: Sensing¶
Knowing where you are and what is ahead: position and heading, the depth sensor, and reacting to the world.
| Lesson | What you learn |
|---|---|
| 2.1 Where am I? | position(), heading(), velocity(), and resetting them. |
| 2.2 The distance sensor | distance() and loops that react to it. |
| 2.3 The depth grid | 64 readings, 8 columns: seeing left and right, not just ahead. |
| 2.4 Getting round things | Detect, sidestep, continue: the first obstacle avoidance. |
| 2.5 Drift and correction | Why the robot wanders, and the first closed loop. |
| 2.6 Project: the maze | Walls, corners and a goal. Everything in this module in one run. |
Competitions after this module: Maze relay: Four robots, one maze, one goal. Up, across, down. First into the green zone wins.
Module 3: Control¶
The error, and what to do with it: bang-bang, proportional control, gain, dead bands, and running two controllers at once on a robot that curves and leaks.
| Lesson | What you learn |
|---|---|
| 3.1 What a controller is | The error and its sign, wrapping headings, bang-bang control, overshoot. |
| 3.2 Proportional control | Correct in proportion to the error. Gain, sign, feedback. |
| 3.3 Tuning the gain | Sluggish, good, oscillating. Loop speed and driving speed. |
| 3.4 Controlling speed | Speed from the remaining distance, the dead band, clamping. |
| 3.5 Two loops at once | Heading and sideways controllers together on a holonomic robot. |
| 3.6 Project: precision parking | Round a box and into a bay facing east, on the worst robot in the course. |
Module 4: Vision¶
The camera: AprilTags and colour blobs as lists of what was found, pixels to bearings, steering by what you see, and searching for what you cannot.
| Lesson | What you learn |
|---|---|
| 4.1 What the camera sees | set_cv, the tag list, pixels and distance, empty lists. |
| 4.2 Where is it? | Pixels to degrees, and a controller that turns to face a tag. |
| 4.3 Visual servoing | Steer from cx, speed from distance: docking at a tag. |
| 4.4 Colour | The blob detector: one colour at a time, area and box width as distance. |
| 4.5 Searching | Spin until it is in view; find and approach as functions; list comprehensions. |
| 4.6 Project: the marker trail | Visit three tag cubes in order. |
Competitions after this module: Capture the marker: A tag cube that keeps moving: the first robot within 8 cm scores and it jumps to the next spot. Eight spots, sixty seconds.
Module 5: Behaviours¶
Programs that never stop: the look-decide-act loop, states, timers, priorities, and turning it all into a brain for the arena.
| Lesson | What you learn |
|---|---|
| 5.1 The loop | Look, decide, act, wait, repeat. One action per tick. Counting ticks. |
| 5.2 States | A plan as a state variable, transitions, drawing the machine. |
| 5.3 Timers | Two things at once, remembered ticks, timeouts. |
| 5.4 Priorities | Avoid beats seek: behaviours that take over and run to completion. |
| 5.5 Brains | From a loop to think(me) and me.memory, with a practice arena. |
| 5.6 Project: rescue | Search, approach, return: camera, servoing and states in one machine. |
Competitions after this module: Firefighter: A candle burns in one of four rooms. Find it, put it out, and get home.; Shrinking Circle: Stay inside a circle that shrinks towards a spot nobody knows. Keep away from everyone: contact costs lives.; Control Points: Two teams, three zones. A zone scores for the team with more robots in it. Drive into an opponent and you are frozen.
Module 6: Seeing more¶
The camera, part two: lines on the mat, tags and LEDs on other robots, following a moving robot, bumps the sensors missed, and predicting where a robot will be.
| Lesson | What you learn |
|---|---|
| 6.1 Lines | The line detector: cx and angle, and the empty list. |
| 6.2 Following a line | cx to rotation, the angle as a look-ahead, speed on the straights. |
| 6.3 Losing the line | Gaps: carry on, then search with a state machine. |
| 6.4 Seeing other robots | Tags from 100 up say who and how far; LEDs say what. |
| 6.5 Following a robot | Two controllers that never finish: chase a moving tag at a set distance. |
| 6.6 Bumps and stalls | bumped(), stalls from velocity, back off and go round. |
| 6.7 Where will it be | Two sightings give a velocity: give way to a robot crossing your path. |
| 6.8 Project: the delivery | Follow a line to a marker and back through traffic. |
Competitions after this module: Light Cycles: Every robot leaves a trail. Hit any trail, the wall or a robot and you are out. Last one driving wins.; Line race: Two laps of a taped loop, eight checkpoints on the straights. Leave the line and you are held to crawling speed until you are back.
Module 7: Hands and feet¶
The attachments: servos, a gripper that holds a ball, a kicker that sends it away, how a ball rolls and stops, and passing to a team mate.
| Lesson | What you learn |
|---|---|
| 7.1 Servos | Angles, speed, what a servo can and cannot do. |
| 7.2 The gripper | grip, release, holding: knowing when you have something. |
| 7.3 Fetching a ball | See it, approach it, grip it, bring it home. |
| 7.4 The kicker | kick(): aiming, and how far the ball goes. |
| 7.5 Ball physics | Rolling, friction, bouncing, and measuring power against distance. |
| 7.6 Passing | Aim at a team mate's tag, judge the power from its distance. |
| 7.7 Project: clear the mat | Every ball into the home zone. |
Competitions after this module: Dodgeball: Two teams, a centre line, balls on both sides. Kick them at the other team; get hit and you are out, catch one and the kicker is.; Rescue Line: Follow a broken line round a block to the evacuation zone, then carry the victims to safety.; Netball: Two against two, one ball, no contact, no running with it. Hold the ball and you can only turn: pass to a team mate or shoot for the goal. Bump an opponent and you are frozen for three seconds.
Module 8: Learning¶
Teaching the robot instead of programming it: data with labels, nearest neighbour, a tiny neural network, learning by reward, models as text.
| Lesson | What you learn |
|---|---|
| 8.1 See as numbers | What a model gets: the sensor views as lists of numbers. |
| 8.2 Collecting data | Readings with labels, and why bad data makes bad robots. |
| 8.3 Nearest neighbour | The simplest classifier, in a dozen lines. |
| 8.4 A tiny network | Weights, a loss, and watching it fall: training in the browser. |
| 8.5 Learning by reward | Q-learning: a table of how good each action is, filled in by trying. |
| 8.6 Tuning itself | Learning a controller gain by trial: measure, change, keep the better. |
| 8.7 Models as text | Saving and loading a model with JSON; models trained elsewhere. |
| 8.8 Project: situations | A classifier decides what the robot does next. |
Competitions after this module: The trained race: A long sprint on robots that drift twice as badly as before, every one differently. Brains that measure their own robot and adapt beat brains with fixed numbers.
Module 9: Talking to each other¶
The radio: sending, listening, agreeing what messages mean, asking and answering, taking turns, and sharing what only you can see.
| Lesson | What you learn |
|---|---|
| 9.1 Sending | send(): a broadcast everyone hears; numbers into text. |
| 9.2 Listening | messages(): what arrived since you last asked, and who sent it. |
| 9.3 Protocols | Agreeing what a message looks like; splitting it into words and numbers. |
| 9.4 Asking | A question and a reply, with a timeout; going where you are told. |
| 9.5 Taking turns | One robot at a time through a corridor: announce, wait, go. |
| 9.6 Sharing what you see | Telling a robot without a camera where the ball is. |
| 9.7 Project: the relay | Drive to the handover, then and only then say go. |
Competitions after this module: Capture the Flag: Take the other team's flag home. In their half, a robot that sees your tag close up sends you back.; The radio relay: Teams of two. Leg 1 drives to the handover zone and radios its team mate; leg 2 may not move until that message arrives, and then sprints for the line.
Module 10: Competing¶
What changes when other robots are on the mat: reading the game, racing the built-in bots, keeping clear, trails, teams, and a run at one of the hard games.
| Lesson | What you learn |
|---|---|
| 10.1 A program in a game | info(), your own log, and the loop every game program is built from. |
| 10.2 Racing the bots | Practice, replay and the results board: why you lost, and the fast-then-careful pattern that wins. |
| 10.3 Watching the others | others() and the camera tags, and giving way early so contact never costs you the game. |
| 10.4 Trails and tight spots | A mat that fills up: seeing trails, turning early, keeping to the outside, and turning without stopping. |
| 10.5 A team in a game | Radio in a game, agreeing roles without talking, and swapping jobs when the score says so. |
| 10.6 Project: enter a hard game | Light Cycles, Rescue Line or Capture the Flag: how to practise one properly, and the line and gripper rehearsal. |
A level¶
The whole A level computer science course, matched to the OCR, AQA and Eduqas specifications. Pick this if you are working towards an A level. 15 modules, 139 lessons.
Module A1: Programming techniques and object-oriented programming¶
A level programming from GCSE upward: data types, operations and exceptions, subroutines passed by value and by reference, scope and debugging, then paradigms and object-oriented programming, ending with a robot controller built from behaviour classes.
| Lesson | What you learn |
|---|---|
| A1.1 Data types and programming constructs | The A level data types, references and user-defined types, constants, and definite and indefinite iteration. |
| A1.2 Operations, strings and random numbers | Integer division and MOD with negatives, rounding and truncation, XOR, string and date conversions, and pseudo-random numbers. |
| A1.3 Exception handling | try, except, else and finally, raising your own exceptions, and keeping the motors safe when something goes wrong. |
| A1.4 Subroutines, parameters and passing by reference | Out-of-line subroutines and their interfaces, returning several values, and passing by value and by reference. |
| A1.5 Scope, lifetime and debugging in an IDE | Local and global variables, why locals are good practice, and breakpoints, stepping, watches and tracebacks. |
| A1.6 Programming paradigms and procedural programming | Procedural, object-oriented, declarative and low-level paradigms, the structured approach, and hierarchy charts. |
| A1.7 Classes and objects | Classes, objects, attributes, methods and constructors; encapsulation, access specifiers, getters and setters, and class diagrams. |
| A1.8 Inheritance, polymorphism and overriding | Subclasses and super, overriding, polymorphism, and abstract, virtual and static methods, with robot behaviours as subclasses. |
| A1.9 Aggregation, composition and class diagrams | Has-a relationships, drawing them on class diagrams, and the design principles that favour composition over inheritance. |
| A1.10 Project: the behaviour controller | Get past a wall to the dock with prioritised behaviour classes, a controller that aggregates them, and an exception to finish. |
Module A2: Recursion and computational thinking¶
Stack frames and recursion, then the computational thinking behind every large program: abstraction of every kind, decomposition and composition, thinking ahead, logically and concurrently, and the computational methods, ending with a robot that backtracks out of a dead end.
| Lesson | What you learn |
|---|---|
| A2.1 Stack frames and the call stack | Return addresses, parameters and local variables: what a subroutine call pushes, and what a return pops. |
| A2.2 Recursion | Base case and general case, winding and unwinding, and a spiral the robot draws by calling itself. |
| A2.3 Recursion versus iteration | The same algorithm both ways, the cost of a frame per call, repeated work, and stack overflow. |
| A2.4 Abstraction and models | Representational abstraction, generalisation, problem reduction, and a grid model of the mat that differs from reality. |
| A2.5 Procedural, functional and data abstraction | Information hiding, hiding the values, the method and the representation, and swapping a data type's insides. |
| A2.6 Decomposition, composition and automation | Thinking procedurally, compound procedures and compound data, and putting a model into action. |
| A2.7 Thinking ahead and thinking logically | Inputs, outputs and preconditions, caching and reuse, decisions and conditions, and solving logic problems. |
| A2.8 Thinking concurrently | Concurrent and parallel processing, what can happen at once, benefits and trade-offs, and pipelining. |
| A2.9 Computational methods | Problem recognition, divide and conquer, backtracking, heuristics, performance modelling, data mining and visualisation. |
| A2.10 Project: out of the dead end | Model a maze, solve it by recursive backtracking, and drive the robot out along the route. |
Module A3: Data structures¶
Arrays, records and tuples, then the abstract data types: stacks, queues, linked lists, hash tables and dictionaries, vectors, and how records are organised in files. The robot undoes its moves, queues its commands and tracks itself with vectors.
| Lesson | What you learn |
|---|---|
| A3.1 Arrays, records and tuples | Arrays in one, two and three dimensions, records and fields, tuples and lists, and static structures. |
| A3.2 Abstract data types and stacks | ADTs, static and dynamic structures, and a stack with a top pointer: an undo stack for the robot's moves. |
| A3.3 Queues: linear, circular and priority | Front and rear pointers, wrapping round with MOD, and priority queues: a command queue for the robot. |
| A3.4 Linked lists | Nodes and pointers, the free list, and traversing, inserting and deleting: a route of waypoints. |
| A3.5 Hash tables | Hashing functions, collisions, rehashing by probing, chaining and load factor: finding markers fast. |
| A3.6 Dictionaries | Keys and values, dictionaries built on hash tables, and information retrieval: commands looked up by name. |
| A3.7 Vectors | Vectors as lists, functions and arrows; addition, scaling, dot product and convex combination, on the robot's position. |
| A3.8 Fields, records and file organisation | Text and binary files, fixed-length records, and serial, sequential, indexed sequential and direct access files. |
| A3.9 Project: mission control | A mission read from a file into a circular queue, moves looked up in a dictionary, position tracked as a vector, and an undo stack to bring the robot home. |
Module A4: Trees and graphs¶
Graphs and how to store them, depth-first and breadth-first traversal, trees and binary search trees, the three tree traversals, and a robot that plans its shortest route across the mat.
| Lesson | What you learn |
|---|---|
| A4.1 Graphs | Vertices and edges; directed, undirected and weighted graphs; degree, the handshake lemma and typical uses. |
| A4.2 Adjacency matrix and adjacency list | Two ways to store a graph, and choosing between them for dense and sparse graphs. |
| A4.3 Depth-first traversal | Going deep and backtracking, recursively and with a stack; tracing it and what it is used for. |
| A4.4 Breadth-first traversal | Level by level with a queue, shortest paths in unweighted graphs, and a breadth-first visit of the mat's zones. |
| A4.5 Trees | Trees as connected graphs with no cycles, rooted trees and their vocabulary, binary trees and typical uses. |
| A4.6 Binary search trees | Building, inserting and searching, O(log n) against O(n), trees stored in arrays, and deletion in outline. |
| A4.7 Tree traversals | Pre-order, in-order and post-order, the outline method, expression trees and what each traversal is for. |
| A4.8 Project: plan the route | Model the mat as a graph, find the shortest route with breadth-first search, and drive it. |
Module A5: Algorithms and complexity¶
Comparing algorithms by time and space, the maths behind Big O, then searching and sorting analysed in depth, Dijkstra's shortest path and A*, finishing with BugBot planning the shortest route across the mat and driving it.
| Lesson | What you learn |
|---|---|
| A5.1 Comparing algorithms | Time and space efficiency as functions of the size of the problem; linear, polynomial, exponential and logarithmic functions; permutations and n!. |
| A5.2 Big O notation | Dominant terms, the orders of complexity from O(1) to O(2^n), deriving complexity from code, best, average and worst case, and space complexity. |
| A5.3 Linear and binary search | Tracing both searches in pseudocode, recursive binary search, O(n) against O(log n), and when sorting first pays off. |
| A5.4 Bubble sort and insertion sort | Tracing passes and insertions, counting comparisons in the best and worst case, in-place sorting and stability. |
| A5.5 Merge sort | Divide and conquer, a recursive merge sort, why it is O(n log n) in every case, and its O(n) memory cost. |
| A5.6 Quick sort | Pivots and in-place partitioning, O(n log n) on average and O(n^2) at worst, and the four sorts compared. |
| A5.7 Dijkstra's shortest path algorithm | Tracing Dijkstra's algorithm in a table, why negative weights break it, a priority queue version, its efficiency and applications. |
| A5.8 A* search | g, h and f, open and closed lists, admissible heuristics, tracing A, and A against Dijkstra on the mat's grid. |
| A5.9 Project: plan the route, then drive it | Choose and justify a route planner, build the mat's graph, find the shortest route with Dijkstra's algorithm and drive it. |
Module A6: Theory of computation¶
Finite state machines and Mealy machines, sets, regular expressions, BNF, Reverse Polish notation, then the limits of computation: intractable problems, the Halting problem and Turing machines, with a robot run by a state machine.
| Lesson | What you learn |
|---|---|
| A6.1 Finite state machines | States, transitions and accepting states; state transition diagrams and tables; tracing an FSM and running one from a table. |
| A6.2 Mealy machines: FSMs with output | Output on every transition, tracing a Mealy machine, and a search, approach and stop controller for the robot. |
| A6.3 Sets | Set notation and comprehension, finite and countably infinite sets, cardinality, Cartesian product, subsets, union, intersection and difference. |
| A6.4 Regular expressions and regular languages | The metacharacters, matching in Python, the link between regexes and FSMs, and what makes a language regular. |
| A6.5 Backus-Naur Form and syntax diagrams | Production rules, syntax diagrams, a grammar for robot programs, recursive descent, and why BNF can describe what a regex cannot. |
| A6.6 Reverse Polish notation | Infix and postfix, converting both ways, evaluating RPN with a stack, and the shunting-yard algorithm. |
| A6.7 Limits of computation: tractable and intractable problems | How complexity and hardware limit computation, tractable and intractable problems, and a heuristic route for the robot. |
| A6.8 Computable problems and the Halting problem | Non-computable problems, the Halting problem and why it cannot be solved, and what step limits can and cannot tell you. |
| A6.9 Turing machines | Tape, head, states and transition functions; tracing a Turing machine; the universal Turing machine and why it matters. |
| A6.10 Project: the mission robot | Validate a mission with a regular expression, carry it out with a Mealy machine, and report with sets. |
Module A7: Data representation¶
Number sets and bases, signed and floating point binary, errors and precision, bitwise operations, characters, error checking, images, sound and MIDI, compression, encryption and hashing: the robot's sensor readings, colours, notes and radio messages as bits.
| Lesson | What you learn |
|---|---|
| A7.1 Number sets, bases and units | Natural, integer, rational, irrational, real and ordinal numbers; any number base; bits, bytes, kilo and kibi. |
| A7.2 Binary arithmetic and signed integers | Unsigned addition and multiplication, sign and magnitude, two's complement, subtraction and overflow. |
| A7.3 Fixed point and floating point | Binary fractions, mantissa and exponent, normalisation, and adding floating point numbers. |
| A7.4 Errors, range and precision | Rounding errors, absolute and relative error, range against precision, overflow and underflow, with a real sensor reading. |
| A7.5 Bitwise operations and characters | Masks with AND, OR and XOR, logical, arithmetic and circular shifts, and characters as codes in ASCII and Unicode. |
| A7.6 Error checking and correction | Parity bits, majority voting, checksums and check digits, with checksums on the robot's radio messages. |
| A7.7 Analogue, digital and graphics | Analogue and digital signals, ADCs and DACs, bitmapped and vector graphics and when to use each. |
| A7.8 Sound and MIDI | Sample rate, sample resolution, the Nyquist theorem and aliasing, and MIDI events played on the robot's piezo. |
| A7.9 Compression, encryption and hashing | Run length and dictionary coding, the Caesar and Vernam ciphers, symmetric and asymmetric encryption, and hashing. |
| A7.10 Project: a secure sensor packet | Pack a distance reading into fixed point bytes with flags and a checksum, encrypt it with a one-time pad and send it by radio. |
Module A8: Boolean algebra and logic circuits¶
All six gates and the exam notations, circuits from problems and truth tables, the laws of Boolean algebra and De Morgan, simplifying by algebra and by Karnaugh map, adders, and D-type flip-flops, with the robot's sensor conditions as the circuits.
| Lesson | What you learn |
|---|---|
| A8.1 Logic gates and notation | NOT, AND, OR, XOR, NAND and NOR, the notation each board uses, and why NAND alone can build anything. |
| A8.2 Circuits, expressions and truth tables | Reading and drawing circuits, defining a problem in Boolean logic, and sum of products from a truth table. |
| A8.3 Boolean identities and laws | The identities, commutation, association, distribution, double negation and absorption, proved by truth table. |
| A8.4 De Morgan's laws | Breaking the bar and changing the sign, NAND and NOR, and rewriting the robot's loop condition. |
| A8.5 Simplifying expressions | A method for simplifying by algebra, worked exam-style examples, and checking the result. |
| A8.6 Karnaugh maps | Gray code order, grouping rules for two to four variables, wrap-around groups, and reading off the expression. |
| A8.7 Half adders and full adders | The full adder's expressions, building it from half adders, and chaining full adders into a ripple carry adder. |
| A8.8 D-type flip-flops and clocks | Clock signals, edge triggering, the D-type flip-flop as one bit of memory, registers and a divide-by-two counter. |
| A8.9 Project: the robot's safety logic | From a rule table to a Karnaugh map, a simplified expression, a proof and a robot that stops for the right reasons. |
Module A9: Computer architecture¶
Inside the processor at A level: buses, the stored program, von Neumann and Harvard, registers and flags, the fetch-decode-execute cycle as register transfers, addressing modes, LMC and AQA assembly, interrupts, performance and parallel processors, and how input, output and storage devices work, with BugBot's microcontroller as the embedded example.
| Lesson | What you learn |
|---|---|
| A9.1 Hardware, software and the stored program | Internal components, the three buses and their widths, I/O controllers, the stored program concept, and von Neumann against Harvard. |
| A9.2 The processor and its registers | The ALU, control unit and clock, general-purpose and dedicated registers, and the status flags an 8-bit ALU sets. |
| A9.3 The fetch-decode-execute cycle in detail | Register transfer notation, the buses at each step, a full register trace, and a stored program that plays notes. |
| A9.4 Instruction sets and addressing modes | Opcodes, operands and instruction formats; immediate, direct, indirect and indexed addressing. |
| A9.5 Assembly language: the Little Man Computer | OCR's LMC instruction set: tracing and writing programs with selection and iteration, run in Python. |
| A9.6 AQA assembly language and bitwise operations | AQA's instruction set, compare and branch, masks and shifts, and the bit fields that drive BugBot's motors. |
| A9.7 Interrupts | Sources of interrupts, polling, the check at the end of each cycle, saving the volatile environment on a stack, and priorities. |
| A9.8 Performance, pipelining and parallel processors | Cores, cache, clock speed, word length and bus widths; pipelining; CISC and RISC; multicore systems and GPUs. |
| A9.9 Input, output and storage | How barcode readers, cameras, laser printers and RFID work; magnetic, optical and flash storage; RAM, ROM and virtual storage. |
| A9.10 Project: a processor of your own | Build a von Neumann machine with register transfers, addressing modes, flags and memory-mapped I/O that plays a scale on the robot. |
Module A10: Operating systems, software and translators¶
Classifying software, what the operating system does and how: memory management, interrupts, scheduling, types of operating system and virtual machines; then languages, assemblers, compilers and interpreters, and the stages of compilation, ending with a tiny operating system for the robot.
| Lesson | What you learn |
|---|---|
| A10.1 Classifying software | System and application software, utilities, libraries and translators, and open versus closed source. |
| A10.2 The operating system, BIOS and device drivers | Hiding the hardware, managing resources, booting from the BIOS, and a driver table for the robot. |
| A10.3 Memory management: paging, segmentation and virtual memory | Logical and physical addresses, page tables, segments, page faults and disk thrashing. |
| A10.4 Interrupts | Polling versus interrupts, priorities, the stack and interrupt service routines in the fetch-decode-execute cycle. |
| A10.5 Scheduling algorithms | First come first served, round robin, shortest job first, shortest remaining time and multi-level feedback queues, compared on one set of processes. |
| A10.6 Types of operating system and virtual machines | Multi-tasking, multi-user, real-time, embedded and distributed systems, and a bytecode virtual machine that drives the robot. |
| A10.7 Programming languages and translators | Machine code, assembly and imperative high-level languages, the Little Man Computer, and choosing an assembler, compiler, interpreter or bytecode. |
| A10.8 Stages of compilation, linkers and loaders | Lexical analysis, syntax analysis, code generation and optimisation, then static and dynamic linking and the loader. |
| A10.9 Project: a tiny robot operating system | Share the robot between three tasks with round robin, drive it through device drivers, and stop the patrol with an interrupt. |
Module A11: Databases and big data¶
Model data, normalise it, define and query it in SQL, keep it consistent under transactions and many users, exchange it, and handle data too big for one machine.
| Lesson | What you learn |
|---|---|
| A11.1 Data models and entity relationships | Model the data before building anything: entities, attributes, entity descriptions and the degree of each relationship, drawn as an entity relationship diagram. |
| A11.2 Relational databases and keys | Flat files against relational databases, and every kind of key: primary, composite, foreign and secondary, with indexes and how records are found. |
| A11.3 Normalisation to third normal form | Functional dependencies, update anomalies, and taking a flat score sheet through first, second and third normal form. |
| A11.4 SQL: defining tables and joining them | CREATE TABLE with types and keys, ALTER and DROP, then SELECT with INNER JOIN, wildcards, aggregates, GROUP BY and nested queries. |
| A11.5 SQL: changing data and referential integrity | INSERT, UPDATE and DELETE at A level, and how a database refuses orphan records. The robot logs its own moves. |
| A11.6 Transactions and ACID | A transaction is all or nothing: atomicity, consistency, isolation and durability, commit and rollback, and redundancy. |
| A11.7 Client server databases and concurrent access | Many clients, one database: the lost update, and the four ways to prevent it: record locks, serialisation, timestamp ordering and commitment ordering. |
| A11.8 Capturing, managing and exchanging data | How data gets in, how it is selected and managed, and how systems swap it as CSV, JSON and XML. The robot exports its own readings. |
| A11.9 Big data | Volume, velocity and variety; why one server is not enough; distributed processing with map and reduce; the fact-based model and graph schema. |
| A11.10 Project: the run database | Design, normalise, build and fill a database of robot runs, log live runs in transactions, report with one joined query and export the report as JSON. |
Module A12: Networks and the web¶
How data moves: serial links and protocols, topologies and Wi-Fi, packets, TCP/IP, addressing, DHCP and NAT, security, REST and the web, ending with a robot that rebuilds a route from damaged packets.
| Lesson | What you learn |
|---|---|
| A12.1 Communication methods | Serial and parallel, synchronous and asynchronous, baud rate, bit rate, bandwidth, latency and protocols. |
| A12.2 Topologies and wireless networks | Physical and logical bus and star; Wi-Fi, SSIDs, WPA2 and CSMA/CA with RTS/CTS. |
| A12.3 How the Internet works | Packet switching, routers and gateways, URLs, fully qualified domain names and DNS. |
| A12.4 The TCP/IP stack and protocols | The four layers, encapsulation, ports and sockets, and HTTP, HTTPS, FTP, SMTP, POP3 and SSH. |
| A12.5 IP addresses and subnets | Network and host identifiers, subnet masks with AND, IPv4 and IPv6, public and private addresses. |
| A12.6 DHCP, NAT and port forwarding | How a device gets its address, and how a router shares one public address with a whole network. |
| A12.7 Internet security | Firewalls, packet filtering, proxies and stateful inspection; encryption, certificates and signatures; worms, trojans and viruses. |
| A12.8 Client server, REST and thin clients | Peer to peer and client server, websockets, CRUD and REST with JSON, and thin versus thick clients. |
| A12.9 Web technologies and search | HTML, CSS and JavaScript, client and server side processing, indexing and PageRank. |
| A12.10 Project: a reliable link | Receive a route as packets out of order, reject the damaged one, and drive it. |
Module A13: Functional programming¶
The functional paradigm from the ground up: pure functions, immutability and statelessness, function types, first-class and higher-order functions, partial application and composition, map, filter and fold, list processing by head and tail, and why the style suits big data, ending with a robot that finds its way out using a pipeline of pure functions.
| Lesson | What you learn |
|---|---|
| A13.1 The functional paradigm | Side effects, pure functions and referential transparency, immutability and statelessness, with the robot's side effects kept at the edges. |
| A13.2 Function types and function application | Functions as mappings, function type f: A to B, domain and co-domain, and function application with arguments from a Cartesian product. |
| A13.3 First-class objects and higher-order functions | Functions as values in variables, lists and dictionaries, passed as arguments and returned as results, lambdas, closures and a robot command table. |
| A13.4 Partial application and composition | Why every Haskell function takes one argument, partial function application, functools.partial, and composing functions into a sensor pipeline. |
| A13.5 Map, filter and fold | The three higher-order functions, foldl and foldr, and a pipeline over a log of sensor readings. |
| A13.6 List processing | Lists as a head and a tail, the empty list, prepend and append, and recursion over a list to drive a route there and back. |
| A13.7 Functional programming and big data | Volume, velocity and variety, why big data needs distributed processing, and how immutability, statelessness and higher-order functions make MapReduce work. |
| A13.8 Project: the way out | Sweep the bay, decide with a pipeline of pure functions built by composition, map, filter and fold, then drive out. |
Module A14: Software development, law and ethics¶
How real software gets built: the lifecycle and feasibility, waterfall, spiral, agile, extreme programming and RAD, analysis, design, testing and version control; then the law and the ethics of what we build, ending with a robot project worked through the way the NEA asks.
| Lesson | What you learn |
|---|---|
| A14.1 The systems lifecycle and feasibility | The stages from feasibility to maintenance, the three kinds of maintenance, and scoring a feasibility study. |
| A14.2 Development methodologies | Waterfall, spiral, agile, extreme programming and rapid application development: how each works, when to use it, and planning agile sprints. |
| A14.3 Analysis: requirements and success criteria | Stakeholders, fact finding, functional and non-functional requirements, and measurable success criteria that the robot checks for itself. |
| A14.4 System design | Structure charts, data flow diagrams, designing data, algorithms and the user interface, and printing a structure chart with recursion. |
| A14.5 Testing strategies | Black box and white box testing, alpha, beta and acceptance testing, destructive testing, and a black box test plan that finds two bugs. |
| A14.6 Software engineering tools and version control | IDEs, CASE tools, documentation, and version control: commits, branches, merges and finding the commit that broke the robot. |
| A14.7 Computing legislation | The Data Protection Act 2018 and UK GDPR, the Computer Misuse Act 1990, the Copyright, Designs and Patents Act 1988 and the Regulation of Investigatory Powers Act 2000, applied to a robot's delivery log. |
| A14.8 Moral, ethical, social and cultural issues | Automated decisions, AI, surveillance, personal data at scale, censorship, piracy, the environment and accessibility, with an autonomous robot that explains every decision. |
| A14.9 Project: the delivery robot | A small project taken through analysis, design, implementation, testing and evaluation, the way the NEA is written up. |
Module A15: Exam preparation¶
How OCR, AQA and Eduqas assess the A level, command words and levels of response, tracing, pseudocode and writing code under exam conditions, skeleton programs, theory at speed and a revision plan, each lesson ending in a task that mixes the whole course.
| Lesson | What you learn |
|---|---|
| A15.1 How your A level is assessed | The papers and the project for OCR H446, AQA 7517 and Eduqas A500QS, the assessment objectives, and a timing plan built with integer arithmetic. |
| A15.2 Command words and levels of response | What each command word asks for, how extended answers are marked in levels, and a marker that levels answers with regular expressions. |
| A15.3 Trace tables and hand-tracing | Tracing loops, recursion and Little Man Computer programs without slips, and a binary search that prints its own trace table. |
| A15.4 Pseudocode in the exam languages | OCR's exam reference language and AQA's pseudo-code side by side with Python, the traps in translating, and a stack class that brings the robot home. |
| A15.5 Writing algorithms and code in the exam | Planning before writing, how code is marked, the standard algorithms to know by heart, and Dijkstra's algorithm driving the robot. |
| A15.6 Pre-release material and skeleton programs | Getting to know a skeleton program before the exam, the questions asked about it, and making exam-style changes to one. |
| A15.7 Calculation and theory questions | Number representation, floating point, Boolean logic, state machines and complexity answered quickly and checked. |
| A15.8 A revision plan and mixed practice | Mapping the specification, retrieval, spacing and interleaving, and a spaced repetition scheduler for the whole course. |
University¶
Robotics as a degree course teaches it: kinematics, odometry, filtering, control, estimation, mapping, planning and vision, written as programs that run on a robot which does not know where it is. 12 modules, 84 lessons.
Module U1: The robot as a system¶
What a robot program is really doing: a loop that senses, decides and acts, on hardware that answers late, imperfectly, and without knowing where it is. Measuring your own robot and plotting what it did.
| Lesson | What you learn |
|---|---|
| U1.1 Sense, decide, act | The control loop, its period, and the deadman that stops a robot whose program has gone quiet. |
| U1.2 A command is a request | Open loop on real hardware: gain that is not 1, a dead band, a lag, and a robot that curves. |
| U1.3 Truth and belief | position() is the lab's overhead camera. odometry() is what the robot has, and it drifts. |
| U1.4 Time, rate and latency | How often the loop runs, how late the answer arrives, and what both do to a controller. |
| U1.5 Seeing the signal | plot(): reading a control loop as a chart instead of a column of numbers. |
| U1.6 Measuring your robot | A step response: top speed, time constant and dead band, measured rather than assumed. |
| U1.7 Project: write the data sheet | Characterise the robot you were given and print the figures the rest of the course will use. |
Module U2: Kinematics and frames¶
Body frame and world frame, the rotation matrix between them, and the inverse kinematics that turn a velocity you want in the world into the command this drive needs.
| Lesson | What you learn |
|---|---|
| U2.1 Two frames | The robot's forward is not the world's forward. Naming the frame is half the work. |
| U2.2 The rotation matrix | Turning a vector from one frame into the other, in two dimensions, by hand and in code. |
| U2.3 A drive that goes sideways | Three degrees of freedom on the floor, and what holonomic buys you. |
| U2.4 Forward kinematics | From the command to the body velocity to the path over the ground. |
| U2.5 Inverse kinematics | The useful direction: a velocity in the world, a heading, and the command that produces it. |
| U2.6 Go to a point | The first useful controller: a vector to the target, straight through the inverse kinematics. |
| U2.7 Project: a shape in the world | Drive a square in world coordinates while the robot spins, which only a holonomic drive can do. |
Module U3: Odometry and drift¶
Writing your own dead reckoning from the flow sensor and the gyro, watching its error grow, calibrating the two largest causes out, and fixing the rest with a landmark.
| Lesson | What you learn |
|---|---|
| U3.1 Integrating velocity | The odometry update, one step at a time, and what the step size costs you. |
| U3.2 Write your own odometry | flow() and imu() in, a pose out, in about ten lines. Then check it against the truth. |
| U3.3 How the error grows | Noise walks, bias marches, scale stretches, and a heading error rotates everything after it. |
| U3.4 Calibration | Measuring the gyro bias and the flow scale, and taking both out of the estimate. |
| U3.5 A fix from a landmark | Dead reckoning between landmarks, and a reset whenever something known comes into view. |
| U3.6 An error budget | Predicting how far out you will be before you drive, which is what covariance is for. |
| U3.7 Project: the long lap | Two metres of driving, one landmark, and an estimate that has to stay honest. |
Module U4: Noise and filtering¶
A reading is a number plus a distribution. Measuring the distribution, averaging it down, filtering in real time, throwing out the readings that are wrong, and paying for all of it in lag.
| Lesson | What you learn |
|---|---|
| U4.1 A reading is a distribution | Mean, standard deviation, and what one number from a sensor is actually telling you. |
| U4.2 Averaging | The square root of n, why it stops paying, and what it costs in time. |
| U4.3 The low pass filter | A moving average, then the exponential filter that does the same job in one line and no memory. |
| U4.4 Outliers | Some readings are not noisy, they are wrong. The median, and gating on what you expected. |
| U4.5 The price of filtering | Every filter delays. Measuring the delay, and what it does to a loop closed around it. |
| U4.6 Choosing the filter | Matching the cut-off to the signal you care about, by measurement rather than by taste. |
| U4.7 Project: hold the gap | Sit 25 cm from a wall, steadily, on a depth sensor that is 3 cm noisy. |
Module U5: Feedback control¶
Proportional, integral and derivative: what each term is for, how to tell from a chart which one you need, how to tune them on a real machine, and what saturation does to all three.
| Lesson | What you learn |
|---|---|
| U5.1 The feedback loop | Setpoint, error, controller, plant, measurement: the block diagram and the names. |
| U5.2 Proportional control | One gain, the whole trade-off, and the steady state error it cannot remove. |
| U5.3 The derivative term | Damping the overshoot, and why D on a noisy signal needs a filter or it is useless. |
| U5.4 The integral term | Removing the error that P leaves behind, and the windup that comes with it. |
| U5.5 Tuning | Finding the gain where it oscillates, and working back from there to something usable. |
| U5.6 Saturation and windup | What a controller should do when the actuator has nothing left to give. |
| U5.7 Project: park it | Three loops at once: x, y and heading, all settling together in a tight box. |
Module U6: State estimation¶
Two imperfect sources of the same number, and how to combine them: the complementary filter, then predict and correct, then the Kalman gain that works out the weighting for you.
| Lesson | What you learn |
|---|---|
| U6.1 Two sources, one state | A signal that drifts and a signal that is noisy, and why either alone is worse than both. |
| U6.2 Predict and correct | The shape every filter has: a model that guesses forward, a measurement that pulls it back. |
| U6.3 The Kalman gain | Where the weighting comes from: two variances, one line of arithmetic, no taste involved. |
| U6.4 Q and R | The two numbers you actually choose, what they mean, and how to measure them. |
| U6.5 Covariance and the ellipse | Uncertainty in two dimensions has a shape, and the shape is the useful part. |
| U6.6 Fusing a fix | Odometry prediction, a tag as the measurement, and a gain that rises as the estimate ages. |
| U6.7 Project: navigate on the estimate | Reach a target the robot cannot see, using nothing but the filter you wrote. |
Module U7: Localisation¶
Working out where the robot is when it does not already know: a belief made of samples, moved by the motion model, weighted by the measurements, and resampled into an answer.
| Lesson | What you learn |
|---|---|
| U7.1 Where am I? | Tracking against global localisation, and why one Gaussian is not enough for the second. |
| U7.2 A cloud of guesses | Representing a belief as a thousand samples, and what that buys over a mean and a variance. |
| U7.3 Moving the cloud | The motion update: every particle drives, and every particle's own error goes with it. |
| U7.4 Weighing the guesses | The measurement update: how likely is this reading if the robot were there? |
| U7.5 Resampling | Keeping the good guesses without losing the diversity that lets the filter recover. |
| U7.6 Monte Carlo localisation | The three steps in a loop on a real mat, with tags as the measurement. |
| U7.7 Project: the kidnapped robot | No idea where it starts. Work it out, then drive somewhere on purpose. |
Module U8: Mapping¶
Turning range readings into a map: a grid of cells, an inverse sensor model that marks a ray free and its end occupied, log odds so the evidence adds up, and a robot that knows what it has not seen.
| Lesson | What you learn |
|---|---|
| U8.1 A map of cells | What a map has to do for a robot, why a grid is the usual answer, and what a cell costs. |
| U8.2 The inverse sensor model | One reading is two statements: free all the way along the ray, occupied at the end of it. |
| U8.3 Log odds | Why the cells hold a log odds and not a probability, and what the clamp is for. |
| U8.4 Building a grid | Eight beams, a known pose, and a map that fills in while the robot drives. |
| U8.5 Ray casting the map | The forward model: given a map and a pose, what would the sensor read? |
| U8.6 Frontiers | The edge between what is known and what is not, and why a map with holes is still useful. |
| U8.7 Project: map the mat | An unknown layout, a grid built from scratch, and a measurement taken off the map. |
Module U9: Planning¶
Finding a route before driving it: the configuration space, a grid as a graph, breadth first, Dijkstra, A* and what makes a heuristic admissible, potential fields and their local minima, and a sampling planner for when the grid is the wrong tool.
| Lesson | What you learn |
|---|---|
| U9.1 The configuration space | Grow the obstacles by the robot's radius and the robot becomes a point, which is the whole reason planning is tractable. |
| U9.2 A grid is a graph | Cells are nodes, neighbours are edges, and breadth first search is the shortest path when every step costs the same. |
| U9.3 Dijkstra and the cost of a step | When steps cost different amounts, the cheapest route is not the shortest one, and a queue sorted by cost finds it. |
| U9.4 A* and the heuristic | Guessing what is left to pay, why the guess must never be too high, and why greedy best first is not A*. |
| U9.5 Potential fields | The goal pulls, the obstacles push, and the robot slides downhill into a local minimum. |
| U9.6 Sampling: the RRT | Throwing darts at the free space instead of enumerating it, and what probabilistic completeness does and does not promise. |
| U9.7 Project: plan a route and drive it | A plan computed on board, shortened, and then followed across a mat with two walls in it. |
Module U10: Following a trajectory¶
Turning a plan into motion: a path is geometry and a trajectory is geometry with a clock, and between them sit velocity profiles, cross-track error, pure pursuit and the look-ahead distance.
| Lesson | What you learn |
|---|---|
| U10.1 A path and a trajectory | The same geometry with and without a clock attached, and why the clock changes what you can check. |
| U10.2 Velocity profiles | The trapezoid, the triangle when there is no room to reach cruise, and what jerk costs you. |
| U10.3 Cross-track error | Splitting the error into along and across the path, and a controller for the half that matters. |
| U10.4 Pure pursuit | Chase a point a fixed distance ahead on the path, and choose the one number that decides everything. |
| U10.5 Feedforward and feedback | A ramp leaves a proportional controller permanently behind, and the model knows how to fix it. |
| U10.6 How far behind | Dead band, lag and loop period, measured as the centimetres the robot is behind its own plan. |
| U10.7 Project: drive the route | A full route through waypoints, marked on how closely it was followed and how long it took. |
Module U11: Vision¶
The camera as a measuring instrument: what a pixel really tells you, what calibration measures, how range from apparent size falls apart with distance, why colour thresholds do not survive leaving the lab, and how to close a control loop on pixels.
| Lesson | What you learn |
|---|---|
| U11.1 The pinhole camera | One pixel is one ray. What that buys you, and what it does not. |
| U11.2 Intrinsics and calibration | Focal length in pixels, the principal point, and measuring them from known geometry. |
| U11.3 Range from apparent size | A known object gives a range, and the range gets worse as the square of itself. |
| U11.4 A tag as a fix | Range and bearing to a landmark you know the position of, which is a position fix. |
| U11.5 Colour, and why it breaks | Segmentation by threshold, what the threshold is really measuring, and where it fails. |
| U11.6 Visual servoing | Closing the loop on pixels instead of converting to metres first, and why that is more robust. |
| U11.7 Project: find the one that is green | Three identical shapes, one job, and a task the depth sensor cannot begin. |
Module U12: Learning, and the capstone¶
Working a behaviour out from data instead of writing it: fitting a model, judging it on data it has not seen, searching for a policy on the robot itself, what a reward function really specifies, the gap between the world you tuned in and the world you run in, and a capstone that uses the lot.
| Lesson | What you learn |
|---|---|
| U12.1 Learning a behaviour | What learning buys over a hand-written rule, what it costs, and the smallest honest example. |
| U12.2 Fitting a model to data | Least squares in plain Python, and a robot that drives by the model it fitted to itself. |
| U12.3 Generalisation | Held-out data, overfitting, and choosing a model by the error it makes on points it never saw. |
| U12.4 Policy search on a robot | Hill climbing on a real machine: a noisy score, a fair trial, and a budget measured in seconds. |
| U12.5 Reward is a specification | The optimiser answers the question you asked, which is rarely the question you meant. |
| U12.6 The reality gap, and honest evaluation | Why a policy tuned in one world fails in another, and how to report what it does without lying. |
| U12.7 Capstone: the whole robot | Calibrate, estimate, localise, plan, follow, arrive, and report. One run, everything in it. |
Competitions after this module: Blind Rally: Visit a course of checkpoints with no overhead camera, steering by odometry and the tags on the walls, then say where you finished.
For the classroom: competitions¶
Every game can be run as a class competition at bugbotlab.com/compete. The teacher opens a game on the projector and a room code appears on the screen. Students open the same game, type the code, and submit their brain; their robot appears on the projector's mat. The teacher presses Start and every screen in the room plays the same race. A class session keeps a points table across the day's competitions. Students can practise any game on their own against the built-in bots first.
A robot that drives into a wall or another robot can stay wedged for the rest of a game. The built-in bots have a reflex for that in the arena; a student's program handles it itself, and every driving game's starter carries a short unstick() helper (back off and step aside after half a second of going nowhere) that students can read and change.
Nothing to install and no account. Progress is saved in your browser. A room code lets a class race in one shared arena. The same code runs on a real BugBot.
For teachers: you can write your own tasks for a class in BugBot Teach. A task is a small scene with goals, which can include the exact output the program must print. Writing one needs no code.