WEBVTT

00:00.360 --> 00:01.680
-: Hello and welcome

00:01.680 --> 00:04.770
to the first module of this course, "Self-Driving Car."

00:04.770 --> 00:08.280
Now that you have PyTorch and Kivy installed on your system,

00:08.280 --> 00:11.310
we are ready to start implementing this self-driving car.

00:11.310 --> 00:13.590
And I can tell you we have an exciting adventure

00:13.590 --> 00:14.700
ahead of us.

00:14.700 --> 00:17.580
So the first thing we're gonna do now before we start

00:17.580 --> 00:20.310
is set the right folder as working directory.

00:20.310 --> 00:21.390
That's very important

00:21.390 --> 00:24.990
because we are gonna have three files to implement this car.

00:24.990 --> 00:27.480
And all the cars are connected to each other.

00:27.480 --> 00:29.460
So when you execute a file

00:29.460 --> 00:31.050
it will take the classes, functions,

00:31.050 --> 00:33.150
and objects from another file

00:33.150 --> 00:36.750
and this other file has to be in the same working directory

00:36.750 --> 00:39.090
has to file that you're executing.

00:39.090 --> 00:41.790
That's why it's very important to have one same folder

00:41.790 --> 00:43.050
with all the files,

00:43.050 --> 00:45.570
and that is your working directory folder.

00:45.570 --> 00:46.980
So let's just get this done,

00:46.980 --> 00:49.260
and then we will be able to start.

00:49.260 --> 00:51.930
So first thing you do is go to File Explorer here,

00:51.930 --> 00:53.280
that's this window.

00:53.280 --> 00:56.010
And then you will probably be on your desktop.

00:56.010 --> 00:58.590
So right now, as you can see, I'm on my desktop

00:58.590 --> 01:00.360
or maybe you'll be in your Documents.

01:00.360 --> 01:02.550
But anyway, you have to find the folder

01:02.550 --> 01:05.070
that contains your artificial intelligence

01:05.070 --> 01:07.620
A-Z template folder that you downloaded

01:07.620 --> 01:11.010
from the SDS website that Kiel walk you through.

01:11.010 --> 01:15.900
So just find this folder, then open it from File Explorer,

01:15.900 --> 01:18.750
then go to module one, self-driving car.

01:18.750 --> 01:20.160
And then there you go.

01:20.160 --> 01:22.410
This module one self-driving car folder

01:22.410 --> 01:24.150
contains three files.

01:24.150 --> 01:26.580
That's the three files that are connected to each other

01:26.580 --> 01:29.490
to implement, not only the self-driving car on the map,

01:29.490 --> 01:31.410
but also the brain of the car,

01:31.410 --> 01:34.740
that is the AI that will be integrated to the car.

01:34.740 --> 01:37.200
And so this folder containing this three files

01:37.200 --> 01:39.660
is your working directory folder.

01:39.660 --> 01:40.830
And now to make sure

01:40.830 --> 01:43.470
that this folder is set as working directory,

01:43.470 --> 01:45.510
you can click on the tool button here

01:45.510 --> 01:47.460
and then restart kernel.

01:47.460 --> 01:48.960
Then you can click on yes,

01:48.960 --> 01:49.920
and there you go,

01:49.920 --> 01:51.780
Now you're sure a 100%

01:51.780 --> 01:54.870
that this folder containing your three files

01:54.870 --> 01:56.910
is set as working directory.

01:56.910 --> 01:59.100
Okay, and so now before we start,

01:59.100 --> 02:01.530
I would just like to explain quickly what are

02:01.530 --> 02:02.640
these three files.

02:02.640 --> 02:07.127
So as you probably recognized the first one here, ai.py,

02:07.127 --> 02:10.140
is the file that contains the brain of the car.

02:10.140 --> 02:11.370
So you know that's in this file

02:11.370 --> 02:14.490
that we will implement the artificial intelligence

02:14.490 --> 02:15.990
that will be integrated to the car.

02:15.990 --> 02:18.240
So that's why I'm calling it the brain of the car

02:18.240 --> 02:20.850
because this artificial intelligence is based

02:20.850 --> 02:22.140
on a neural network.

02:22.140 --> 02:23.220
So it will be like the car

02:23.220 --> 02:25.140
will have a neural network inside of it.

02:25.140 --> 02:26.880
That's why I like to call it, brain.

02:26.880 --> 02:30.090
Then the second file here is a Kivy file,

02:30.090 --> 02:33.330
card it KV and you cannot open it here in Spyder,

02:33.330 --> 02:35.790
but you can open it from a text editor.

02:35.790 --> 02:37.530
And actually that's what I'm gonna do right now.

02:37.530 --> 02:40.440
I'm opening it with Sublime Text.

02:40.440 --> 02:42.630
There we go. That is Sublime Text.

02:42.630 --> 02:46.350
And this is this card that KV file opens in Sublime Text.

02:46.350 --> 02:47.760
For those of you who are on Windows,

