You will now use the PID controller you wrote in the previous project to fly your drone!
Go take a look at the p3_pkg/scripts/student_pid_class.py
and you’ll note that in the __init__
function we pass in a dict of params. We made this change to allow you to add your own parameters to the PID controllers if you would like to tweak or customize them.
Params are loaded in from p3_pkg/scripts/pid_terms.yml
, parsed into a json dict, and the ‘z’ terms are passed to your altitude controller.
p3_pkg/scripts/student_pid_class.py
stencil.p3_pkg/scripts/sim.py
.When you are happy with your changes and confident in the behavior of your PID implementation, you can fly your code! Before you do this you must
student_infrared_pub.py
using a ruler and the javascript interfacestudent_pid_class.py
and your z pid-terms using the simulatorGo to CIT 121 to screw the z-rig mount to your drone.
Use the extra M3 bolts that came with your motors to screw it into the 4 holes in the bottom of your drone. Make sure it’s tight!
Mount your drone on the PVC guide rails, and put the retainer cap back on top. This will keep your drone from flying away!!! Note that the battery is mounted onto the bottom of the z-rig mount.
I’d recommend putting at least two of the legs on your drone so it stays level at the bottom of the rig.
Use state_controller (in p3_pkg) and the javascript interface (also in p3_pkg/web/index.html) as normal to fly your drone on the rig. Wear safey glasses and stand back. Be ready to shut it off at any moment.
Test the performance of your PID by raising and lowering the setpoint (keys ‘w’ and ‘s’ in the javascripts interface). You want to make it both steady when hovering, and responsive to your control inputs. The drone should not oscilate. Tune your pid terms in scripts/pid_terms.yml
to improve performance.
Come to TA hours to show off your drone on the rig! We will be looking for: