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

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

Robot Learning · Model-Based Robot Learning · M7-L1 · Intermediate

Fit the Dynamics

Experiment log · Scout at Meridian General Hospital

Experiment log, Meridian General Hospital, logistics corridor. Scout's motion planner was tuned in a simulator that assumes the robot reaches 1 m/s at full command. On the real floor Scout is slower and heavier, and the plans overshoot the pharmacy door. Nobody knows the true numbers, but the robot has driven around for a few minutes under random commands and the logs were saved.

You will recover the two physical parameters of the momentum model from the log with least squares, write the function that rolls the model forward, and measure how its error grows from one step to twelve. The drives are generated on a hidden floor with different gain, drag and noise for every check.

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 fits the two parameters of v' = v + dt (gain a - drag v) as a 2-parameter linear regression and shows why both weights must be fitted together when the command and the velocity are correlated. Stage 2 writes the model rollout in the exact order the simulator uses, including the clip at the walls. Stage 3 measures root-mean-square position error at each horizon and shows the compounding that makes one-step accuracy a poor guide for planning.

    Grading is result-based: your fit is compared with the exact least-squares solution of each hidden log, your rollouts with the exact simulator on new command sequences, and your error curve with the exact one. 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: this lab.
    2. M7-L2: Plan with Random Shooting
    3. M7-L3: When the Model Lies

    Educational simplification: the real floor is exactly the linear model with Gaussian velocity noise (no wheel slip, delay or saturation), the logs hold 180 transitions from nine short drives with commands held for four steps, and the pillar plays no role. Real systems need a model class check as well as a parameter fit.

    Get the next lab

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