02:47.760 --> 02:50.880
you can open it with Notepad++.

02:50.880 --> 02:53.460
So here is what the KV code looks like.

02:53.460 --> 02:55.710
We're not going to focus on it in this course

02:55.710 --> 02:58.380
because this is only related to KV,

02:58.380 --> 03:00.750
but basically to understand what's going on here,

03:00.750 --> 03:04.050
well, as you can see we create several objects

03:04.050 --> 03:05.520
that will be on the map.

03:05.520 --> 03:08.700
So for example, this first object here is the car.

03:08.700 --> 03:10.800
And for this car you can define some variables

03:10.800 --> 03:13.500
like the angle, that is the angle of rotation.

03:13.500 --> 03:15.240
Then you can define the shape that you

03:15.240 --> 03:16.290
want your car to have.

03:16.290 --> 03:19.830
So it will be rectangle, like the basic shape of a car.

03:19.830 --> 03:21.570
Then you have some other objects,

03:21.570 --> 03:23.400
ball one, ball two and ball three.

03:23.400 --> 03:26.880
So these three balls here will be, as you will see later,

03:26.880 --> 03:28.890
the sensors of the car

03:28.890 --> 03:31.950
because the car will have sensors that will detect

03:31.950 --> 03:34.170
if there is some obstacles around the car.

03:34.170 --> 03:37.770
So these three balls here are just to highlight the sensors

03:37.770 --> 03:38.603
on the car.

03:38.603 --> 03:39.436
So we will see them

03:39.436 --> 03:42.810
and besides I set a different color for each of them.

03:42.810 --> 03:45.180
And then we have a last object,

03:45.180 --> 03:48.060
which is to connect all the previous objects together

03:48.060 --> 03:48.893
to make the car.

03:48.893 --> 03:51.690
Because the sensors will be attached to the car,

03:51.690 --> 03:55.050
so that when the car moves while the sensor moves as well.

03:55.050 --> 03:57.660
Alright, but this is not the most important here.

03:57.660 --> 04:00.120
So we are gonna move on to Python.

04:00.120 --> 04:02.340
This is just to show you what Kivy looks like.

04:02.340 --> 04:03.810
And this file of course

04:03.810 --> 04:06.420
will be connected to our other files.

04:06.420 --> 04:07.800
And mostly it will be connected

04:07.800 --> 04:12.150
to the third file map.py, which is this one right here.

04:12.150 --> 04:14.160
And map.py, what is it?

04:14.160 --> 04:16.680
Well, this is where we make the whole map

04:16.680 --> 04:17.970
and also the whole game

04:17.970 --> 04:19.920
because you will see that we will be playing

04:19.920 --> 04:21.210
some games with the car.

04:21.210 --> 04:23.310
You know, we will give it some challenges

04:23.310 --> 04:26.580
like avoiding some obstacles or doing some round trips

04:26.580 --> 04:29.880
between two destinations on a more and more difficult road.

04:29.880 --> 04:31.170
So we will make a game

04:31.170 --> 04:33.870
and that game happens in this big file here.

04:33.870 --> 04:35.880
So this file is important,

04:35.880 --> 04:38.100
therefore we're gonna see it in details.

04:38.100 --> 04:41.520
However, since this is not directly related to AI

04:41.520 --> 04:43.110
we will not code it line by line,

04:43.110 --> 04:45.900
and we'll just explain each line of code.

04:45.900 --> 04:47.190
Besides in the template folder,

04:47.190 --> 04:50.880
you'll find the same code as this one but commented.

04:50.880 --> 04:52.860
So each line of code will be commented.

04:52.860 --> 04:55.050
So that if you're interested in knowing how to

04:55.050 --> 04:58.170
develop a game within a Kivy application,

04:58.170 --> 05:00.210
well you will be able to understand everything

05:00.210 --> 05:01.500
that we do here.

05:01.500 --> 05:02.640
But what's important also is

05:02.640 --> 05:05.430
that not only we make the map and the game,

05:05.430 --> 05:09.990
but also we make some important connections between the map

05:09.990 --> 05:13.440
and the future AI that we will implement afterwards.

05:13.440 --> 05:16.110
And by the way, this is much more important,

05:16.110 --> 05:19.140
and therefore we will implement it step-by-step.

05:19.140 --> 05:21.990
We will write together each of these lines of codes.

05:21.990 --> 05:22.823
But for the map,

05:22.823 --> 05:25.470
I will just describe all the code sections here

05:25.470 --> 05:26.820
and that's what I will do

05:26.820 --> 05:29.340
in the next section right after this tutorial.

05:29.340 --> 05:31.770
I think the next two tutorials are important

05:31.770 --> 05:33.630
for you to understand the connection

05:33.630 --> 05:36.510
between the map and the AI.

05:36.510 --> 05:38.490
All right, so I will be explaining all this

05:38.490 --> 05:39.600
in the next tutorial.

05:39.600 --> 05:41.523
And until then, enjoy AI.
