Skip to main content

How this course works

Before you begin

How this course works

Read firstStudents & teachers6 modules · 52 lessons

This page is the shape of the course: what you'll build, why it's arranged this way, and what you need to run it. Students and teachers both — none of it is a secret, and the course works better when everyone knows the plan.

Everything you write gets used again​

The single biggest idea here isn't a Python feature. It's that the code you write in one module becomes a part you build with in the next.

The driving functions from Module 1 are what Module 2's line tracking steers. The line tracking is how Module 3 drives from one intersection to the next. That intersection-to-intersection driving is what Module 4's navigator uses to follow a route. And Module 5 swaps in a smarter way of choosing the route, driving it with the same navigator that already worked.

By the last module you're running a genuinely complicated program — a robot that plans a route around obstacles it discovers and drives it autonomously. Nobody sat down and wrote that program. It was assembled out of pieces that already worked, one module at a time.

That's not a teaching trick; it's how real software gets built. Writing code that can be reused is one of the most valuable habits a programmer can have, and it has a second payoff you'll feel immediately: every step stays small. You're never starting from a blank file and a hard problem. You're adding one part to a machine that already runs.

From Module 2 on, that machine is literally one file. Students keep a single robot.py from Lesson 2-1 to the end of the course; each lesson hands out a skeleton to paste into it, and the file grows a section at a time. The robot.py templates page has that file as it stands after every lesson, so a student can pick up at any point with the right file in hand.

The parts are objects​

Each of those reusable pieces is an object — a bundle of the data it keeps track of and the things it knows how to do. The drivetrain is an object. The reflectance sensor is an object. The navigator is an object. Later on, so is the thing that plans routes.

This is not a course about object-oriented programming, and we don't go far past that idea. The point is to leave you with a feel for how a program can be structured: not one long list of instructions, but a set of parts with clear jobs that you hand work to. That instinct is what you'll carry into whatever you write next.

Two things make the payoff concrete, and both happen in the last two modules.

You can swap one part for another. Module 4's Manhattan planner and Module 5's breadth-first-search planner are asked for a route the same way. The navigator that drives the route doesn't care which one it's holding. So you get Manhattan working first — simpler, no obstacles — and then hand the navigator the BFS planner instead, with almost nothing else changing. (Module 6 does it a third time, with Dijkstra.) Feeling that swap work is worth more than any explanation of why interfaces matter.

You can test without the robot. A route planner is just arithmetic: give it a start and a destination and it hands back a list of intersections. You can build it, run it, and print what it produces with no robot, no batteries, and no floor space — which means you debug the thinking on its own, and only then put it on a robot where a mistake looks like a robot driving into a chair. Module 4 spends a whole lesson on exactly this.

You'll try things before they're explained​

When a lesson needs a new idea, you'll usually meet the problem first. You'll draw a square by placing eight blocks by hand before anyone mentions a loop. You'll watch a triangle come out wrong at 90° before working out where 120° comes from.

That order is deliberate. A loop means something different once you've felt the tedium it removes, and the explanation lands in a gap you already noticed. If a lesson seems to be making you do something the long way round — it is, and the short way is on the next page.

The arc​

Module 1 · Learning to Drive starts in Blockly, where you build programs by dragging blocks, and ends in Python writing the same programs as text. The bridge is deliberate: you learn sequencing, repetition, functions and parameters where syntax can't get in the way, then rewrite what you already understand in a language that can spell things wrong.

Module 2 · Line Tracking adds a sensor, and with it the idea of a program that reacts to the world instead of following a fixed script — including proportional control, which is a real control-systems idea in disguise.

Module 3 · Grid Driving turns "follow a line" into "drive from one intersection to the next," the unit of movement everything after it uses.

Module 4 · Manhattan Navigation introduces coordinates, lists and an algorithm: work out a route, then drive it.

Module 5 · Pathfinding Around Obstacles replaces that route planner with one that handles obstacles (breadth-first search), and — if you go the whole way — one that re-plans when the robot discovers a blocked intersection while driving.

Module 6 · Dijkstra's Algorithm is optional: the same planner with one upgrade, for a grid where some segments are slower than others. The course is complete without it.

Underneath, the big ideas arrive in this order: sequence and repetition, then abstraction through functions and parameters, then sensing and feedback, then algorithms and data structures.

