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

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

Robot Learning · Learning for Manipulation and Locomotion · M9-L1 · Intermediate

Predict Grasp Success

Experiment log · Scout at Meridian General Hospital

Experiment log, Meridian General Hospital, pharmacy corridor. Scout's new two-finger gripper has to pick up medication boxes of unknown weight. Before anyone lets it near a real vial, the team logged a few hundred trial grasps in a simulator: how far off-centre the fingers closed, the tilt of the hand, an estimate of the friction, the squeeze force, and whether the box stayed in the gripper. The first model they trained scored 99 percent. The second one, trained on the same data, was tried on the real gripper and dropped nearly everything.

You will write the three small pieces of the pipeline yourself: the standardisation of the features, the gradient-descent training of a logistic regression, and a screen that finds the column that made the first model look so good. The logs are generated by a toy grasp model with hidden mass and noisy friction readings; every check uses a new log with a different friction-sensor noise.

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 standardises a feature matrix and returns the statistics that the trained model will need again on new grasps, with a safe handling of a constant column. Stage 2 trains a logistic regression by batch gradient descent on the cross-entropy loss and compares the learned boundary with the reference one on the training grasps and its accuracy on 600 unseen grasps. Stage 3 screens the columns for a leaked feature, the slip measured after the lift, and the page retrains without the flagged columns to show the honest accuracy in the simulator and on a "robot test" in which the slip is unknown.

    Grading is result-based: your statistics are compared with the exact ones, your weights are scored by loss and by held-out accuracy (the reference model is trained by the page in JavaScript), and your flagged columns are compared with the columns that really exceed the threshold. In the hidden logs the columns are shuffled, so a function that returns a fixed index fails. Python runs only the standard builtins and math; the workloads are small (at most 150 rows, 100 epochs).

    Theory for this lab

    Learning for Manipulation and Locomotion labs

    1. M9-L1: Predict Grasp Success: this lab.
    2. M9-L2: Shape a Gait Reward
    3. M9-L3: Wrap a Policy in a Safety Controller

    Educational simplification: a toy two-finger grasp model (a friction and torque balance with hidden object mass), not a contact-physics simulator. Success is decided by a rule the model can only approximate because the mass is never shown and the friction is measured with noise; the leaked column is built to be a near copy of the label. The 0.8 correlation threshold is this lab's own heuristic, and a real leak can be subtler (spread across several features or caused by how the data were split).

    Get the next lab

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