FixTheRobot Explore Robotics / Robot Learning / M3 / M3-L2

This lab works on phones, but writing code is much easier on a laptop.

Robot Learning · Imitation Learning · M3-L2 · Intermediate

Watch the Clone Drift

Experiment log · Scout at Meridian General Hospital

Experiment log, Meridian General Hospital, 11:15. The clone built from the operators' demonstrations looked fine in the trial: for the first few seconds Scout is on top of the expert's path. Then it begins to wander, and a few trips end against the pillar. Everyone agrees the clone was trained well. Nobody can say what goes wrong, or when.

The simulator now runs the clone and the expert from the same new starts and logs both paths. You will measure the gap at every moment, decide when the clone has really left the path rather than just jittered, and fit how quickly the gap grows with the number of steps. The clone is deliberately imperfect: it saw only a few demonstrations from a narrow band of starts.

Your task

    Simulation
    solution.pyLoading Python…
    Ctrl+Enter runs
    What Python can I use?

    Plain Python with math and heapq. Your code runs in a background worker: an endless loop is stopped after a few seconds and the page stays usable. It runs in your browser and is never sent anywhere.

    Hints

    What this lab teaches

    Stage 1 measures the deviation between the clone and the expert at the same time step, which keeps the time axis that a nearest-point comparison throws away, and handles paths that end early (lesson M3-T3). Stage 2 turns the curve into an event, the first step at which the clone has departed for good, using a tolerance and a required run of steps so that one noisy sample does not count. Stage 3 fits a power law to the mean deviation, log d = a + b log t, and asks what an exponent above 1 does and does not say about compounding errors.

    Grading is result-based. Your functions are run on freshly generated clones and starts that you never see, and the answers are compared with the exact ones; the real rollouts differ from one seed to the next.

    Theory for this lab

    Imitation Learning labs

    1. M3-L1: Clone the Expert
    2. M3-L2: Watch the Clone Drift: this lab.
    3. M3-L3: Add DAgger Corrections
    4. M3-L4: Clean the Demonstrations

    Educational simplification: one task, one kind of clone (nearest neighbours deployed as a table), noise-free dynamics, and only a handful of starts behind each mean curve, so the exponents are noisy descriptions of these rollouts and not a law. In this hall the robots move at almost constant speed, so even a steady heading error gives deviations that grow roughly in proportion to time; real compounding can be far more abrupt (lesson M3-T3).

    Get the next lab

    Get notified when new robotics labs are released. One email per new lab, nothing else.