Skip to main content

Setting up the classroom

Teacher guide

Setting up the classroom

Before day oneRobots, courses, the gridChecklists

Most lost class time in a robotics course is setup, not teaching: a charge-only cable, a flat battery, a line course with glossy tape. Nearly all of it can be settled before the first lesson. This page is that list, in the order you'll need it.

The software: nothing to install​

Students write every program in XRP Code at xrpcode.wpi.edu, in the browser: Blockly through Lesson 1-7, Python files in the same editor from Lesson 1-8 on. There is nothing to install on the computers and no Python setup to manage. The robot's own library, XRPLib, is already on the robot and XRP Code keeps it up to date.

Use Chrome or Edge. XRP Code reaches the robot through browser features only Chromium browsers have, so Safari and Firefox load the editor, let students build a program, and then fail at the moment they try to connect: the robot simply never appears. If a student "can't find the robot," check the browser first.

The XRP Code chapter of the XRP User Guide covers the editor's panels, connecting, and its own troubleshooting in depth.

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.

The robots: the first USB pass​

Do this once, before Lesson 1-1, for every robot:

  1. Assemble and test-drive each XRP following the XRP User Guide. Check that the wheels turn freely, the line sensor board is mounted, and the rangefinder is attached (Module 5 needs it).
  2. Connect it by USB with a known data cable and open XRP Code. The first connection installs or updates the software on the robot; let it finish.
  3. Label the robot with its ID, which XRP Code shows under the RUN button. In a room full of XRPs, the Bluetooth list is unusable without labels. Number the storage bins to match.
  4. Try Bluetooth. Once a robot has had its USB connection, XRP Code can reach it wirelessly. Students will want this from Lesson 1-2 on, when the robot drives squares on the floor and a cable only reaches so far.

Keep a few known-good data cables at a demo station all year. USB is the fallback whenever wireless acts up.

Two habits to teach in the first week​

Put the robot down before you switch it on. For its first few seconds after power-on or reset, the XRP calibrates its gyro, and the calibration assumes the robot is perfectly still. A robot held in a hand calibrates against a moving reference, and every turn it makes afterward is off by an unpredictable amount, with no error to tell you. The routine is: robot down, power on, hands off for a few seconds, then press the user button to start the program. Lesson 1-1 teaches it; it is also the first thing to check whenever turns misbehave, in any module.

Every program starts by waiting for the button. That is why the routine above works, and it also keeps a robot from driving off a table the moment a program uploads. From Module 2 on, the run block at the bottom of robot.py waits for the button and then calls one test; driving tests from Module 5 on print their plan first and wait for a second press before they drive.

Batteries​

The battery system in the materials list above is worth setting up properly. A low battery doesn't announce itself: it shows up as Bluetooth that won't connect, turns that come up short, and a line follower that wanders, which look like a dozen different bugs. A robot that connects over USB but not over Bluetooth needs fresh batteries before any other troubleshooting.

The line course (Module 2)​

Module 2 runs on a taped circle: the robot learns to stop at it (2-2), bounce around inside it (2-3, 2-4), and follow it (2-5 on). From Lesson 2-8 the circle has a cross: one short strip of tape laid across the line, about half as long as the robot is wide, so the sensors see it as an intersection but a turn sweeps past it.

  • Matte black tape on a light surface. Electrical or gaffer tape. Glossy tape reflects light and reads as white.
  • Press it flat. Bubbles and lifted edges change the readings.
  • More than one circle. Line tracking is fiddly, and students need their own runs. One circle per two or three groups keeps the queue short; whiteboard panels make this easy, because each panel can hold its own course.
  • Watch the light. Direct sun or a bright spot under a ceiling light shifts the readings. Calibration handles it, but a course half in sun and half in shade will confuse everyone.

Students calibrate their own sensors in Lesson 2-1: the readings run from about 0.2 on white to about 0.8 on black tape, and the threshold is halfway between. Have them keep their numbers; they reuse them all module, and they recalibrate when they move to the grid.

The grid (Modules 3 to 6)​

