Keywords

1 Introduction

Unmanned aerial devices have been developing significant capacities to fly. Therefore, many researchers from multidisciplinaty areas have shown interest in aerial vehicles in which the human influence can be greatly reduced. Different engineering areas such as aerodynamics, control, path planning and for instance autonomous platforms play an important role in this research area. These type of flying vehicles can be designed nowadays to carry or hold different payloads. Likewise, path planning and path following control are being utilized to achieve autonomous tasks. A multirotor type that has vertical takeoff and landing (VTOL) capabilities is the quadrotor. Currently, these kind of vehicles have a large use in aerospace businesses. They can fly autonomously to perform several missions such as environmental research, rescue, traffic or infrastructure inspections, agricultural monitoring, image and video, scientific research, inspections of places with very difficult access and even products delivery. Hence, their uses are not just restricted to dangerous works. [9, 10].

2 Reference Frames

For a math description model and control issues, at least one reference frame is required. If other reference frames are employed, it will be easier to get the derivation of the motion equations. Once multiple reference frames are used, important matters are related to vector transformations from one frame to another. The rotation matrices are based on Euler angles. A reference fixed frame is taken to obtain distance and direction. A coordinate system is considered for measurements. There are two reference frames clearly defined, the Earth Fixed Frame and Body Fixed Frame. [3, 6, 7, 10] The E-frame is selected as the inertial frame. \((0_E\ X_E\ Y_E\ Z_E)\). Its origin is at \(O_E\). In this reference frame, both the linear position (\(\xi ^E\)) and angular position (\(\varTheta ^E\)) are defined. There is another reference frame required as the body frame \((0_B\ X_B\ Y_B\ Z_B)\) and is attached to the body of the quadrotor. The origin is at the reference point \(O_B\). In this B-frame some dynamic variables such as the linear velocity, the angular velocity and the forces and torques are determined. (Fig. 1).

Fig. 1.
figure 1

Reference systems

3 Quadrotor System Variables

A quadrotor commonly has six degrees of freedom (6DOF) and are defined as: \(\xi \) = (x, y, z) represents the linear position and \(\varTheta \) = (\(\theta \), \(\phi \), \(\psi \)) is the attitude or also known as Euler angles pitch, roll and yaw. Thus, if \(\varTheta \) = (\(\theta \), \(\phi \), \(\psi \)) and \(\xi \) = (x, y, z), we obtain the general position vector \(\varPhi \) as:

$$\begin{aligned} \varPhi = \begin{bmatrix} \xi \\ \varTheta \\ \end{bmatrix}= \begin{bmatrix} x \\ y \\ z \\ \theta \\ \phi \\ \psi \end{bmatrix} \end{aligned}$$
(1)

The following are the linear and angular velocities v = (uvw) \(\omega \) = (pqr) are:

$$\begin{aligned} \upsilon = \begin{bmatrix} v \\ \omega \\ \end{bmatrix}= \begin{bmatrix} u\\ v\\ w\\ p\\ q\\ r \end{bmatrix} \end{aligned}$$
(2)

3.1 Mathematical Model

For vector transformations from the E-frame to the B-frame, there is a matrix which is known as the direction cosine matrix. If the rotations are first around x axis next about y and the final one around z axis, the rotation matrix got is: \(R_\Upsilon = R(\phi , \theta , \psi )= R_x(\phi ) R_y (\theta ) R_z (\psi )\). [7, 8, 10, 11]

$$\begin{aligned} R_x(\phi ) = \begin{bmatrix} 1 &{} 0 &{} 0 \\ 0 &{} cos \phi &{} -sin \phi \\ 0 &{} sin \phi &{} cos \phi \end{bmatrix} \end{aligned}$$
(3)
$$\begin{aligned} R_y(\theta ) = \begin{bmatrix} cos \theta &{} 0 &{} sin \theta \\ 0 &{} 1 &{} 0 \\ -sin \theta &{} 0 &{} cos \theta \end{bmatrix} \end{aligned}$$
(4)
$$\begin{aligned} R_z(\psi ) = \begin{bmatrix} cos \psi &{} -sin\psi &{} 0 \\ sin \psi &{} cos \psi &{} 0 \\ 0 &{} 0 &{} 1 \end{bmatrix} \end{aligned}$$
(5)

Hence, the rotation matrix product is as follows:

$$\begin{aligned} R_{\Upsilon _B^E} = \begin{bmatrix} cos \theta cos \psi &{} cos \psi sin \theta sin \phi -sin \psi cos \phi &{} sin \phi sin \psi + cos \phi cos \psi sin \theta \\ sin \psi cos \theta &{} cos \psi cos \phi + sin \psi sin \theta sin \phi &{} sin \psi sin \theta cos \phi - cos \psi sin \phi \\ - sin \theta &{} cos \theta sin \phi &{} cos \phi cos \theta \end{bmatrix} \end{aligned}$$
(6)

