Introduction: Self Driving Car With Udacity Simulator

About: Omar Silva-Zapata is co-founder of Robo-Geek Inc.

We got the inspiration for this tutorial from Siraj Raval's YouTube video on how to connect to the Udacity Self Driving Car simulator.

This code for the video was created by Naoki Shibuya who you can find more information in his repo:

So why did we bother to create this tutorial if there is so much information out there?

Well the challenge is that if you are new to Machine Learning, many of the steps may be confusing to a newbie. This tutorial hopes to make it easy for someone with basic Python knowledge to implement.

Robo-Geek is very thankful to the open source community and we share our findings and code as a contribution back for those eager to learn. Also it's worth to note we will be implementing this in Windows environment as there is lots of information on how to implement with Ubuntu.

Finally this tutorial will cover only how to test the code and a separate tutorial will be created to show how to train the neural network.

Step 1: Requirements

What is required?

A PC/laptop with Windows 8, preferably 10 with a GPU - the faster the better.

If you don't own a computer with a GPU, we suggest you sign to Google Cloud and use $300 worth of credit for signing up, you can test your project for a few months before needing to pay anything. Also you may consider AWS - Amazon Web services. Both services charge by the minute. It's outside the scope of this tutorial how to setup those services, but use this link to get you started:

Step 2: Getting Started

First you will need to download the open source Udacity simulator from the following repo:

Select Windows installation to download version 2 and follow the instruction in the repo. Unzip in your Documents folder.

Second, you will need to install Anaconda, select Python 3.6 version

When installing make sure to select install PATH environment -even if you get a warning not to. The video below is a bit outdated but will guide you through what you need to do. Anaconda installation is outside the scope of this tutorial so best of luck with the installation. It's relatively easy.

Finally download the repo with the project:

Unzip the repo in your Documents folder.

Step 3: Installing the Dependencies

Open Anaconda Prompt, select your working folder and install the dependencies (libraries required to make the project work):

If you have a GPU, type the following command:

conda env create -f environment-gpu.yml

If you don't have a GPU:

conda env create -f environments.yml

All the dependencies required for this project will be installed. This step may take an hour to complete, depending on how quick is your computer.

Step 4: Activate Environment and Test

After installing the dependencies, then activate the environment by using the following command:

activate car-behavioral-cloning

If successful you will see that the name of your folder will be superseded by (car-behavioral-cloning).

Then to test, open the simulator in Autonomous Mode and simply execute:

python model.h5

If everything is right, the car will start self driving in the simulator.

Step 5: Troubleshooting

After installing the dependencies you may get some errors due to version conflicts. Check, the repo Issues tab and read what others have done to solve:

Alternatively read the error - for example if you get a message that tensorflow is not installed, then in the same folder proceed and type:

conda install -c conda-forge tensorflow 

start Conda Prompt again, select the directory and activate again by using the following command:

activate car-behavioral-cloning