Reinforcement Learning — the robot teaches itself¶
No labels this time. You design the reward; the model tries, fails, and learns — thousands of runs in the simulator.
Design the reward¶
- PhysiCar panel → Racing → Machine Learning → Train → Learning Algorithm Reinforcement.
- The reward editor is embedded on the page —
reward.py, the one file you write. Return a number every step: higher when driving well (on the line, moving forward), lower or negative when not. - Ask the AI tutor to help — "write me a reward that punishes leaving the line" — it edits this exact file, and the editor picks it up live.
Train (simulator only)¶
- Tick the tracks to train on, set steps, Run.
- Watch the reward-per-episode chart climb. Flat chart? Your reward may be too sparse or contradictory — tweak and run again. Training checkpoints continuously, and however a run ends, the model learned so far is saved to the store.
Drive¶
Same Inference page as supervised learning — the two methods train the same network. Pretrain with your labels, finetune with reinforcement, and compare laps.
Then take it to reality: move your model to the real robot.
Why rewards shape behavior → Learn: reinforcement learning