The Quadcopter Application
The quad application is the brains of the quadcopter.
It must perform the following:
-
Receive inputs and compute motor outputs to maintain stable flight
- accomplished through the control algorithm
-
Parse and send message packets in order to communicate with the
ground station
- Respond to commands sent by ground station
- Send ground station logs
Controller Network (Control algorithm)
First read the documentation for the computation graph library to understand how the graph computes functions from a directed graph.
To visualize the default control network, from the quad/
folder, run make diagram
with graphviz installed, and an image of the control network will show up as network.png
in the src/gen_diagram folder. To see the autonomous controller, you can change the call at the bottom of control_algorithm_init
from connect_manual()
to connect_autonomous()
before running make diagram
. Just be sure to change it back to connect_manual()
before the final build. Below is a simplified version of the autonomous controller that shows the control network for autonomous flight using VRPN data. (Unused blocks relating to manual flight and optical flow have been removed, as well as Ts_IMU and Ts_VRPN, which are blocks that keep track of the sampling period)
One potential confusing point to take note of is the difference between "(X/Y) Vel PID" and "(X/Y) Vel" blocks. "(X/Y) Vel" is just a PID controller that has Kd=-1, which results in calculating the derivative of position to provide velocity. For clarity, it would be a good idea to create an actual differentiation block.
- Note our use of derivative on value, not error