FixTheRobot Explore Robotics / Localization & SLAM / M4 / M4-L3

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

Localization & SLAM · Graph-Based SLAM · M4-L3 · Advanced

Diagnose a Broken Loop Closure

The map was fine until the robot passed the second aisle. Then the corridor bent, the walls doubled, and everything after it was wrong. The cause is one loop closure: two places that look the same and are not.

You find it with a statistical test, then learn how to make the optimiser itself resist such mistakes.

Your task

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

    Plain Python with math and, for matrices, slamkit (matmul, transpose, solve, inverse, identity). The data arrive as the dictionary D. There is no NumPy, random, json or copy in the browser runtime. Your code runs locally and never leaves this page.

    Hints

    What this lab teaches

    Stage 1 is the consistency test of M4-T5: ask what the rest of the graph predicts for a closure and measure the disagreement in standard deviations. It is graded against trajectories where the simulator knows which closure is false. Stage 2 is the IRLS weight of M4-T6. Stage 3 runs a reference robust optimiser so that you can see why Huber is not enough and a redescending kernel is. The false edge’s identity stays in the simulator.

    Theory for this lab

    Graph-Based SLAM labs

    1. M4-L1: Visualize a Pose Graph
    2. M4-L2: Correct Accumulated Trajectory Drift
    3. M4-L3: Diagnose a Broken Loop Closure: this lab.
    4. M4-L4: Compare Trajectories Before and After Optimization

    Educational simplification: one false closure among three good ones on a circular trajectory, diagonal information, a precomputed leave-one-out solution and predicted covariance, and plain IRLS. Production systems detect false closures in the front end (verification, consistency), and use switchable constraints, DCS, max-mixtures, PCM or GNC in the back end.

    Get the next lab

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