FixTheRobot Explore Robotics / Navigation / M7 / M7-L4

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

Navigation · Safety, Uncertainty and Recovery · M7-L4 · Intermediate

Detect and Escape a Stuck Robot

16:30. Scout rocks back and forth in front of a locked door for ten minutes. The wheels turn, the odometer climbs, and the log says "navigating". Nobody is told until the pharmacy phones.

You will teach Scout to notice that it is going nowhere, to pick a recovery that is safe where it stands, and to fire the recovery once and give it time.

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 detector: stuck means no progress towards the goal over a time window, not "the wheels are not turning", so rocking and wobbling count as stuck while slow progress does not. Stage 2 chooses the next recovery from the surroundings and what was already tried. Stage 3 replays a whole run and fires the recovery once per cooldown.

    Grading is result-based: your functions are run on recorded runs and situations generated for hidden scenarios, and compared with the exact answers.

    Theory for this lab

    Safety, Uncertainty and Recovery labs

    1. M7-L1: Size the Safety Margin
    2. M7-L2: Plan with Pose Uncertainty
    3. M7-L3: Build a Recovery Behavior Tree
    4. M7-L4: Detect and Escape a Stuck Robot: this lab.

    Educational simplification: positions with 1 cm of noise, one goal, given thresholds and recoveries that either apply or do not. Real detectors also use the commanded velocity, the planner state and localization quality, and the recovery rules of a real site belong to its own safety review (lesson M7-T6).

    Get the next lab

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