FixTheRobot Explore Robotics / Robot Learning / M7 / M7-L3

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

Robot Learning · Model-Based Robot Learning · M7-L3 · Advanced

When the Model Lies

Experiment log · Scout at Meridian General Hospital

Experiment log, Meridian General Hospital, logistics corridor. Scout's planner now uses a model learned from slow test drives. In the simulator replay every plan is perfect and the robot glides around the pillar to the pharmacy. On the floor, the same plans clip the pillar two times out of five. The average prediction error of the model is a few centimetres, so what is going on?

You will diagnose it in three steps: split the model's error by where Scout is, work out how many steps of a plan can be trusted when the worst drives are taken seriously, and choose how often to replan. JavaScript then drives Scout from ten starting positions through the hall, with a planner that uses the lying model and your replan interval, and counts goals and collisions.

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

    The learned model here is accurate at the slow speeds of its training data and increasingly wrong above them, so its error depends on the state. Stage 1 measures one-step position error near and far from the pillar and shows how a global average hides the region that matters. Stage 2 turns open-loop drives into an error-by-horizon curve and sets the safe horizon from its 90th percentile instead of its mean. Stage 3 converts the curve into a replan interval and then tests it in a closed-loop simulation, comparing it with replanning only every 12 steps.

    Grading compares your numbers with exact references on hidden floors (different gain and drag) and, for the last stage, runs the closed loop with your interval. The charts draw the exact result in orange and yours in blue.

    Theory for this lab

    Model-Based Robot Learning labs

    1. M7-L1: Fit the Dynamics
    2. M7-L2: Plan with Random Shooting
    3. M7-L3: When the Model Lies: this lab.

    Educational simplification: the learned model is a hand-built stand-in whose drag term is too weak above 0.2 m/s, not a trained network; the floor is the module's linear momentum model with small noise; one obstacle; the planner is 60-sample random shooting; the closed-loop test uses ten starts and a single planner seed per start, so its counts are illustrative.

    Get the next lab

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