Self-Driving Test


Sorry about the course pixelation, it makes the file smaller.

The camp director is hot for self-driving cars, so I proposed a camp project that the kids take video live off a camera and find pedestrians in it. It's not actually driving, but it's arguably one of the harder things to do. It is harder, but feasible if we make the pedestrians wear bright solid colors.

Then one of the kids decided he didn't want to code up a solution, but rather use existing code and do neural nets (NNs). My experience with using other people's code is that it's often harder than just writing it all from scratch. My experience with NNs is even worse. But the director wants to humor the kid, so he's off to do neural nets. He will probably fail, and I cannot help him. Maybe he will have fun anyway (we all hope so).

Anyway the director suggested that instead of trying to find pedestrians, he could see if he could steer a vehicle around a track like Pat's Acres in Portland. Training data should be easy, just plant a camera behind the driver so it can see the road and the steering wheel (put a piece of white tape on the steering wheel so you can tell which direction it is being turned, and let the NN learn to predict the steering wheel position.

I wanted to see if I could make it work as a NN (I failed), but in the process I decided I didn't want to cope with the fumes and mechanics of the actual race track, so I downloaded the track map (Google "Pat's Acres map") and wrote a program to convert a location on the map into what the driver of a cart there would see. That's what you see below. Then I added some code to look at the scene and figure out where the middle of the lane should be (the center line is not on the map, it is calculated on the fly from the edges of the track), and then to steer the steering wheel based on whether the car should go left or right to keep the middle of the track in the middle. The car is controlled only by the steering wheel, which is controlled only by the program looking at the lane edges on the screen. Not bad for a couple days' work and no neural nets, if I do say so myself.
 


 

I rewrote this in pure Java, you can download a zip file containing the source code and the map file it uses, here.
 

Rev. 2017 July 14