1
00:00:00,900 --> 00:00:02,420
Great job.

2
00:00:02,460 --> 00:00:04,840
We've finished the entire coding.

3
00:00:04,890 --> 00:00:09,320
I hope you had fun going through this course for our last lesson.

4
00:00:09,330 --> 00:00:14,460
I wanted to look back at the codes and update some of them to improve the script.

5
00:00:14,460 --> 00:00:16,800
First let's look at the front end side.

6
00:00:16,800 --> 00:00:19,210
On layout HDMI.

7
00:00:19,500 --> 00:00:20,680
Here we used J.

8
00:00:20,700 --> 00:00:27,720
Query but you can also use react which is another framework that has been trending not just react but

9
00:00:27,720 --> 00:00:31,200
there are always new javascript frameworks coming out.

10
00:00:31,680 --> 00:00:37,050
So if you are interested in the newest make sure you check out what is available.

11
00:00:37,050 --> 00:00:39,070
Let's move to shake HDMI.

12
00:00:39,480 --> 00:00:44,170
We used post to request data here.

13
00:00:44,200 --> 00:00:48,120
This was only done when the event successfully occurred.

14
00:00:48,160 --> 00:00:55,040
It will be even better if you set an error when the event didn't occur now will live on to the drone

15
00:00:55,040 --> 00:00:58,130
manager P Y under the model's.

16
00:00:58,350 --> 00:01:03,240
HERE WE SET THE FACE detect function after detecting the face.

17
00:01:03,360 --> 00:01:05,680
The drone will be tracking the face.

18
00:01:05,970 --> 00:01:10,710
The code for this function can also be improved by changing the values.

19
00:01:10,710 --> 00:01:13,520
For example we set the drone to fly slow.

20
00:01:13,530 --> 00:01:21,110
If you change the speed higher the drone will be able to track with more efficiency now screw up to

21
00:01:21,110 --> 00:01:23,630
the init section.

22
00:01:23,650 --> 00:01:27,900
Here we set the socket bind we set the code to show an error.

23
00:01:27,910 --> 00:01:37,620
If the drone was not activated there remember that handling errors will also improve your codes scroll

24
00:01:37,620 --> 00:01:41,700
down a bit to see where we set the commands for the drone.

25
00:01:41,700 --> 00:01:43,240
Here we see the command.

26
00:01:44,040 --> 00:01:49,130
Let's take a moment to check on the Tello SDK in the SDK.

27
00:01:49,160 --> 00:01:57,570
You will see that the value that can be set for the command up is 20 to 500 another way to improve your

28
00:01:57,570 --> 00:02:03,700
code is to return false or raise an exception when the value is out of range.

29
00:02:03,720 --> 00:02:11,310
For example we can define a validate or set with self and distance if the distance is smaller than 20

30
00:02:11,760 --> 00:02:14,150
and larger than 500.

31
00:02:14,190 --> 00:02:22,810
We want the system to raise a value error or return false in the up command.

32
00:02:22,830 --> 00:02:29,310
We can set this self validator with the distance to check if the distance is correct.

33
00:02:29,310 --> 00:02:36,120
We did uncover the validator in the lesson but there will always be a chance that the Tello SDK gets

34
00:02:36,120 --> 00:02:42,270
an update and the value range changes so that might be a good timing for you to add on the validator

35
00:02:42,300 --> 00:02:44,200
to improve your code.

36
00:02:44,220 --> 00:02:48,690
Now scroll up to where we set the face detect example file.

37
00:02:48,930 --> 00:02:52,150
In this lesson we only detected the front face.

38
00:02:52,260 --> 00:02:58,560
You can use more options from the higher cascade so you can also include detecting multiple faces or

39
00:02:58,560 --> 00:03:00,480
even accounts face.

40
00:03:00,480 --> 00:03:08,640
Lastly I want you to right click on PI term and choose preferences in the search box set pep 8.

41
00:03:08,640 --> 00:03:12,270
Here I have the PEP 8 violation and checked.

42
00:03:12,270 --> 00:03:18,360
Let's put a check on both of the Pep 8 violations and apply and hit OK.

43
00:03:18,420 --> 00:03:21,800
You can see a wavy line under some of my codes.

44
00:03:21,810 --> 00:03:26,640
This means that the codes are violating the PEP aid code style here.

45
00:03:26,640 --> 00:03:33,810
I need another blank line by putting a check on the PEP 8 pi term we'll let you know if you are making

46
00:03:33,870 --> 00:03:36,370
any python code style violation.

47
00:03:36,420 --> 00:03:43,120
Correcting all these violations will also help improve your codes now let's go to the server JPY.

48
00:03:43,510 --> 00:03:46,630
Again you will see a wavy line here.

49
00:03:46,750 --> 00:03:51,520
It's telling us that we need two blank lines between each function.

50
00:03:51,550 --> 00:03:56,560
Also I want to show you another violation checker called Flake 8.

51
00:03:56,740 --> 00:04:03,700
For those of you who haven't installed Flake eight open your terminal and install using Pip 3 install

52
00:04:03,700 --> 00:04:07,750
Flake 8 in my case I already have it installed.

53
00:04:07,750 --> 00:04:10,570
So let me clear all these codes.

54
00:04:10,570 --> 00:04:20,050
Now set the CBD command with the path drone app models then use the L S command with drone manager P

55
00:04:20,050 --> 00:04:29,710
Y to open the file use Flake 8 with the drone manager P Y and hit enter you will receive a list of codes

56
00:04:29,740 --> 00:04:37,310
that you should correct let's look at this one in line two sixty three we can go to the drone manager

57
00:04:37,310 --> 00:04:46,500
P Y file and check on line two sixty three in the code I left a space after you X which is unnecessary

58
00:04:46,890 --> 00:04:54,640
so we can delete the space now let's run the flake eight again you'll see that the error in line two

59
00:04:54,640 --> 00:05:04,010
sixty three has been moved from the list I highly recommend you to use both pep 8 and Flake 8 to better

60
00:05:04,010 --> 00:05:11,740
your codes each time you use these tools not only will you be correcting the codes but you will be improving

61
00:05:11,740 --> 00:05:14,290
your code style as well.

62
00:05:14,290 --> 00:05:19,630
I've covered a few of the points in improving your code but I think you will also be able to come up

63
00:05:19,630 --> 00:05:21,790
with more improvements.

64
00:05:21,810 --> 00:05:29,330
You can also add on more to the shaking or customize your drone patrol course based on your own house.

65
00:05:30,820 --> 00:05:38,710
Well I hope you had fun in this course and hope you enjoy your knowledge on programming your drone remember.

66
00:05:38,760 --> 00:05:41,370
Have a safe flight and hope disused in.