From Module 3 on, the robot drives a 4 × 4 grid of taped lines, sixteen intersections, made from the same tape on the same kind of surface as the circle. Lay it once and leave it: three modules use it, and Module 6 changes one segment.

  • Coordinates are (x, y), with (0, 0) at the corner nearest the students. x counts across to the right (East); y counts away from the students (North). The usual start is (0, 0) facing North, into the grid. Label 0 to 3 along the near edge and up the left edge with tape or a marker; it saves a lot of pointing.
  • Square and straight. Lines should cross at right angles, and every intersection should be a clean cross that both sensors reach at once.
  • Leave a margin. The robot turns on an intersection by pivoting about the middle of its axle, so give the outer lines enough room that a robot turning on an edge intersection stays on the board.
  • The code counts intersections, not centimeters. Nothing in the lessons depends on the exact spacing, so fit the grid to your space.

Obstacles (Module 5). Lessons 5-7 to 5-9 place boxes on intersections, and the robot's rangefinder looks for one on the next intersection before it drives there. The lesson's starting threshold is 15 cm; the right value depends on your grid spacing and on what the obstacles are made of. Measure it yourself before 5-7 with a box on the next intersection and with nothing there, and have a number ready. Firm, flat-faced boxes read most reliably; soft or angled ones read inconsistently.

The slow segment (Module 6, optional). Lesson 6-1 needs one segment of the grid re-taped as a winding detour between two neighboring intersections, long enough that driving it takes at least four normal blocks' time (five is better). Between (0, 1) and (0, 2), up the left edge, works well. Keep the detour's tape the same width and its curves gentle enough to line-follow, and test it with a robot before students arrive. Lesson 6-1's teacher notes have the details. This physical setup is still being tried on real grids; if you find a better one, tell the course author.

Checklists​

Before each class:

  • Enough charged batteries in the "charged" box for every robot in use
  • The courses clean, flat and well lit
  • Computers on Chrome or Edge, with XRP Code loading
  • A couple of known-good data cables at the demo station
  • For Module 5: obstacles ready and your rangefinder threshold measured
  • The lesson's slides open, and the lesson page open in teacher mode

Each week:

  • Look over every robot: loose wheels, sensor boards, wiring
  • Wipe the reflectance sensors and press down any lifting tape
  • Move spent batteries from the "needs charging" box into the chargers, and retire cells that no longer hold a charge

When something goes wrong​

What you seeMost likely causeWhat to do
The robot never shows up in XRP CodeSafari or Firefox; or a charge-only USB cableSwitch to Chrome or Edge; swap in a known data cable
USB works, Bluetooth doesn'tLow batteries; or a program already running on the robotFresh batteries first; then press the robot's reset button and connect again
RUN fails once, for no clear reasonA flaky connectionWait ten seconds and try once more before digging deeper
Turns are off by a different amount each runThe robot moved while it calibrated at power-onPut it down, reset, hands off for a few seconds, then press the button
The same program gives different results on different daysBattery level, surface, wheel slipExpected with timed or effort-based driving; it is the lesson in 1-6, and why later modules stop on sensors
The line follower can't see the line, or sees it everywhereThreshold from another surface; dirty sensors; glossy tapeRecalibrate on this surface (2-1); clean the sensors; re-tape with matte tape
The robot stops the instant it starts on the gridIt started on an intersectionStart on a segment, facing the next intersection
It misses or overshoots turns on the gridTurning before the wheels reach the cross; turn settingsCheck that track_to_intersection() ends with the 8.75 cm drive onto the cross; then tune the turn settings
The rangefinder gives odd distancesSoft or angled obstacle; threshold not measured for your gridUse flat, firm boxes; re-measure the threshold

Module 5's driving is Module 4's, unchanged. If a robot misbehaves on the grid in Module 5, it did the same in Module 4; fix it there.

Safety​

  • Keep fingers clear of the wheels while a program runs, and keep long hair and loose sleeves away from them.
  • Robots on tables are a falling hazard. Waiting for the button, and starting the robot where it can't drive off an edge, are habits worth enforcing from Lesson 1-1.
  • Keep drinks away from the robots and computers.
  • Mark the floor courses so nobody trips on them, and keep cables off walkways.
  • Report damaged wiring or battery holders instead of fixing them mid-class.

Before you teach it​

The best preparation is to do the lessons yourself, on a robot, a module ahead of your class: the setup snags, the tuning, and the bugs students will hit are all easier to explain once you've hit them. The XRP User Guide and the XRPLib documentation cover the robot and its library, and the support forum is where other XRP teachers ask and answer questions.