we’ll discuss IMUs as in their use in flight controllers for drones.We’ll dive deeper into each component in the sections below.

#### Control theory The feedback loop is at the heart of control theory. A feedback loop occurs when outputs of a system(or process) are transformed into inputs for the same system, thus forming a loop where the current output will be fed in as a form of input in the next iteration.
Maybe an example will make everything clear:
While you're driving your car in the highway, you decided to keep your speed constant at, let's say, 90 km\h.
You look to the speedometer you realize you're going 80 km\h, you realize that the difference between the current
speed and the desired speed isn't that high thus you slowly push the throttle. You keep looking at the speedometer,
you realize you're getting closer to the desired speed, it's 84 km\h, thus you slightly push the throttle. You keep
executing this loop during the whole journey until you reach your destination. Each time you measure
the output of your input (stepping on the throttle) by looking at the speedometer and you determine your _new_ input
from the measured speed value.
The goal of control theory is to develop a model that drives a system’s parameter(s) into a desired value.
Terminology
In our previous anology:
Okay, but what does this have to do with drones?
Drones aren’t stable, even if you apply the exact same throttle to all the motors, chances it will crash immediatly. No, this has nothing to do with your piloting skills, it is due to the fact that it is impossible to build a perfect drone where the center of gravity is perfectly placed, where the motors rotate at the exact same speed, where the propellers are perfectly made, where …
And even if that was the case, what if a burst of wind destabilizes your drone while you’re not paying attention?
That is why we need control theory to guide the drone into the desired values.
What are those desired values?
PID CONTROLLER


Okay… Maybe an example would be helpful?
Let's go back to the car example, each time you measure the error, that is the difference between the set point (90 km\h) and
the speed measured from the speedometer, you apply a proportional force to the throttle pedal. For instance, you notice that
the error is 20 km\h thus you push somewhat hardly on the pedal. You notice the error is 4 km\h thus you slightly push the pedal.
In the same example, you realize the error is 30 km\h, that is a significant error thus you apply a proportional correction by
flooring the peddal! After some time, the error is 25 km\h but you realize that you are rapidly approaching 90 km\h and that
there is a risk that you will surpass that value (overshoot) that you decide to reduce the force by which you step on the pedal.
Up to this point, we assumed that the output of the PID controller is the change in force applied to the pedal thus when we reach
the desired speed,the output would be zero (that is no change in force applied to the peddal). But what if we want the output
to be an angle (see picture). In this case, even if you've reached the desired speed, the output of the PID shouldn't be
zero! Without the integral part, the output would be zero, that is a 0 angle which is wrong.
