Now you will use the optical flow velocity estimator to publish
velocity commands to the drone.
PID
Note that in state controller, there are now two more instances of your student_PID class.
Implement the student_PID class in student_pid_class.py. This should be almost identical to the one you implemented in the last project. Note that state controller will pass your pid class a json dict that contains values for your k terms. You can set these (and add additional arguments for your PID) in the pid_terms.yml file. Please document in your readme how you chose the terms you did and any additional arguments you added, if applicable.
After implementing, with the props off, move your drone around with your optical flow analyzer and state controller running. Watch the motors on your drone and make sure the motors speeds change as you would expect them to. Ej. The motors on the back of the drone spin faster than the ones in the front when you are moving your drone backwards. This corresponds to your drone realizing that it is moving backward and trying to stop moving backwards. Please use print statements in your pid class to verify the behavior of your drone.
Checkoff
Show the TAs:
Your pid class is implemented and functions as both plane pids and the height pid
That you can move around your drone and the values coming out of your pids will change in the ways that you expect
Explain briefly the terms that you wish to start with when tuning your plane pids.
Show that your motors spin the way you expect when you move your drone around by hand
The TAs will then give you the OK to test your terms by flying. Do not fly with your plane terms until the TAs give you the OK. This policy is in place to reduce the amount of damage to the lab (and objects in the lab) and damage to your drone.
Fly!
After getting the OK from the TAs:
Put the props on your drone, warn everyone in the vicinity that you will be flying and make sure everyone is wearing safety glasses
Using the javascript interface, fly your drone. Tune the PID terms until the drone behaves as you would expect. Note that the controller you are writing in this project is less complex than the controller that you previously flew your drone with.
Play around with your drone and try to find areas of unexpected behavior
Fix all and any bugs
Note that you may get different results as you fly over different surfaces. This is due to the fact that the Raspberry Pi may not be able to extract motion vectors as well over certain surfaces.
Answer the following questions in your pdf:
What do you expect to happen when you fly your drone over the white poster board (you can try this). Why?
Why must you make sure that everyone is wearing safety googles? What could happen that the googles would protect them from?
Why does your drone not stay exactly still when commanded to hold zero velocity
Give a brief description what P, I, and D do when you are controlling the velocity of your drone
During long flights at a certain velocity, your drone should come to level while flying. Why does this happen?
Checkoff 2
Show the TAs:
Your drone flies and you can control its velocity
Your drone stays mostly still (does not drift much) when you command it to hold zero velocity
Your drone moves only in the direction you intend it to move
Your drone seems to fly at a constant velocity, and does not have an oscillating velocity
Extra credit!
If you would like, you can get extra credit by also implementing yaw control of your drone. This can be done by analyzing the flow vectors to extract rotational inforation and creating a PID that runs ontop of that