What a lesson is made of​

Every lesson opens with its objectives and an estimate of how long it takes. Activities are the parts you actually do and hand in — they're labeled, so there's no guessing about what gets submitted. Knowledge checks are scattered through to catch misunderstandings early; each lesson also links to a printable sheet of its questions. Teacher notes are the gray boxes, shown when the teacher-mode switch at the corner of the page is on. A pacing guide totals the whole course up for planning.

The course can be made shorter​

The full run is 46 lessons, plus an optional Module 6. It's designed so you can stop at several sensible places without the ending feeling arbitrary.

Classes are an extension, not a requirement. Every reusable part in the course is built first as plain functions, and that version is complete — the planner swap, the capstones, all of it. Where a lesson has a class version of the same working code, it sits in an optional extension at the end, for students who have the functions working and want to see the parts packaged as objects. A student who starts down that road should stay on it: once you've built LineTrack, use tracker.track_to_intersection() from then on, or you never feel what the packaging bought you. A student who skips every extension loses nothing the course depends on.

Stop after Manhattan. Module 4 ends with a robot that plans a route and drives it autonomously — a satisfying finish on its own. Module 5 is the same story told with a better algorithm.

Do the pathfinding, but not the discovery part. Module 5's algorithm can be taught with a map of obstacles known up front. Adding the code that finds blocked intersections while driving and re-plans around them is the most demanding work in the course, and it's the natural thing to drop if you're short on time.

Leave out Module 6. Dijkstra's algorithm is its own optional module precisely so that it can be skipped as a unit. Nothing depends on it.

What you need​

Robots. One XRP per two students works; one each is better from Module 2 on, where line tracking is fiddly and students need their own runs. A low battery presents as a dozen unrelated-looking bugs, and it kills Bluetooth before it kills anything else — which is why the battery system below is worth setting up properly.

Computers. Chrome or Edge, and nothing to install: the whole course runs in XRP Code in the browser, Blockly first and then Python files in the same editor. Safari and Firefox load the page but can't connect to a robot.

USB cables. One per robot, and they must be data cables — charge-only cables are the single most common first-day failure. Every robot also needs one USB connection before it can go wireless, so plan that pass before day one.

Floor space. Open floor for Modules 1 and 2, with a taped line course for the line-tracking work. Modules 3 through 5 need a taped grid, which is worth laying down once and leaving — three modules use it.

Whiteboard panels. Hardware stores — Lowe's, Home Depot — sell large whiteboard-faced panels cheaply, and will usually cut them down for you. They do two jobs. They give you a driving surface you can put on the floor or lay across a couple of tables, which matters when floor space is short or you'd rather students work standing up. And they're what the robot draws on: with a marker fitted, the shape lessons in Module 1 stop being abstract and leave a square, a triangle or a hexagon behind on the board. (Specific panel recommendations to come.)

Dry-erase markers. They fit the marker holder on the robot, which is how a drawn shape becomes the evidence that the program worked — a square that doesn't close tells you more than any error message. Keep spares; they dry out, and a faint line is hard to judge. You'll want them for drawing courses and grids on the panels too.

A few sheets of paper, printed. Lesson 1-6's Earth – Moon – Earth activity wants an Earth and a Moon cut out and taped to a panel; the printable is in that lesson's Resources. One sheet per group, and they survive being re-taped for years if you laminate them.

Tape. For line courses on the floor, matte black electrical or gaffer tape on a light surface gives the reflectance sensor the contrast it needs. Glossy tape reflects and reads light.

Rechargeable AA batteries and chargers. Buy more batteries than you have robots, and enough chargers to keep up. The system that works in a classroom is two labeled boxes — charged and needs charging — sitting next to a bank of chargers. Students take a charged set at the start of class and drop the spent cells into a charger or the needs-charging box on the way out. Nobody waits for a robot to charge, and a robot that dies mid-period is a thirty-second swap instead of a lost lesson. Somebody does have to move cells from the box into the chargers, so make it a student job with a name on it.

A place to keep them. Robots survive better in numbered bins than in a pile, and numbering pays off again when a room full of XRPs shows up in the Bluetooth list — label each robot with its ID the first time you connect it.