If smalls angles of motion are taken \([\dot{\phi }\ \dot{\theta }\ \dot{\psi }]^T\) = \([p\ q\ r]^T\), therefore, the dynamic model is: [7, 8]

$$\begin{aligned} {\left\{ \begin{array}{ll} \ddot{x} = \frac{F_{total}}{m}[sin(\phi )sin(\psi ) + cos(\phi )cos(\psi )sin(\theta )] \\ \ddot{y} = \frac{F_{total}}{m} [cos(\phi )sin(\psi )sin(\theta ) - cos(\psi )sin(\phi )] \\ \ddot{z} = - g \frac{F_{total}}{m} [cos(\phi )cos(\theta )] \\ \ddot{\phi } = \frac{I_{yy} - I_{zz}}{I_{xx}} \dot{\theta } \dot{\psi } + \frac{\tau _x}{I_{xx}} \\ \ddot{\theta } = \frac{I_{zz} - I_{xx}}{I_{yy}} \dot{\phi } \dot{\psi } + \frac{\tau _x}{I_{yy}} \\ \ddot{\psi } = \frac{I_{xx} - I_{yy}}{I_{zz}} \dot{\phi } \dot{\theta } + \frac{\tau _x}{I_{zz}} \end{array}\right. } \end{aligned}$$
(7)

4 Control Model of a Quadrotor

Four torques are needed to control a quadrotor \((\tau _1\ \tau _2\ \tau _3\ \tau _4)\), which are given to the motors to generate the thrust forces \((F_1\ F_2\ F_3\ F_4)\) in z. The net torques acting on the body can be calculated by using the inputs \(U = (U_1\ U_2\ U_3\ U_4)\) that can be applied to control the quadrotor. As an aerodynamic consideration forces and torques are proportional to the squared propeller’s speed. [1]. Therefore the relationship between motions and propellers’ squared speed is as follows:

$$\begin{aligned} \begin{aligned} F_T&= b (\varOmega ^{2}_1\ + \varOmega ^{2}_2\ + \varOmega ^{2}_3\ - \varOmega ^{2}_4) \\ \tau _{x(\theta )}&= bl (\varOmega ^{2}_2\ - \varOmega ^{2}_4) \\ \tau _{y(\phi )}&= bl (\varOmega ^{2}_1\ - \varOmega ^{2}_3\,) \\ \tau _{z(\psi )}&= K_{drag} (\varOmega ^{2}_1\ + \varOmega ^{2}_2\ - \varOmega ^{2}_3\ + \varOmega ^{2}_4) \end{aligned} \end{aligned}$$
(8)

The motor \(\varOmega \) \([rad\ s^{-1}]\) and vector speeds \(\varvec{\varOmega }\) are the following: [1].

$$\begin{aligned} \varvec{\varOmega } = \begin{bmatrix} \varOmega _1 \\ \varOmega _2 \\ \varOmega _3 \\ \varOmega _4 \end{bmatrix} \end{aligned}$$
(9)

\(\varOmega _1\) \([rad\ s^{-1}]\) and \(\varOmega _3\) \([rad\ s^{-1}]\) are the motor speeds (front and rear), also \(\varOmega _2\) \([rad\ s^{-1}]\) and \(\varOmega _4\) \([rad\ s^{-1}]\) are the right and left motor speeds. The relationship between the control inputs and the speeds of the motor is:

$$\begin{aligned} \begin{bmatrix} U_1 \\ U_2 \\ U_3 \\ U_4 \end{bmatrix} = \begin{bmatrix} b(\varOmega ^{2}_1\ + \varOmega ^{2}_2\ + \varOmega ^{2}_3\ + \varOmega ^{2}_4) \\ bl(\varOmega ^{2}_4\ - \varOmega ^{2}_2) \\ bl(\varOmega ^{2}_3\ - \varOmega ^{2}_1) \\ d(\varOmega ^{2}_2\ + \varOmega ^{2}_4\ - \varOmega ^{2}_1\ - \varOmega ^{2}_3) \end{bmatrix} \end{aligned}$$
(10)

l [m] is the quadrotor center distance and \([U_1\ U_2\ U_3\ U_4]\) are the control inputs. \(U_1\) is the thrust force responsible for altitude z. \(U_2\) is the thrust difference between propellers 2 and 4 that originates the roll moment. \(U_3\) represents the thrust variation between motors 1 and 3 that generate the pitch moment. Finally, \(U_4\) is the mixing of the single torques between the clockwise and counterclockwise rotors that are responsible for yaw rotation. Similarly, \(U_1\) creates the desired altitude. \(U_2\) and \(U_3\) generate the respective roll and pitch angles and \(U_4\) originates the yaw angle. [1, 4, 5]. In addition, the linearization about a point of equilibrium is: \(\dot{\mathbf{x }} = f(x,u)\). Hence, as a linear model we obtain: [1, 5, 11].

$$\begin{aligned} \mathbf{f}(x,u) = {\left\{ \begin{array}{ll} \dot{\phi } = p \\ \dot{\theta } = q \\ \dot{\psi } = r \\ \dot{p} = \frac{\tau _x + \tau _{ax}}{I_x} \\ \dot{q} = \frac{\tau _y + \tau _{ay}}{Iy} \\ \dot{r} = \frac{\tau _z + \tau _{az}}{Iz} \\ \dot{u} = - g \theta + \frac{F_{ax}}{m} \\ \dot{v} = g \phi + \frac{F_{ay}}{m} \\ \dot{w} = \frac{F_{az} - F_{total}}{m} \\ \dot{x} = u \\ \dot{y} = v \\ \dot{z} = w \end{array}\right. } \end{aligned}$$
(11)

5 Simplified Control Model

A quadrotor is certainly an underactuated system. It is a 6DOF machine with just four control inputs. So, it may be really difficult to control 6 degrees of freedom having only four control inputs. Mainly, the control work is carried out on attitude and the yaw angle. Hence, the reduced dynamics model considered for control is:

$$\begin{aligned} \left( \begin{aligned} \ddot{z}&= g - (cos \phi cos \theta )\frac{1}{m}U_1 \\ \ddot{\phi }&= \frac{U_2}{I_x} \\ \ddot{\theta }&= \frac{U_3}{I_y} \\ \ddot{\psi }&= \frac{U_4}{I_z} \end{aligned} \right) \end{aligned}$$
(12)

5.1 Control Laws for Attitude and Altitude

The following PID control law is the taken for altitude:

$$\begin{aligned} {\begin{matrix} U_1 = K_p^z e_z + K_d^z \dot{e}_z + K_i^z \int (e_z),\ e_z = z - z_d \end{matrix}} \end{aligned}$$
(13)

\(K_p\), \(K_d\), \(K_i\) are the gains (proportional, derivative and integral), \(\dot{e}_z\) represents the desired altitude change and \(z_d\) is defined as the desired altitude. If matrix 10 is inverted, we get the relationship between U and \(\varOmega ^2\) as follows:

$$\begin{aligned} \begin{bmatrix} \varOmega ^{2}_1 \\ \varOmega ^{2}_2 \\ \varOmega ^{2}_3 \\ \varOmega ^{2}_4 \end{bmatrix} = \begin{bmatrix} \frac{1}{4b} &{} 0 &{} \frac{1}{2bl} &{} -\frac{1}{4d} \\ \frac{1}{4b} &{} -\frac{1}{2bl} &{} 0 &{} \frac{1}{4d} \\ \frac{1}{4b} &{} 0 &{} \frac{1}{2bl} &{} -\frac{1}{4d} \\ \frac{1}{4b} &{} \frac{1}{2bl} &{} 0 &{} \frac{1}{4d} \end{bmatrix} \begin{bmatrix} U_1 \\ U_2 \\ U_3 \\ U_4 \end{bmatrix} \end{aligned}$$
(14)

Also, the control laws for attitude or orientation angles (roll, pitch and yaw) are taken as:

$$\begin{aligned} {\begin{matrix} U_2 &{} = K_p^\phi e_\phi + K_d^\phi \dot{e}_\phi + K_i^\phi \int (e_\phi ), \ e_\phi = \phi - \phi _d \\ \end{matrix}} \end{aligned}$$
(15)
$$\begin{aligned} {\begin{matrix} U_3&= K_p^\theta e_\theta + K_d^\theta \dot{e}_\theta + K_i^\theta \int (e_\theta ), \ e_\theta = \theta - \theta _d \end{matrix}} \end{aligned}$$
(16)
$$\begin{aligned} {\begin{matrix} U_4&= K_p^\psi e_\psi + K_d^\psi \dot{e}_\psi + K_i^\psi \int (e_\psi ), \ e_\psi = \psi - \psi _d \end{matrix}} \end{aligned}$$
(17)

Similarly, \(K_p\), \(K_d\), \(K_i\) are the proportional, derivative and integral gains, \(\dot{e}_\phi , \dot{e}_\theta , \dot{e}_\psi \) are the adjustments for the desired angles and \(\phi _d, \theta _d, \psi _d\) are the desired angles.

5.2 Transfer Functions

The following are the attitude transfer functions:

$$\begin{aligned} \begin{aligned} G_{\varPhi /U_2} (s)&= \frac{1}{s^2 I_x} \\ G_{\varTheta /U_3} (s)&= \frac{1}{s^2 I_y} \\ G_{\Psi /U_4} (s)&= \frac{1}{s^2 I_z} \end{aligned} \end{aligned}$$
(18)

And for altitude we have,

$$\begin{aligned} G_{z/U_1} (s) = \frac{1}{s^2 \ m} \end{aligned}$$
(19)

6 PID Controller Computation

The transfer function considered for a PID controller is (Table 1):

$$\begin{aligned} G(s) = P + \frac{I}{s} + \frac{Ds}{s+1} \end{aligned}$$
(20)

Some autopilot devices just implement PD control. Thus, the transfer function is as follows:

$$\begin{aligned} G(s) = P + \frac{Ds}{s+1} \end{aligned}$$
(21)
Table 1. Controller design parameters

The PD controller values are:

$$\begin{aligned} \begin{aligned} P&= \omega _n^2 I_{xyz} \\ D&= 2\zeta \omega _n I_{xyz} \end{aligned} \end{aligned}$$

For the PID controllers are given as:

$$\begin{aligned} \begin{aligned} P&= 2\zeta \omega _n \beta + \omega ^2_n I_{xyz} \\ I&= \omega ^2_n \beta I_{xyz} \\ D&= 2 \zeta \omega _n \beta I_{xyz} \end{aligned} \end{aligned}$$

Thus, the controller variables are:

$$\begin{aligned} \begin{aligned} P&= m \omega _n^2 \\ D&= 2\zeta \omega _n m \end{aligned} \end{aligned}$$

Finally, the parameters for the PID controller are given by (Table 2):

$$\begin{aligned} \begin{aligned} P&= 2 \zeta \omega _n \beta + \omega _n^2 m \\ I&= \omega _n^2 \beta m \\ D&= 2 \zeta \omega _n + \beta m \end{aligned} \end{aligned}$$
Table 2. Dynamics values for simulation

Other variables are also taken for control simulation (Table 3) and (Figs. 2, 3, 4, 5, 6 and 7).

Table 3. Dynamic parameters
Fig. 2.
figure 2

Altitude PID control

Fig. 3.
figure 3

Roll PID control

Fig. 4.
figure 4

Pitch PID control

Fig. 5.
figure 5

Control PID yaw

Fig. 6.
figure 6

Altitude/attitude PD controller response for models 1, 2, 3

Fig. 7.
figure 7

Altitude/attitude PID controller response for models 1, 2, 3

7 Results

The dynamics values are separately taken for all models. It can be noticed that in the PD control simulations for models 1, 2 and 3, there is initially some overshoot. However, after some adjustments a proper attitude stabilization is achieved. Regarding to altitude performance, an important overshoot is also evident and the control signal obtained tends to deviate from the desired. This issue may appear due to some kind of altitude increase or some PID gains tuning variation still needed. For models 4, 5 and 6, a superior PD and PID control capability is noted. Some very small peaks are originated for attitude. Although, these signals are very similar or not so far from to the desired ones. A slow reaction can be noticed for the yaw angle. In spite of this fact, finally the vehicle could stabilize. The mean of the dynamics values taken is acceptable. Despite this, it is definitely necessary to make some additional changes. Some simulations show that there are some kind of changes or oscillations especially for position. It seems that there are some small oscillations when the inertia moments values are increased. Moreover, oscillations rise as the moments of inertia are small. Therefore, this the fact could be created because of some abrupt changes in attitude. These changes are perceived in simulation. It is possible to be associated to the increase or reduction of the thrust force and configuration type (X, \(+\)).

8 Conclusions

A mathematical model of a quadrotor is provided based on the Newton-Euler method. Another mathematical and linearization approach for further studies may be considered with Taylor series as presented in [2, 10]. Besides the analytical computation of the PID gains, it is required to use a computational tool such as MATLAB (PID option) to adjust or get more precise gains values for better controller performance. It seems that it is feasible to accomplish appropriate results with just a PD controller. It might be suitable for a stable flight (attitude). Although some very small peaks are observed in attitude control signals, they are not far from the desired settings. It is also seen a slow response of the yaw angle. However, after a while the platform can be stabilized. The altitude behaviour is not so right and the state error increases. On the other hand, a much better altitude and attitude performance is got for models 4, 5, and 6. Some negative estimations are acquired for orientation angles. This may be possible due to motors configuration (X, \(+\)). These values just give an inclination and don’t affect the angle magnitude. It is inferred that the dynamic parameters certainly can have an significant effect on the PID controller efficiency.