Skip to main content

Lesson 1 · Meet the XRP

Module 1 · Learning to Drive

Lesson 1 · Meet the XRP

50–60 minPhase A · Blockly FoundationNo experience needed
👩‍🏫

Teacher mode is on. Gray boxes and this banner are visible only to you. Toggle it off (switch in the corner) to preview the student view.

Today you'll meet your robot, learn what each part does, and write your very first program to make it drive. By the end you'll have code running on real hardware — no experience required.

Learning Objectives

By the end of this lesson you will be able to:

  • Identify the key hardware parts of the XRP robot and say what each one does
  • Find your way around the XRP Code (Blockly) programming environment
  • Write, upload, and run a block program that drives the robot forward and backward
  • Debug the most common first-day problems
Hook clip — an XRP driving around (1–2 min)
Add a src to embed your video here
Watch the XRP in action. What makes it move? How does it know what to do?

The parts of the robot

Before we program the XRP, let's see what we're working with. Every part has one job, and knowing them makes debugging much easier later.

The XRP kit laid out and labeled: chassis, wheels, O-rings, hobby motors with encoders, XRP controller board, battery holder and cover, ultrasonic distance sensor, line follower, servo, casters, clips, lift arm, and Qwiic cable
Everything in the XRP kit, labeled. Find each part in front of you as it comes up below.
  • Wheels & motors — Two motors, one per side. Each motor spins one wheel. Because the sides move independently, the robot can steer.
  • Controller board — The robot's "brain." It receives your program over USB and tells the motors what to do.
  • Battery — Powers everything. A low battery makes the robot sluggish.
  • Sensors — Reflectance sensors (see light vs. dark — labeled Line Follower in the diagram) and an ultrasonic rangefinder (measures distance). You'll use these in later modules.
  • Caster wheel — The little rear wheel that keeps the robot balanced.
Knowledge Check

Why does the XRP have two motors instead of just one?

Knowledge Check

Which part is the 'brain' that runs your program and tells the motors what to do?

How the robot gets instructions

A robot only does what you tell it. The workflow is always the same:

  1. Write a program (we'll use Blockly).
  2. Connect your computer to the robot — by USB cable or over Bluetooth.
  3. Upload the program to the robot.
  4. The robot runs the program — each command in order.

Step 3 matters: writing a program isn't enough. It has to be uploaded before the robot can run it.

Two ways to connect

USB cable. Plug the robot into your computer. This is how you'll connect today, and it's the connection every robot needs the first time — XRP Code uses it to install and update the software that lives on the robot.

Bluetooth. Once a robot has been set up over USB, XRP Code can reach it wirelessly. Unplug the cable, turn the robot on, click CONNECT, choose Bluetooth, and pick your robot from the list. Everything works exactly as it does over USB — you're just not tethered to the table anymore, which matters a lot once the robot is driving around the floor.

Every XRP has its own ID, shown under the RUN button while it's connected. Write yours on the robot so you can pick it out of the list — and don't pair with somebody else's robot.

Knowledge Check

Your robot is brand new. Why can't you just connect to it over Bluetooth right away?

Your first program in XRP Code

XRP Code runs in a web browser — there's nothing to install and nothing to log into. Open xrpcode.wpi.edu/staging and you're at the place where you'll build programs by dragging blocks.

Use Google Chrome or Microsoft Edge. This isn't a preference — talking to the robot needs browser features for serial and Bluetooth connections that only those browsers support. Safari and Firefox will load the page and let you build a program, then leave you stuck at the point where you try to connect: your robot never appears in the list. If you hit that, switch browsers before you troubleshoot anything else.

The XRP User Guide has a whole chapter on XRP Code — a tour of the three panels, connecting over USB step by step, and a troubleshooting section for when a robot won't show up. Keep that chapter open in a tab; this lesson covers just enough to get your first program running.

Knowledge Check

A classmate built a program in XRP Code on Safari, but when they click CONNECT their robot never appears in the list. What is the most likely reason?

Screen recording — creating a project & the three key blocks
Add a src to embed your video here
A quick tour of XRP Code: the block palette, the work area, and the upload button.

A few blocks do everything you need today. Drag them out of the block palette:

  • The Wait for button press block wait_for_button_press block goes at the very top. A program starts running the moment it's uploaded — this block makes the robot sit still until you press its button, so it doesn't drive off the table while you're still holding it.
  • The Straight block straight block drives in a straight line. cm is how far to go — a negative number drives backward — and Effort is how hard the motors push, from 0 to 1 (0.5 is a good starting speed).
  • The Turn block turn block turns the robot in place. Deg is the angle (90 is a quarter turn); Effort works the same way.

You don't need a block to stop at the end — when the program finishes, the robot stops the motors for you.

Here's the program we'll build together — wait for the button, drive forward, then come back. Set the second Straight block's cm to a negative number so the robot reverses:

wait_for_button_press block
straight blockforward — cm: 20, Effort: 0.5
straight blockback — change cm to -20
Your first program: wait for the button, drive out 20 cm, then back 20 cm.

Before you run it, predict: What will the robot do? Will it end up where it started?

Knowledge Check

You place two Straight blocks one above the other. When you run the program, what happens?

Activity · Upload and run it

Follow these steps:

  1. Create a new project called Lesson_1_First_Drive.
  2. Build the forward/backward program from above.
  3. Connect the robot: plug in the USB cable (use the cable today — your robot needs one USB connection before it can go wireless).
  4. Click Upload and choose your robot from the list.
  5. Wait for "Upload Successful," set the robot on the floor, then press the button on the robot — your Wait for button press block releases the program and it runs.

You've succeeded when:

  • The program uploads without errors
  • The robot drives forward about 20 cm
  • The robot drives back about 20 cm
  • It stops near where it started

If something goes wrong

  • Robot won't move — check the battery is charged and the USB is seated, then re-upload.
  • Drives the wrong way — motor directions can be reversed; that's normal and fixable later.
  • Not exactly the distance you set — floor friction and battery level affect distance. Close is fine for now.
  • Robot not in the upload list — try another USB port or cable (some cables are charge-only), then reload the page.
  • Robot doesn't appear over Bluetooth — charge the battery first (a low battery stops Bluetooth before anything else), press the robot's reset button so it isn't busy running a program, and make sure you're in Chrome or Edge. Still stuck? Plug in the cable and keep going.

Activity · Make it your own

Now experiment. Try these in order:

  1. Go farther — change the cm on both Straight blocks to 30 and re-run.
  2. Change the effort — try 0.3, then 0.8. What changes: how far the robot goes, how fast it gets there, or both? Measure before you decide.
  3. Add a turn — drop a Turn block turn block between the two Straight blocks. What shape does the path make now?
  4. Challenge — can you make the robot drive a square and end up back where it started? No hints: try something, run it, watch, adjust. (Lesson 2 picks up right here, so whatever you figure out now is a head start.)

Real-world connections

The same ideas you just used run much bigger machines:

Warehouses

Delivery robots

Differential-drive robots shuttle shelves around fulfillment centers — same two-motor steering as your XRP.

Homes

Robot vacuums

They drive, turn, and sense obstacles using exactly the sequence-of-commands idea from this lesson.

Space

Planetary rovers

Rovers upload a program, then run it on their own — because they're too far away to control live.

Wrap-up

Quick recap — answer these in your head or with a partner:

  • What are the main parts of the robot, and what does each do?
  • What does a block program actually do?
  • How does a program get from your screen onto the robot?
Knowledge Check

True or false: you can run a program on the robot without uploading it.

Knowledge Check

True or false: the reflectance sensors detect color.

Resources