Robot Learning · Learning for Manipulation and Locomotion · M9-L3 · Intermediate
Wrap a Policy in a Safety Controller
Experiment log · Scout at Meridian General Hospital
Experiment log, Meridian General Hospital, east corridor. The learned navigation policy is good: on a quiet night Scout reaches the goal every time. But about once in twenty steps it emits a full-speed command straight at the pillar, holds it for three steps, and recovers as if nothing happened. In the replay of last week's trial, 11 of 24 runs ended in a crash. Nobody can retrain the policy before the demonstration on Friday.
You are asked for the classical answer: do not touch the learned policy, wrap it. First a speed limit that keeps the direction of a command, then a monitor that predicts where the robot would be one step later and vetoes a command that ends inside the pillar's collision circle, then a fallback that backs away while still heading for the goal. The simulator runs 24 episodes with and without your wrapper and reports crashes, goal rate and the extra steps the safety costs.
Your task
Lab complete: post-mortem
You have passed every stage. Now connect it back to the theory and move on:
Output
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.