# Flight control of a drone

This tuto was performed with the CPGE toolbox for control systems teaching in French preparatory classes: https://atoms.scilab.org/toolboxes/CPGE/1.6.0

It was based on the following practical course in french: http://tsi.ljf.free.fr/ATS/docs/S2I/TP/TP-CY5-D2C/index.html

The objective of this tutorial is to analyse and improve the performance of the speed control of a drone along the pitch axis, by acting on the direct powerchain, or on the feedback loop.

The requirements for the pitch control are as follow:

 Function Criteria Obtain a good behavior of the speed feedback loop Phase margin > 45° Crossover < 25 % 5% response time < 0.5 s

We can represent the Hardware & Software drone architecture with the Block Definition Diagram in SysML.

The different blocks or sub-systems internal architecture and data exchanged can be described by an Internal Block Diagram.

This is the target result for the control of the drone flight along the pitch axis:

This is the target result for the control of the drone flight along the pitch axis:

This is the target result for the control of the drone flight along the pitch axis:

The analysis of the control system intends to ensure:

• stability
• robustness
• precision

## Stability

Without correction (P=1), we can lead a frequency analysis without need of configuration (model attached).

Run the bode diagramm and justify that stability cannot be achieve simply with a proportional controller.

What we consider here is a simple control of the position of the drone:

## Robustness

In order to improve the performance of the system, we will set up an internal feedback loop to control the speed:
- The external loop, controlling the position, is corrected by a proportional factor of Kp=0,04.
- The internal loop, controlling the speed, is represented here, and can be found in the attached model:

### Adding a perturbation

Add the following perturbation, to evaluate the benefit of the speed feedback loop on the robustness of the system: