-: Hello and welcome
to the first module of this course, "Self-Driving Car."
Now that you have PyTorch and Kivy installed on your system,
we are ready to start implementing this self-driving car.
And I can tell you we have an exciting adventure
ahead of us.
So the first thing we're gonna do now before we start
is set the right folder as working directory.
That's very important
because we are gonna have three files to implement this car.
And all the cars are connected to each other.
So when you execute a file
it will take the classes, functions,
and objects from another file
and this other file has to be in the same working directory
has to file that you're executing.
That's why it's very important to have one same folder
with all the files,
and that is your working directory folder.
So let's just get this done,
and then we will be able to start.
So first thing you do is go to File Explorer here,
that's this window.
And then you will probably be on your desktop.
So right now, as you can see, I'm on my desktop
or maybe you'll be in your Documents.
But anyway, you have to find the folder
that contains your artificial intelligence
A-Z template folder that you downloaded
from the SDS website that Kiel walk you through.
So just find this folder, then open it from File Explorer,
then go to module one, self-driving car.
And then there you go.
This module one self-driving car folder
contains three files.
That's the three files that are connected to each other
to implement, not only the self-driving car on the map,
but also the brain of the car,
that is the AI that will be integrated to the car.
And so this folder containing this three files
is your working directory folder.
And now to make sure
that this folder is set as working directory,
you can click on the tool button here
and then restart kernel.
Then you can click on yes,
and there you go,
Now you're sure a 100%
that this folder containing your three files
is set as working directory.
Okay, and so now before we start,
I would just like to explain quickly what are
these three files.
So as you probably recognized the first one here, ai.py,
is the file that contains the brain of the car.
So you know that's in this file
that we will implement the artificial intelligence
that will be integrated to the car.
So that's why I'm calling it the brain of the car
because this artificial intelligence is based
on a neural network.
So it will be like the car
will have a neural network inside of it.
That's why I like to call it, brain.
Then the second file here is a Kivy file,
card it KV and you cannot open it here in Spyder,
but you can open it from a text editor.
And actually that's what I'm gonna do right now.
I'm opening it with Sublime Text.
There we go. That is Sublime Text.
And this is this card that KV file opens in Sublime Text.
For those of you who are on Windows,
you can open it with Notepad++.
So here is what the KV code looks like.
We're not going to focus on it in this course
because this is only related to KV,
but basically to understand what's going on here,
well, as you can see we create several objects
that will be on the map.
So for example, this first object here is the car.
And for this car you can define some variables
like the angle, that is the angle of rotation.
Then you can define the shape that you
want your car to have.
So it will be rectangle, like the basic shape of a car.
Then you have some other objects,
ball one, ball two and ball three.
So these three balls here will be, as you will see later,
the sensors of the car
because the car will have sensors that will detect
if there is some obstacles around the car.
So these three balls here are just to highlight the sensors
on the car.
So we will see them
and besides I set a different color for each of them.
And then we have a last object,
which is to connect all the previous objects together
to make the car.
Because the sensors will be attached to the car,
so that when the car moves while the sensor moves as well.
Alright, but this is not the most important here.
So we are gonna move on to Python.
This is just to show you what Kivy looks like.
And this file of course
will be connected to our other files.
And mostly it will be connected
to the third file map.py, which is this one right here.
And map.py, what is it?
Well, this is where we make the whole map
and also the whole game
because you will see that we will be playing
some games with the car.
You know, we will give it some challenges
like avoiding some obstacles or doing some round trips
between two destinations on a more and more difficult road.
So we will make a game
and that game happens in this big file here.
So this file is important,
therefore we're gonna see it in details.
However, since this is not directly related to AI
we will not code it line by line,
and we'll just explain each line of code.
Besides in the template folder,
you'll find the same code as this one but commented.
So each line of code will be commented.
So that if you're interested in knowing how to
develop a game within a Kivy application,
well you will be able to understand everything
that we do here.
But what's important also is
that not only we make the map and the game,
but also we make some important connections between the map
and the future AI that we will implement afterwards.
And by the way, this is much more important,
and therefore we will implement it step-by-step.
We will write together each of these lines of codes.
But for the map,
I will just describe all the code sections here
and that's what I will do
in the next section right after this tutorial.
I think the next two tutorials are important
for you to understand the connection
between the map and the AI.
All right, so I will be explaining all this
in the next tutorial.
And until then, enjoy AI.