FixTheRobot Explore Robotics / Localization & SLAM / M6 / M6-L2

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

Localization & SLAM · Visual and Visual-Inertial SLAM · M6-L2 · Intermediate

Understand Visual Odometry Drift

The camera-only robot drove one lap and ended several metres from where it started. Its map is a spiral. The heading looks roughly right and the loop is too small.

You rebuild the trajectory from the increments, learn how a monocular trajectory must be aligned before it can be judged, and find which kind of loop closure fixes this drift.

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 dead reckoning from visual increments (M6-T3). Stage 2 is the evaluation step that every monocular benchmark needs and many reports omit: a similarity alignment (M4-T6), graded against the hidden transform that generated the estimate. Stage 3 compares loop-closure corrections against a drift model with a scale decay and a heading bias.

    Why it matters

    Without a scale reference, a camera-only system drifts in scale, and it can only be corrected by a similarity, not a rigid, transform. Knowing that is the difference between a loop closure that works and one that merely looks closed.

    Theory for this lab

    Visual and Visual-Inertial SLAM labs

    1. M6-L1: Diagnose Feature-Tracking Failure
    2. M6-L2: Understand Visual Odometry Drift: this lab.
    3. M6-L3: Investigate ORB-SLAM Failure Modes
    4. M6-L4: Diagnose Camera–IMU Synchronization Errors

    Educational simplification: planar motion on a circular lap; synthetic VO increments with a geometric scale decay and a constant heading bias; exact index-wise correspondence for the alignment; a closure that is a grid search over one scale parameter. Real drift has no fixed model and is corrected by pose-graph optimisation over Sim(3).

    Get the next lab

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