Skip to content

Reinforcement learning

Learning by trial and error: no labels, just a score. An agent acts in an environment, receives a reward, and gradually prefers actions that lead to more reward. AlphaGo learned Go this way; your robot learns the track the same way.

The vocabulary

  • State — what the agent observes (the camera frame, position on track).
  • Action — what it can do (steer, accelerate).
  • Reward — the number your reward.py returns each step.
  • Policy — the strategy being learned: state → action.
  • Episode — one run from start until crash/finish/timeout.

Training (PPO on this platform) collects thousands of episodes and shifts the policy toward higher total reward.

Reward design is the craft

The agent optimizes exactly what you wrote — not what you meant:

  • Reward speed only → it may learn to spin in fast circles.
  • Reward "still on the line" every step → it may crawl to farm reward safely.
  • Big sparse rewards (only at the finish) → almost no signal to learn from early on.

Good rewards are dense (frequent feedback), aligned (can't be farmed), and simple (start with one term, add more only when behavior demands it).

Why simulator-only

Trial and error means thousands of crashes — free in simulation, expensive in reality. That is the heart of Sim2Real: train where failure is free, deploy where it counts. Try the idea in the racing courses.

AI