Line Tracing — rule-based driving¶
No AI yet: you are the intelligence. The robot follows a line using rules you tune — and you'll feel exactly where rules reach their limit.
Run it¶
- PhysiCar panel → Tutorials → Racing → course pill Rule-Based.
- Click ▶ Line Tracing — it runs
tutorials/racing-rb/line_tracing.pyin the terminal. The app's MYAPP tab shows the camera and the color mask — white pixels are what the robot currently counts as "line". - Watch a lap. If it wobbles or loses the line, tune the rules (next section).
Tune the rules (the gear)¶
- Line color range (HSV) — widen or shift until the mask shows the line cleanly and nothing else. Lighting changes this; on the real robot you'll retune.
- Speed / steering gain — faster is harder: steering must react more per pixel of error.
- Camera pan/tilt — looking further ahead smooths driving, but reacts later.
Every change applies live — no restart.
What you just learned¶
This is rule-based AI: transparent, fast to build, and brittle — a shadow or a sharper curve breaks it, and you add rule upon rule. That pain is exactly why the next course lets the machine learn the rules itself → Supervised Learning.
Theory → Learn: the AI landscape