Great job.
We've finished the entire coding.
I hope you had fun going through this course for our last lesson.
I wanted to look back at the codes and update some of them to improve the script.
First let's look at the front end side.
On layout HDMI.
Here we used J.
Query but you can also use react which is another framework that has been trending not just react but
there are always new javascript frameworks coming out.
So if you are interested in the newest make sure you check out what is available.
Let's move to shake HDMI.
We used post to request data here.
This was only done when the event successfully occurred.
It will be even better if you set an error when the event didn't occur now will live on to the drone
manager P Y under the model's.
HERE WE SET THE FACE detect function after detecting the face.
The drone will be tracking the face.
The code for this function can also be improved by changing the values.
For example we set the drone to fly slow.
If you change the speed higher the drone will be able to track with more efficiency now screw up to
the init section.
Here we set the socket bind we set the code to show an error.
If the drone was not activated there remember that handling errors will also improve your codes scroll
down a bit to see where we set the commands for the drone.
Here we see the command.
Let's take a moment to check on the Tello SDK in the SDK.
You will see that the value that can be set for the command up is 20 to 500 another way to improve your
code is to return false or raise an exception when the value is out of range.
For example we can define a validate or set with self and distance if the distance is smaller than 20
and larger than 500.
We want the system to raise a value error or return false in the up command.
We can set this self validator with the distance to check if the distance is correct.
We did uncover the validator in the lesson but there will always be a chance that the Tello SDK gets
an update and the value range changes so that might be a good timing for you to add on the validator
to improve your code.
Now scroll up to where we set the face detect example file.
In this lesson we only detected the front face.
You can use more options from the higher cascade so you can also include detecting multiple faces or
even accounts face.
Lastly I want you to right click on PI term and choose preferences in the search box set pep 8.
Here I have the PEP 8 violation and checked.
Let's put a check on both of the Pep 8 violations and apply and hit OK.
You can see a wavy line under some of my codes.
This means that the codes are violating the PEP aid code style here.
I need another blank line by putting a check on the PEP 8 pi term we'll let you know if you are making
any python code style violation.
Correcting all these violations will also help improve your codes now let's go to the server JPY.
Again you will see a wavy line here.
It's telling us that we need two blank lines between each function.
Also I want to show you another violation checker called Flake 8.
For those of you who haven't installed Flake eight open your terminal and install using Pip 3 install
Flake 8 in my case I already have it installed.
So let me clear all these codes.
Now set the CBD command with the path drone app models then use the L S command with drone manager P
Y to open the file use Flake 8 with the drone manager P Y and hit enter you will receive a list of codes
that you should correct let's look at this one in line two sixty three we can go to the drone manager
P Y file and check on line two sixty three in the code I left a space after you X which is unnecessary
so we can delete the space now let's run the flake eight again you'll see that the error in line two
sixty three has been moved from the list I highly recommend you to use both pep 8 and Flake 8 to better
your codes each time you use these tools not only will you be correcting the codes but you will be improving
your code style as well.
I've covered a few of the points in improving your code but I think you will also be able to come up
with more improvements.
You can also add on more to the shaking or customize your drone patrol course based on your own house.
Well I hope you had fun in this course and hope you enjoy your knowledge on programming your drone remember.
Have a safe flight and hope disused in.