FixTheRobot Explore Robotics / Navigation / M2 / M2-L3

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

Navigation · Maps and Costmaps · M2-L3 · Intermediate

Find the Ghost Obstacles

14:05. A cart was parked in the east hallway at noon and taken away at one. Scout still drives around it, and the nurses have started calling the empty spot "the ghost". Later the open doorway at the end of the hall gets a wall that nobody built.

Both problems are in how the obstacle layer handles what the laser says. You will trace a beam through the grid, clear what it passes through, mark only what it hits, and handle a beam that returns nothing.

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 is the ray: the list of cells a beam crosses. Stage 2 uses it for the two halves of an obstacle layer, marking where a beam ended and clearing where it passed. Stage 3 deals with the case that causes the most confusing bugs: a beam that returns nothing, which must clear without marking.

    Grading is result-based on the practice scene and on freshly generated hidden hallways.

    Theory for this lab

    Maps and Costmaps labs

    1. M2-L1: Build an Inflated Costmap
    2. M2-L2: Compute a Distance Field
    3. M2-L3: Find the Ghost Obstacles: this lab.

    Educational simplification: noise-free beams that end in a single cell, one obstacle layer, rounding-based ray tracing, no time-based expiry, and no other sensors. A real obstacle layer also bounds the clearing range and combines several sources (lesson M2-T4).

    Get the next lab

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