FixTheRobot Explore Robotics / Navigation / M6 / M6-L1

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

Navigation · Local Planning and Obstacle Avoidance · M6-L1 · Intermediate

Escape the Local Minimum

14:05. Scout is parked in the east corridor with the medication tray and a clear goal 8 m ahead. Nothing is in its way except a long partition wall that is not on the planned path. The planner is happy. The controller says the robot is fine. It has not moved for four minutes.

You will write the force that the goal and the walls exert on the robot, build the monitor that notices a robot that has stopped for no good reason, and add the rule that gets it moving again.

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 potential field itself: an attractive pull towards the goal and a repulsive push from each obstacle that acts only inside an influence distance. Stage 2 is the monitor: a stuck robot looks different from a robot that has arrived or one that is merely slow, and the difference is only visible over a window of positions. Stage 3 is the escape: at a local minimum the forces cancel, so the robot must be moved by a rule that does not come from the field.

    Grading is result-based. Your force function is compared with the exact forces at points near and far from the obstacles; your stuck monitor is run on frozen, jittering, arrived and slowly moving traces; your escape direction is simulated, and the field then has to carry Scout to the goal.

    Theory for this lab

    Local Planning and Obstacle Avoidance labs

    1. M6-L1: Escape the Local Minimum: this lab.
    2. M6-L2: Implement the Dynamic Window
    3. M6-L3: Avoid a Moving Obstacle
    4. M6-L4: Pass Without Colliding: ORCA

    Educational simplification: a point robot that moves in small gradient steps, circular and straight-wall obstacles, no dynamics and no sensor noise, and an escape that is a straight move of fixed length. Real systems combine a field or cost function with a global path (lesson M6-T1) and recovery behaviours (lesson M7-T6).

    Get the next lab

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