If you ever wanted to learn how self-driving cars work, take a look at the Intro to Self-Driving Cars Nanodegree offered by Udacity. I have recently completed the course and it was such a joy to learn about how these vehicles function under the hood. If you have not guessed by now, in this post I want to share my experience with this course.

## Backstory

I knew that Udacity was an online education platform, but I did not know that they offered complete highly-technical courses. As I finished learning the basics of Java, I wanted to expand my skill set to include a better understanding of Python and lower-level languages. This is where the journey began.

Searching through the various courses on Udacity’s website, I found out that they offer something they call a “Nanodegree.” In a nutshell, a nanodegree is an accreditation focused on a specific technology.

Having much interest in the cutting-edge side of technology, I ventured out to see if there were any courses available that could teach me a new technology while satisfying my goals. Low-and-behold, I stumbled onto the Self-Driving Cars Nanodegree and enrolled. $1000.00 and two months later, I completed the course.

## Orientation

At the time of writing, the beginning of the nanodegree had a strong focus on calculating probabilities. Probability is essential to autonomous vehicles as there will always be a margin of error in real-world scenarios. By calculating the probability, we can let the car “know” where it and other objects in the world are.

Probability comes from Baye’s Law which states that “given an initial prediction if we gather additional related data, data that our prediction depends on, we can improve that prediction.” The more relevant data we process and use in our probability calculations, the more accurate our data will be!

The first part of the nanodegree was quite enjoyable as it did not involve too many complex concepts. I did learn a lot about calculating discrete and continuous probability though!

## Navigating a 2D World

Of course, our world is in three dimensions, but most of the concepts used to navigate a world can be represented in a smaller, more simpler 2D world. For example, a car in a 2D world can still move, accelerate, and even sense where it is in the world. This is done by taking sensor measurement data and processing it via various mathematical formulas.

A 2D world can be represented as a grid (matrix) and on the grid, there can be various objects. We can calculate the probability of various situations by applying matrix addition, subtraction, multiplication, dot multiplication, and division. We can then use this data to make educated decisions.

This was the first time during the course that I really had to think about how one can represent real-world objects in a digital space. The mathematics behind the localization efforts took some time to understand, but I did manage to understand it enough to code it.

## Faster Calculations

Up until this point, I coded everything in Python. Python is a great language to work in, but it is not the fastest computing language. To safely navigate the real-world, the computers inside an autonomous vehicle must process sensor data extremely fast. So, another, more efficient, programming language was needed.

The language that would satisfy this need would be C++. This language is much harder to code in as the programmer has more details to worry about. Not only does one have to worry about coding it correctly, but one also has to manage memory, pointers, semi-colons, and more. The next challenge was to convert code that I previously wrote in Python to C++.

I have experience with Python and Java and so working on previous calculations were quite easy. However, I had no experience with C++ and so it was a great challenge for me to work on. Once the project was done, I then had to make the program more efficient; speed is everything you know!

## Google-Maps Style Routing

Where would a self-driving car be if it did not know where it was going? This module was the hardest I had come across so far.

The module first started out with a course on how to solve problems. It then discussed the pros/cons of various data structures. After this nice tangent, the real work began.

I was instructed to build a route planning algorithm called the A* search algorithm. Essentially, the algorithm would find the shortest path to a destination given a roadmap and the distances to each point on the map. Solving this challenge involved ways of coding that I had not thought of before.

It took me over two weeks to complete this project and I had to look to external sources to really comprehend how the algorithm was supposed to work. After many iterations, I finally had a working search algorithm!

## Calculus

Math was never my strong suit and it was the worst subject I had in high school. I even avoided it during my time at university! I was quite nervous about this module, to say the least! As I understood it, the module said that it would introduce me to the basics of calculus and so I thought I would give it a try.

It did not take me as long as I thought to understand the basics. We were introduced to calculating acceleration and how that translates into understanding derivatives. From there, we were then introduced to integrals, which are almost the exact opposite of derivatives! It is worth noting that the instructors did a fantastic job with this module!

Using my newly acquired superpower, I was challenged to code the trajectory of a vehicle and to plot and display it on a graph. We were given four columns of values and had to find derivatives and integrals of each row of data. It was then left to us to calculate how one can display this movement on a graph.

This module was the most educational for me as I now feel that I can tackle these types of problems with ease.

## Traffic Light Classifier

Last but not least, we were tasked to make an image classifier that classifies images of traffic lights and to output whether the image depicts a red, yellow, or green light. In order for the classifier to work, we needed to create a pipeline or a step-by-step process to put the images through.

We start by loading in the images and then pre-processing them to make them all the same size. We then look at a sample of the images to see if there is a way to distinguish each light. I found that the location of each light was different and so I used the brightness data on the vertical axis to create a two feature functions that returned two feature vectors.

The feature vectors were then sent to the actual classifier and labelled each image with its corresponding light. With only one revision, I managed to get an accuracy of 97%!

This was an enjoyable project to work on as it has real-world value beyond the classroom.

## Conclusion

I highly recommend taking the Intro to Self-Driving Cars Nanodegree program offered by Udacity. Make sure that you meet the requirements to take the course as I would hate for you to spend the money to take it and then drop out later on. The forum, Slack channel, and one-on-one mentorship really helped me along the way so I highly recommend you use it as well!

If you have a year or two of programming experience, this course will allow you to expand on your previous skills and expand your skill set.

Successful completion of the course allows guaranteed admission to the Self-Driving Car Engineer Nanodegree program. This is where one prepares to become an actual engineer for autonomous vehicles!

Overall, I really enjoyed my time learning all about self-driving cars and how they can work in the real world. If you are thinking of taking the course, contact me if you want more details about it as I am now a graduate of the program!