A robot learns to cross a field of obstacles, inside a Webots simulation.
Real robots are slow teachers
A real robot costs money, breaks when it crashes and takes minutes to reset. You cannot run a thousand trials on it in one afternoon.
A simulator can. Webots is an open-source robot simulator with real physics: gravity, friction, motors and sensors.
A rover, a field and a goal
I built a wheeled rover in Webots and gave it a lidar: a sensor that measures distance with laser light. The rover must cross a field of obstacles and reach a goal.
A controller written in Python reads the lidar, picks a safe direction and sets the wheel speeds. A PID controller keeps the rover on its heading: it measures the error and corrects it, many times a second.
- 01Lidar scan
- 02Obstacle map
- 03Path planner
- 04PID controller
- 05Wheel motors
From laser beams to wheel speeds
- Physics engine
- Webots simulates mass, friction and motor torque, so the rover behaves like a real one.
- Lidar
- A ring of laser beams returns the distance to every obstacle around the rover.
- Path planning
- The planner picks the clearest route to the goal and replans when the way is blocked.
- PID control
- Proportional, integral and derivative terms hold the heading steady.
- Sim-to-real
- Sensor noise is added in the simulation, so the controller is ready for a real robot.
The lab in numbers
- 360°
- lidar view around the rover
- 3
- control terms hold the heading: P, I and D
- 0
- robots broken while testing
What comes next
Train the controller with reinforcement learning. Then move it to a real rover.