4/29/2021

What did I learn from Artificial intelligence for robotics course by Udacity

Introduction

During the last months I did not publish any blog posts. The reason is simple. I was busy with some other topics.

One hand I’m a lucky guy, who did not lose his job due to the current situation, I even had a bit more tasks to be done.

On the other hand, thanks to the flexibility of home office I managed to attend some online courses. Furthermore I’m preparing a material which is giving a great overview on the topic of version control with GIT, you will get more information about this project soon. And of course I occupied myself with non profession related activities.

Now the time is here to become active again on blogging.

During last spring there was an offer from Udacity for taking their “Artificial Intelligence for Robotics” course for free.

Since I have a stronger background of software development, but less experience with robotics algorithms I decided to take it. Let me write some paragraphs about my experience.

How about Udacity

I had no previous experience with Udacity, but I already took several courses from Udemy, which is one of their concurrents, so that’s a good base to compare.

Since I took that time the free version of the Udacity course the service was also limited: I did not have project review and mentorship to the project and I also did not get a certificate in the end. Later on I attended the Self Driving Cars nanodegree program as well, so I also have experience with the commercial Udacity courses, but let’s discuss it in a later post.


While doing the Udemy courses I often found myself bored and lost my attention. In the case of Udacity it was not the case at all.

The material is splitted into lessons, each lesson takes between 1 and 2 hours. During the lessons videos, written materials and quizzes are changing each other. The videos are following a friendly and natural style, while they are explaining well the problem and the solution. The written materials are giving a great summary on the theoretical part of the topics, sometimes even links are attached for some additional materials. The quizzes are either questions with some selectable options or coding tasks where you have to write a small piece of code or extend a given one. All your solutions are evaluated automatically. This is the way how you are making your attention alive and how they are forcing you to really understand the material.

After each session there was a section called “Problem Set”, which contained some tasks which covered the topic of the previous lesson and a “Q&A” session where the most frequent questions are discussed.

In the end of the course there was a practical exam with a list of practical tasks covering the whole material and a final project, called “Runaway Robot” to be solved. It was a real challenge, but it made me learn a lot.

It was a nice experience.

The content of the course

The course itself introduced the most important problems of robotics and their possible solutions. I prepared a very brief summary of these topics.

Since you find a lot of material about these concepts online, I won’t go into details this time, I’m rather just giving an overview.

Localization

The first chapter was about robot localization. The problem to be solved is to decide where the robot is located based on its motion and it’s senses.

Back to the university we learned a lot about distributions and probabilities. That time I did not really understand why we have to learn it, it was pure theory, so I did suffer a lot while learning it.

This chapter brought me at least one purpose, why I had to learn it that time and it also gave a great fresh up of the topic.

Furthermore it introduced me to some robot motion models.

All things considered it gave me a nice overview on the problem of localization.

Kalman filters

Kalman filters are great tools for making some predictions based on historical data. They are based on gaussians, which are functions to represent values with their probability.

So that if there’s a series of measurements with a given probability (for example about the position of the robot or of another object), Kalman filters can update the gaussian after each measurement based on the new measurement values and tell the most possible position of the tracked robot or object. One of its most useful applications in the world of robots and self-driving cars is sensor fusion, where it combines the measurements of several different sensors.

Another fact I have to mention, that it’s named after Rudolf Emil Kalman, who was Hungarian, similarly to me.

As part Udacity Self Driving Cars course I managed to implement an extended Kalman-filter, feel free to take a look: https://github.com/lmarcell/CarND-Extended-Kalman-Filter-Project

Particle filters

The idea of particle filters provides an efficient filtering method, which is really easy to program and which can be used for example for localization. 

The main idea is to randomly create a large amount of particles, which are basically guesses where the robot is located at the moment. Then a weight shall be assigned to each of the particles. After each movement of the robot these weights shall be updated. High weight means that it’s very likely that the robot is around, small weight means that there’s only a small chance for that. By following this method after several movements it will be visible what is it’s most probable position.

Path planning

To find an optimal path between two points in a huge space is a challenging task. However this is a very important topic when we are talking about robots.

In an ideal case we already have a map of the space, but since this space is huge the classical path search algorithms, like breadth-first-search or depth-first-search are not efficient enough to find the most optimal path.

During the course two more efficient solutions have been presented. The first one is the A* algorithm, which is a kind of extension of the classical Dijkstra algorithm. The main idea is to introduce a heuristic function which provides an optimistic guess for the distance from a position to the goal position. So that takes the way where we expect the smallest distance based on the heuristic function.

The main challenge is to find a good heuristic function, since using the wrong heuristic function makes this algorithm really inefficient.

Next to A* algorithm the main concept of dynamic programming was also presented in the course.

PID Control

You have already planned the expected path of the robot, the next step is to let the robot follow this path. This may sound like a trivial problem, but it isn't. Just imagine: your robot is moving with a permanent velocity and you can only tell it if it should turn right or left. And you have the reference path, which should be followed. The most trivial idea is that if the robot is left from the reference path then let it turn a bit right. If it is right from the reference path let it turn left. In this case it will more or less follow the reference path, but it will always overshoot, so cross the reference path and this will result in a very strange and uncomfortable moving for the robot. A PID controller introduces a so-called differential and an integral component as well. If you find the right weight for the different components then you can reach a quite smooth and comfortable moving of the robot.

To find the optimal weight is also not trivial, but fortunately there’s a great algorithm called twiddle, which can help you.

As part Udacity Self Driving Cars course I managed to implement my own PID controller, feel free to take a look: https://github.com/lmarcell/CarND-PID-Control-Project

SLAM

SLAM stands for simultaneous localization and mapping. This can be used in the case when you don’t have a map of the environment of the robot. For example you have a vacuum cleaner robot and you want it first to move around the room and create a map of that, so that later it can find the most optimal path for cleaning it.

This is the problem of SLAM. This problem and one basic possible solution have also been presented as part of the course.

Summary

All things considered I learnt a lot from this course, it let me understand some main concepts of robotics which I could reuse as part of my daily job, while working on autonomous driving.

The course doesn’t go deep into the details, but it teaches and presents the main ideas in a very efficient way. This brought me to the decision to do the Udacity Self Driving Cars course, but let me tell you more about that course later.

How I prepared my first online course

Since long I didn't publish anything here. It's because I was busy with some other topics, but now it's time to share the result...