FixTheRobot Explore Robotics / Navigation / M10 / M10-L1

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

Navigation · Capstone: The Shift · M10-L1 · Advanced

The Shift Simulator

06:55, Meridian General. The night shift hands Scout over with a list: six deliveries, two of them urgent, a battery at 40 per cent. Over the next two minutes of simulated time the east door will close on its timer, a visitor will step out of a niche into the corridor, and Scout will meet the new glass partition in the atrium that its laser cannot see.

You will write the four small functions a delivery robot needs on a shift: the route, the safe speed, what to do when blocked, and the order of the stops. The first three are tested one at a time. The last stage puts them together and runs the whole shift on timings you have not seen.

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 planner: A* on the hospital grid, shortest route, checked against a reference search. Stage 2 is the speed policy: the fastest speed at which the robot can still stop inside the free distance, given its reaction time, its braking and a margin, capped by the speed limits of the building. Stage 3 is recovery: waiting, replanning and asking for help each have a cost in seconds, and some of them cannot work at all. Stage 4 adds the order of the stops and runs the shift.

    In the last stage the simulator asks your functions for routes and for tables of decisions (a speed for every free distance and speed limit, a recovery action for every blocked situation), then drives a 10 Hz simulation of the shift with those tables. It counts collisions, near misses, deliveries on time, battery and time. Grading is result-based: the same checks run on the practice shift and on four hidden ones with different stops, door timing and visitor timing.

    Passing is evidence that your four functions work together under these conditions. It is not a safety case, and lesson M10-T2 says what a real one would need.

    Theory for this lab

    Capstone: The Shift labs

    1. M10-L1: The Shift Simulator: this lab.

    Educational simplification: a 14 by 24 m hospital with 1 m cells, 4-connected routes, a round robot with no turning cost, one visitor on a timer, one door on a timer, one glass partition seen only by a 0.8 m sonar, a linear battery, and a reroute service for replans (your plan function builds the first route of each leg). Not a model of any real robot, and the numbers are for teaching.

    Get the next lab

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