Introduction to the CARLA simulator: training a neural network to control a car (Part 1)

There are several open-source simulators for autonomous cars and/or racing, but very few with capabilities comparable to or greater than CARLA’s. Here’s a list of those that I’ve considered (with their respective environments in parentheses):

And two simpler ones:

In the end, I only considered CARLA and AirSim since I wanted to work with UE4, and chose CARLA because it seemed easier to contact with the community via their discord chat.

The simplest possible controller

Based on the experiences gathered from the Udacity course, I knew one thing: I didn’t want to control the car myself. It would require multiple data collection sessions, would quickly become tedious and time consuming, and I would inevitably make mistakes that would require editing.

To reach my goal (training a neural network capable of going around the track), I started with the simplest controller that would collect the data for me. And it doesn’t get much simpler than the PD controller

—But more importantly, in the second blog post we’ll use a controller that controls both actuators, steering angle and throttle, simultaneously. This approach is called Model Predictive Control (MPC), and is admittedly more complicated, but it provides a trajectory that is much more efficient.

Building a neural network

Partly inspired by this blog post and partly dissatisfied with the performance of a neural network model trained on pure RGB input (done as part of the Udacity Self-Driving Car Nanodegree), I’ve decided to train a model on the depth map data that can be easily collected in CARLA.