A mobile robot senses obstacles with a ring of range sensors and turns that perception into steering every frame — the perception-action loop at the core of autonomous robotics.
How it works ▾
Eight range sensors sample the scene each frame — this is perception. Every reading feeds directly into the next steering command — this is the action. The policy blends a pull toward the goal with a push away from nearby obstacles into one steering vector:
a = w_g · dir(goal) − Σᵢ w_o · (1/dᵢ²) · dirᵢ
where dᵢ is the distance reported by sensor i and dirᵢ points back from the obstacle it saw. In Reactive policy mode the robot only ever reacts to its live sensors, exactly like a trained RL agent would. In Path planning mode it first runs A* over a full map of the obstacles — privileged information a planner has but a purely reactive policy does not — then drives that path.
The domain-randomization slider injects noise into every sensor reading and every motor command, the same trick used to train policies in simulation that still work once deployed on a real robot (the Sim2Real transfer problem: a policy tuned to a perfect simulator often fails on real, noisy hardware unless it was exposed to noise during training).
- Green sensor rays — clear line of sight. Red rays — an obstacle is close.
- Cyan trail — the path the robot has actually driven this episode.
- Reaching the glowing goal scores +1 reward and starts a new episode; a collision costs −0.5.