< back

Teaching an RC car to drive itself

The goal is simple to say: put a camera on a small RC car, drive it around for a while, and have it learn to drive the same way on its own. Getting there has taken a few detours.

[2024-11]

Starting in simulation

I started in Webots, a robot simulator, with a car in a little city world. The first controller did nothing smarter than steer along a cosine wave, but it got me comfortable with the steering/throttle loop before any hardware could break. A couple more simulated worlds later, I wanted something real.

[2025]

Picking a brain

I prototyped an iOS app to use an iPhone as the onboard computer (great camera, great chip, already in my pocket), then settled on a Raspberry Pi with a camera module, which is much easier to bolt onto a car and hack on.

[2026]

The real car

 camera --> [ Raspberry Pi ] --> web dashboard
                  |
              WiFi / HTTP
                  v
 RC receiver --> [ ESP32 ] --> steering servo
                           --> motor (ESC)

Learning by copying

The plan is behavioural cloning, the same idea as NVIDIA's PilotNet: a small CNN that takes a camera frame and outputs a steering angle. To train it, I drive the car by hand and record what I did.

Where it's at

The hardware works and I'm in the collecting-laps phase. Next up: train the first model, put it on the Pi, and see how many laps it lasts before it finds a wall. I'll update this post as it goes.