FixTheRobot Explore Robotics / Navigation / M6 / M6-L3

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

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

Avoid a Moving Obstacle

10:50. A porter pushes a linen trolley across the corridor just as Scout arrives with the lab samples. Scout either stops dead twenty metres away for a porter who would have passed behind it, or drives on and clips the trolley. The tracker knows where the porter is and how fast. The robot has to turn that into a decision.

You will predict when and whether two moving discs touch, choose the highest speed that keeps a safe gap at the closest approach, and then protect against the porter doing something else than walking straight on.

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 time to collision as a circle-circle problem: a quadratic whose discriminant says whether the courses ever come closer than the sum of the radii. Stage 2 uses closest approach to choose the largest speed that is still safe, which is the least intrusive way to let someone cross. Stage 3 plans against several hypotheses about what the person will do, because constant velocity is a model, not a fact.

    Grading is result-based: times are compared with the exact roots, and each chosen speed is checked by the simulator against the closest approach it produces.

    Theory for this lab

    Local Planning and Obstacle Avoidance labs

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

    Educational simplification: circular robot and person, the robot drives straight at a chosen speed, constant velocity for the person (or one of a few listed alternatives), a fixed horizon and one decision per case. Real systems replan every cycle and can steer as well as slow (lessons M6-T3 and M6-T7).

    Get the next lab

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