# Changing the Formations of Unmanned Aerial Vehicles
## 3 Small Unmanned Aerial Vehicle
### The Control System of the Quadrotor  
A UAV control system consists of an attitude reference system, an autopilot, and a flight manager system. The attitude reference system is responsible for obtaining the pitch (\(\theta\)) and roll (\(\phi\)) angles (Figure 4). These angles inform us about the UAV's position in space; they are measured relative to the Earth's surface. The ability to control the pitch and roll angles decides the stable flight of the quadrotor UAV. The pitch and roll angles are controlled by torques around the Ox axis and Oy. The torques can be controlled by changing the thrust of the drive units. The thrust forces F\({}_{1}\), F\({}_{2}\), F\({}_{3}\), and F\({}_{4}\) generated by the drive units are presented in Figures 4 and 5. Torques M\({}_{\text{x}}\) and M\({}_{\text{y}}\) result from asymmetric change forces generated by the driver units (Equation (3)). This is why the inner loop controls UAV space orientation (Figure 5). The next element of UAV control is the autopilot. This element stabilizes the UAV velocity V, altitude H, and course/heading \(\psi\). The autopilot controls the position of the UAV and generates components of velocity V\({}_{\text{x}}\) and V\({}_{\text{y}}\) (Figures 4 and 5). Next, the outer loop controllers create the pitch \(\theta\) and roll \(\phi\) reference value. The outer loop sets the reference value of the altitude and yaw. The course \(\psi\) and velocity V depend on the combination of V\({}_{\text{x}}\), V\({}_{\text{y}}\), and the yaw. Figure 5: The flight controller. The inner loop has a special block, \"Determining thrusts of driver units\". This block mixes the components of forces and obtains the values of thrusts (F1, F2, F3, and F4). The thrusts are equal to the following:  
\[\text{F}_{1} =\text{F}_{\text{H}}-\text{F}_{\Phi}-\text{F}_{\theta}+\text{kM}_{ \text{b}};\] \[\text{F}_{2} =\text{F}_{\text{H}}-\text{F}_{\Phi}+\text{F}_{\theta}-\text{kM}_{ \text{b}};\] \[\text{F}_{3} =\text{F}_{\text{H}}+\text{F}_{\Phi}+\text{F}_{\theta}+\text{kM}_{ \text{b}};\] \[\text{F}_{4} =\text{F}_{\text{H}}+\text{F}_{\Phi}-\text{F}_{\theta}-\text{kM}_{ \text{b}};\]  
Here, Fh, F4, and F0 are the thrust components from the altitude, pitch, and roll; M4 is the changing torque of the driver unit; and k is the constant factor. The flight controller uses six controllers to stabilize the UAV position and movement. Different kinds of controllers control the UAV (fuzzy logic controllers, robust controllers, sliding controllers [28, 29, 30, 31, 32, 33, 34, 35]). But the most popular are PID controllers. The control law of the PID has proportional, integration, and differential operations. The control laws in the inner loop [33,34] are as follows:  
\[\text{F}_{\text{roll}}=\text{K}_{\text{P}_{\text{roll}}}(\theta_{\text{ref}}- \theta)+\text{K}_{\text{is}_{\text{roll}}}\int{(\theta_{\text{ref}}-\theta) \text{dt}}+\text{K}_{\text{d}_{\text{roll}}}\frac{\text{d}(\theta_{\text{ref}}- \theta)}{\text{dt}};\]  
\[\text{F}_{\text{pitch}}=\text{K}_{\text{P}_{\text{pitch}}}(\phi_{\text{ref}}- \phi)+\text{K}_{\text{i}_{\text{pitch}}}\int{(\phi_{\text{ref}}-\phi)\text{dt }}+\text{K}_{\text{d}_{\text{pitch}}}\frac{\text{d}(\phi_{\text{ref}}-\phi)}{ \text{dt}};\]  
\[\text{F}_{\text{yaw}}=\text{K}_{\text{P}\_{\text{yaw}}}(\psi_{\text{ref}}- \psi)+\text{K}_{\text{i}\_{\text{yaw}}}\int{(\psi_{\text{ref}}-\psi)\text{dt }}+\text{K}_{\text{d}\_{\text{yaw}}}\frac{\text{d}(\psi_{\text{ref}}-\psi)}{ \text{dt}};\]  
\[\text{F}_{\text{thrust}}=\text{K}_{\text{p}\_{\text{thrust}}}(\text{H}_{\text{ ref}}-\text{H})+\text{K}_{\text{i}\_{\text{thrust}}}\int{(\text{H}_{\text{ref}}- \text{H})\text{dt}}+\text{K}_{\text{d}\_{\text{thrust}}}\frac{\text{d}(\text{ H}_{\text{ref}}-\text{H})}{\text{dt}}.\]  
Here, KP2,xx is the proportional coefficient, K4,xx is the integration coefficient, and K4,xx is the differential coefficient. The next part of the UAV control system is the flight manager system (FMS).