An effective proportional-double derivative-linear quadratic regulator controller for quadcopter attitude and altitude control

A quadcopter control system is a fundamentally difficult and challenging problem because its dynamics modelling is highly nonlinear, especially after accounting for the complicated aerodynamic effects. Plus, its variables are highly interdependent and coupled in nature. There are six controllers studied and analysed in this work which are (1) Proportional–Integral–Derivative (PID), (2) Proportional-Derivative (PD), (3) Linear Quadratic Regulator (LQR), (4) Proportional-Linear Quadratic Regulator (P-LQR), (5) Proportional-Derivative-Linear Quadratic Regulator (PD-LQR) and lastly (6) the proposed controller named Proportional-Double Derivative-Linear Quadratic Regulator (PD2-LQR) controller. The altitude control and attitude stabilization of the quadcopter have been investigated using MATLAB/Simulink software. The mathematical model of the quadcopter using the Newton–Euler approach is applied to these controllers has illuminated the attitude (i.e. pitch, yaw, and roll) and altitude motions of the quadcopter. The simulation results of the proposed PD2-LQR controller have been compared with the PD, PID, LQR, P-LQR, and PD-LQR controllers. The findings elucidated that the proposed PD2-LQR controller significantly improves the performance of the control system in almost all responses. Hence, the proposed PD2-LQR controller can be applied as an alternative controller of all four motions in quadcopters.


Introduction
In recent years, the popularity of the small-scale Unmanned Aerial Vehicle (UAV) such as quadcopter has drastically increased due to its advantages and wide range of military and civilian applications. For instance, wildfire surveillance [1], search and rescue mission, and hazardous environment monitoring [2]. With these UAVs, the risk of human lives in a dangerous scenario can be minimized or avoided [3]. Compare to the fixedwing UAV, a quadcopter has the ability to do a vertical take-off and landing (VTOL), or short take-off and landing (STOL) and hovering flight capabilities. With these capabilities, the quadcopter does not require a runaway for take-off and landing like a fixed-wing UAV, it just simply directs vertical take-off and landing in a limited space, plus the hovering capability give a great advantage if static image capturing is needed [4].
However, to control the quadcopter is difficult and challenging since the system is strongly coupled and nonlinear [5]. In addition, it is also severely underactuated since it has six degrees of freedom (three translational and three rotational) that need to be controlled by only four independent inputs (rotor speeds), which brings about the complexity in its position and attitude control [3,6,7]. The precise controller design is needed to control the quadcopter system because of its high maneuverability capability. Parameter perturbation and model uncertainties have brought another difficulty with the quadcopter control system. Besides, stabilization within a short period with an acceptable precision level is needed for all parameters due to quadcopter's fast dynamics.
Before the controller can be designed, first, the dynamics model of the quadcopter must be derived and studied. Basically, there are several types of formulism can be used for the derivation, but the most commonly used by the researchers are based on the Newton-Euler or Euler-Lagrange formulism [8]. Thus, in this paper, the dynamic modelling of the quadcopter was done using the Newton-Euler formulation approach. The system that was modelled by any approach can be controlled by various methods such as PID control [8][9][10], LQR control [11][12][13], for the linear controller or Backstepping Control (BC) [14,15], Sliding Mode Control (SMC) [16][17][18] for the nonlinear controller to name a few. However, the linear controller like PID is the most commonly used for the quadcopter control and stabilization due to its simplicity, easy to design, and can provide sufficient performance [19].
Li and Li [20] designed a PID controller to analyse the dynamic characteristics of the quadrotor. The controller was used to control the position and orientation of the quadrotor in 3D space. The simulation conducted found that the PID controller can achieve a stable and good response in all the states. It produces a fast response with almost zero steady-state error. However, the system experiences a slight overshoot in all the states. In order to test the robustness of the controller against the disturbance, an actual experiment was conducted, and it shows that the PID controller can adjust the changes in the state when disturbed by wind or other disturbances.
Pan et al. [21] conducted a study of an optimal PID controller based on Qball-X4 quadrotor developed by Quanser company as the experimental platform for trajectory tracking control. They designed a corresponding Kalman Filter to estimate the target trajectory in consideration of tracking error and delays. The finding shows that the system can reach desired altitude height in an acceptable period without steady-state error but produce a high overshoot. The tracking error under the disturbance greatly improved when the Kalman filter was added. In another work by Tanveer et al. [22], the PID controller with Extended Kalman Filter was used to control and stabilize the quadrotor's altitude and attitude angle. Extended Kalman Filter was used to filter out the sensor noise and system noises to stabilize the quadrotor's altitude and attitude angle. In their findings, the controller can quickly stabilize the altitude of the quadrotor within 3.8 s. It can also work, handle disturbance very well, and promptly stabilize the quadrotor's attitude angle within 5.8 s.
Ahmad et al. [23] presented a comparative study of two classical PD and PID controllers for controlling quadrotor's altitude and attitude angle. The simulation result shows that both controllers have a fast response within approximately less than 1 s in all states. Still, the PD controller gives a better response in attitude control in terms of settling time, which is 2 s, while the PID controller is 11 s with slight overshoot. However, the PID controller gives a better result in altitude control with zero steady-state error, while the PD controller has a 1.25% steady-state error. Both controllers exhibit approximately a 5% overshoot in altitude motion.
Burggräf et al. [9] presented mathematical modelling of the quadrotor based on the cross configuration. They stated that cross structure allows the quadrotor to have six DOF movements while commanded by only four given inputs. In this paper, they implemented a cascaded P-PID controller to control and stabilize the quadrotor attitude. The simulation result shows that the system's overshoot is less than 25% in roll, pitch, and yaw motion, respectively, and the controller produces a very fast settling time around 1.3 s. Other than that, they also perform an experimental study to test the controller's robustness against external disturbances such as wind and collision. They found that the controller can stabilize the quadrotor in just 2.2 s after being exposed to the external disturbance.
Zhi et al. [24] proposed an optimal LQR controller combine with Kalman Filter to control the quadrotor's attitude angle. They conducted the simulation for noise-free and under noise conditions to appreciate Kalman Filter's performance in rejecting the noise. The performance of the LQR controller is then compared with the classical PID controller. The simulation result shows that both controllers can meet the system's requirement under the noise-free condition with no steady-state error. However, the LQR controller does not produce an overshoot and smoother response, while PID has a slight overshoot up to 0.2°. Under the noisy condition, the LQR controller with Kalman Filter can maintain its performance quality than the LQR controller without Kalman Filter. The attitude response error can be reduced from ±0.6°to +0.2: −0.3°when Kalman Filter is added.
Hernandez-Martinez et al. [25] performed a study of trajectory tracking control of the quadrotor using a two-level control strategy, which consists of an external loop to control the translational dynamics and generate the desired trajectories of the attitude orientation controlled by the inner loop. In order to achieve the maximum flight control time, energy-saving is addressed in designing the optimal control laws. The simulation result shows that the quadrotor can follow the desired trajectory with the desired attitude angle value. The tracking error converges to zero within an acceptable time.
Okyere et al. [11] presented a step-by-step design of the LQR controller for controlling the altitude motion of the quadrotor. In this paper, the authors demonstrated the effect of the weighting matrices Q and R on the controller's gain K values that simultaneously affect the system's state response. They found that if R is high, K will be small, and the response will be slower and vice-versa. If Q is high, then K will be high, and the response will be faster and vice-versa. The simulation result shows that when K is lower, the state response time will become slower to reach zero, but the controller response becomes faster, and it will produce overshoot and steady-state error. When K is higher, the state response will be faster to reach zero, but the controller response becomes slower and produce a steady-state error. Therefore, choosing a suitable gain value K is vital to get a good system performance. In this paper, the controller gain is settled on [1 1.7321] since it has no overshoot, no steady-state error, and the system was good.
In another work by Martins et al. [12], an optimal LQR controller with an Integral action is proposed for trajectory tracking control of the quadrotor. A Kalman Filter is added to estimate the quadrotor state that relies on the measurement from motion sensors installed onboard. In this paper, the quadrotor's dynamic models based on X-configuration were derived and linearized for the trim position. The simulation result shows that good trajectory tracking was achieved, and the response converges to the desired point without error. However, some error was observed in the yaw response, but it does not exceed 1/100°. More than that, some deviation within the acceptable range has occurred when implementing in the actual system.
Shah et al. [13] provided a study of trajectory tracking control for the quadrotor using Gain Scheduled Integral LQR. The integral term is added to improve the tracking performance of the quadrotor by minimizing the steady-state error of the system. In this paper, several trajectories were performed with significant variation of yaw angle. In order to appreciate the performance of the proposed controller, two simulations were conducted: (1) tracking without integral term and (2) tracking with the integral term. Based on their findings, the continuous gain control law can overcome the chattering and discontinuity problem. The tracking error can be minimized. The yaw angle's steady-state error improved by 95% (4.3854-0.222) and 56.6% (0.0865-0.0037) for cases 1 and 2, respectively. For altitude response, 94.8% decreased (0.1155-0.0059) for case 1 and a slight increase by 4% (0-0.04) for case 2.
Kumar et al. [26] presented a differential flatnessbased hybrid controller for the quadrotor trajectory tracking problem. In the paper, the combination of the conventional PID and LQR controller was designed. The author indicates that the hybrid controller could balance the stability and maneuvrability of the quadrotor, which makes it suitable for the complex trajectory tracking problem. For validation purposes, a comparative study between conventional PID and LQR controllers was made by the author. The simulation results reveal that the quadrotor could track the desired trajectory with a satisfactory performance when using the hybrid controller compared to the other controller, especially the PID controller, where it cannot accurately follow the desired trajectory. The error of the position and the attitude angle is very minimal for the hybrid controller.
A hybrid P-LQR controller has been proposed by Yit and Rajendran [27]. In this paper, the hybrid P-LQR controller was designed to improve the UAV's longitudinal motion performance over the PID and LQR controllers. The simulation results show that this approach improved the rise time, settling time, and RMSE, but the overshoot and steady-state error slightly increases, still within the acceptable limit constraint. The PD-LQR is another type of hybrid controller that being studied by Yit et al. [19]. The simulation result shows that the hybrid PD-LQR controller performs with great success. The controller's improvement in rising time, settling time, RMSE, and steady-state error is 95.6%, 95.5%, 49.3%, and 0%, respectively. In terms of overshoot, the hybrid PD-LQR controller still lags behind the hybrid P-LQR controller with just a 0.001% difference, and the LQR controller has the highest percentage of overshoot with 0.351%.
In summary, this section has provided several literatures that perform a linear control technique for the UAV control and stabilization. The main objectives of all of these works are that to design an appropriate control technique to improve the performance of the UAV. For this particular reason, in this paper, we proposed a hybrid controller by combining the Proportional-Double Derivative (PD2) controller with the LQR controller to become the PD2-LQR controller. As far as we know, there are no such hybrid controller are being designed and applied to the quadcopter control and stabilization application in the literatures. The work that we find almost similar to our work is that proposed by [19], which using a PD-LQR controller that was applied for the fixed-wing UAV. Besides, it was proven through the simulation that by using this combination the performance of the quadcopter can be further improved. Through this work, the simulation was done by using the MATLAB/Simulink software, and all the essential parameter needed to design the dynamic model of the quadcopter was determined and collected. A comparative study of the response characteristic of the proposed controller with the conventional controller, namely PD, PID, LQR, and hybrid controller, namely P-LQR, and PD-LQR was presented and analysed to highlight the performance of the proposed controller. Four PD2-LQR controllers were designed for altitude (z) and attitude (roll, pitch, and yaw) motion. Based on the simulation results, the developed hybrid PD2-LQR controller is best-suited to control and stabilize the states of the quadcopter with a better dynamic performance in terms of rising time, settling time, percentage overshoot, steady-state error, and RMSE.
The rest of this paper is arranged as follows; in Section 2, the dynamic modelling of the quadcopter based on the Newton-Euler approach and its associated parameters are presented. The development of the control design techniques are presented in Section 3. In Section 4, the technique for the simulation is described. In Section 5, the simulation results are discussed. Lastly, a concluding remark based on the proposed controller is presented in Section 6.

Dynamic modelling of quadcopter
The first step in designing the dynamic model of the quadcopter is to define the inertial frame and body frame in the three-dimensional space, each with its defined right-handed coordinate system, as shown in Figure 1. In this way, the attitude and the position of the quadcopter can be controlled in a three-dimensional space. The inertial frame or earth frame, denoted by E, is used to describe the absolute position in the space. The origin of the coordinate system E is fixed on a ground surface or a specific point in space and the initial position of the quadcopter.
The designation of the quadcopter heading is in the positive direction of the OX-axis and perpendicular to the OYZ plane. The OY-axis is perpendicular to the OXZ plane and the OZ-axis perpendicular to the OXY plane and pointing vertically upward. The relative movement of the ground and the quadcopter is studied using this coordinate system. The centre of the quadcopter is the origin of the quadcopter coordinate system OXYZ denoted by B. The positive OX-axis is pointing toward rotor 1, the positive OY-axis is pointing toward rotor 4 and OZ-axis is pointing vertically upward against the gravity. These two coordinate systems can be converted to each other through transition matrix R.
Based on this reference frame, [xyz] T is defined as the translational position and [φθψ] T is defined as an angular position. The location of the quadcopter to the inertial frame is indicated by the translational position. The angular position is defined by the Euler angle. Roll angle, φ, is referred to rotating angle around the OX-axis, pitch angle, θ, is refer to rotating angle around the OY-axis and yaw angle, ψ, is refer to rotating angle around the OZ-axis. Thus, the rotational matrixs R x , R y , and R z from the body frame B to the inertial frame E can be obtained as in the following equations [20]: By multiplying these three rotational matrices R x , R y , and R z , we finally can obtain the rotational matrix R of the body frame relative to the inertial frame as in the following equation [20]: Similarly, the relationship between the Euler rate (φ,θ ,ψ) in the inertial frame and the angular velocity in the body frame (p, q, r) can be determined through the transformation matrix given in the following equation [28]: On the other hand, for transforming the angular velocity from the body frame to the inertial frame, an inverse transformation matrix of Equation (5) can be performed. Around the hover position, the angle of φ and θ is close to 0; thus, the transformation matrix T can be approximate as a unit matrix. In this case, the relation between the Euler rate and the angular velocity in the body frame can be approximated as linear as in the following equation according to Reizenstein [29]: ⎡ ⎣φ θψ

Mathematical derivation
Before the derivation of the mathematical model of the quadcopter can be modelled, the following assumptions need to be made [20]. The assumptions are (1) the structure of the quadcopter is symmetrically rigid, (2) the geometric centre and centroid of the quadcopter are in the same position with the origin of the inertial coordinate system, (3) flight altitude and other factors do not affect the resistance and gravity of the quadcopter and (4) thrust and drag forces are proportional to the square of the propeller speed.

Kinematic equation
Using Newton and Euler equations for the threedimensional motions of a rigid body, the mathematical equation of the quadrotor will be presented. The vector that contains the linear and angular position of the quadrotor in the inertial frame is defined as [XYZφθψ] T and the vector that holds the linear and angular velocity of the quadrotor in the body frame is defined as [uvwpqr] T . The relationship between the body frame and the inertial frame of the quadrotor in the three-dimensional space are linked by the following equations [30]: By solving Equations (7) and (8), the kinematics equation of the quadrotor is obtained as given in the following equation [31]:

Dynamic equation
The dynamics equation of the quadrotor has two components, which are translational components and rotational components. In translational components, it consists of the Z altitude, the X position, and Y position, while in rotational components, it consists of the roll (φ), the pitch (θ ) and the yaw (ψ) motion. The derivation is done as according to the assumption stated before, and the general formalism of the Newton-Euler equation is presented as follows [31]: where is the mass of the quadrotor, I is the inertia, v is the linear velocity, ω is the angular velocity, F is the forces acting on the centre of the quadrotor's body, and M is the torque acting on the quadrotor's body.

Translational dynamic equation
Since the quadrotor is considered as a rigid body, according to Newton's second law of motion, the total forces acting on the centre of gravity of the quadrotor in the body frame can be represented as the following equation [31]: where m is the mass of the quadrotor, and F B = [F x F y F z ] T ∈ R 3 are the total forces acting on the centre of gravity of the quadrotor. Thus, solving Equation (11) yield the following equation:

Rotational dynamic equation
Likewise, according to Euler's equation, the total torques acting on the centre of gravity of the quadrotor in the body frame can be represented as follows [31]: where M B = [M x M y M z ] T ∈ R 3 are the total torques acting on the centre of gravity of the quadrotor, and I is the diagonal inertia matrix due to the assumption that quadrotor's structure is symmetrical. Thus, solving Equation (13) yield the following equation: These equations are valid as long as the origin of the body frame's axes coincides with quadrotor's centre of gravity.

Forces Applied on the quadcopter
The gravitational force naturally exists in the inertial frame and acts at the centre of quadrotor's centre of gravity. This force only exists in the Z-axis and pointing in the downward direction and defined as follows: To transform the gravitational force from inertial frame to body frame, Equation (15) is multiplied with the rotation matrix R and represented as follows: where m is the mass of the quadrotor and g is the gravitational acceleration. The second force exerted on the quadrotor is the thrust force. Thrust force is the lifting force produced by the rotation of the propellers that move the quadrotor in the positive vertical direction of the Z-axis. Since the quadrotor has four rotors that drive the vehicle, and to achieve a vertical motion, all rotors must produce the same amount of thrust, and the total thrust produce is simply the addition of the thrust in each rotor. The total thrust is defined as follows: where T i is the thrust produced by the ith propeller.
Since the thrust is generated from the rotation speed of the propellers, thus the equation of the thrust is defined as follows [31]: However, since the quadrotor is flying at a limited altitude, the air density can be considered constant, and to comply with the assumption stated earlier, Equation (18) can be simplified as follows [32]: where C T is the thrust coefficient, ρ is the air density, A is the area of the blade, r is the radius of the blade, i is the angular speed of the ith rotor, and b is the thrust factor. Therefore, the total thrust force expressed in the body frame is as follows:

Torque Applied on the quadcopter
Since the rotor is located at a certain distance from quadrotor's centre, it will create torque in a different rotation axis. As seen in Figure 2, each rotor will create a moment in the direction opposite to the rotor's rotation.
Around the x-axis, by using the right-hand rule with the axis of rotation, rotors 1 and 3 did not produce any moment on the x-axis, but rotors 2 and 4 did. Thus, the total moment about the x-axis can be expressed as follows: Around the y-axis, by using the right-hand rule with the axis of rotation, rotors 2 and 4 did not produce any moment on the y-axis, but rotors 1 and 3 did. Thus, the total moment about the y-axis can be expressed as follows: where l is the distance of the rotor to the centre of gravity of the quadrotor. Around the z-axis, the moment generated is the result of the rotation of the rotors itself and not because of the thrust force produce by the propellers. The reaction torque of the rotor is given as follows: Thus, the total moment about the z-axis can be expressed as follows: where d is the drag factor. The gyroscopic moment is a physical effect produced by the propellers' rotation and the rotation of quadrotor's body. The gyroscopic moment is given by where ω is the propeller's speed, J r is the rotor's inertia, and r is the resultant angular velocity defined as r = − 1 + 2 − 3 + 4 .

Final quadcopter model
The complete quadrotor mathematical model including the control input vector is presented in this subsection.

Control input vector, U
By controlling the rotational speed of the rotor, one can control the movement of the quadrotor. The rotational speed of the rotor is chosen as the input to the quadrotor system. Four control inputs that controlled the quadrotor system are defined as follows: where The control inputs in Equation (27) can be represented in matrix form as ⎡ From the above matrix Equation (28), U 1 is the control input responsible for the altitude motion of the quadrotor, consisting of the four rotors' speed which caused the upward thrust force. U 2 is the control input responsible for the roll motion of the quadrotor; it is the difference in thrust between rotor 2 and rotor 4. U 3 is the control input responsible for the pitch motion of the quadrotor; it is the difference in thrust between rotor 1 and rotor 3. Finally, U 4 is the control input responsible for the yaw motion of the quadrotor; it is the difference in torque between the pair of clockwise rotating rotors and the pair of counter-clockwise rotating rotors. If the rotor's speed is required to be calculated from the control inputs, an inverse relationship between the rotor's speed and control input can be performed by inverting the above matrix Equation (28) and can be represented as follows:

Translational equation of motion
The complete translational dynamics equation, after considering the gravitational force and thrust force is become, Substituting the value for F g and F T from Equations (16) and (20) into Equation (30), the following equation is obtained: Finally, rewriting Equation (31) and solve for the linear acceleration, we can obtain in the following equation:

Rotational equation of motion
The complete rotational dynamics equation, after considering the torque acting on the quadrotor and the gyroscopic effect is become, where Finally, rewriting Equation (34) and solve for the angular acceleration, we can obtain in the following equation: Grouping together the translational and rotational equation of motion, the complete nonlinear dynamic equation of the quadrotor becomes However, since only four control inputs are available, thus only four motions were chosen to be control, which are the altitude (Z) and the attitudes (φ, θ , ψ). Therefore, the dynamic Equation (36) can be reduced to Equation (37) by omitting the translational movement in X and Y directions from the system.
From the nonlinear Equation (37), the system's solution is difficult to find because the trigonometric functions are related to each other in a no-elementary way [33]. Due to this factor, a simplification of the system based on a small angle approximation can be done to obtain a linear dynamic equation for the system. This simplification is made by approximating the sine function with its argument (sin α = α), and the cosine function with the unity (cos α = 1). This approximation is valid as long as the alpha is small, where α = φ, θ , ψ.

Controller design
The complex nonlinear dynamic of the system makes the control of the quadcopter becomes a difficult task, thus, a linear dynamics equation was used for the simulation. In this paper, several control strategies namely the conventional PID controller, PD controller, LQR controller, a hybrid P-LQR controller, and hybrid PD-LQR controller are studied and compared with the proposed controller, a hybrid PD2-LQR controller. These techniques are elaborated in the following section. The general form of a linear state space representation is given asẋ = Ax + Bu withẋ is the states vector, and u is the inputs vector as given in Equations (38) and (39).
State vector, Input vector, In a straight flight path, the longitudinal motion equation of the quadcopter is defined in Equation (40), and the coefficient matrix is given in Equation (41) [20].
x g = A g x g + B g u g (40) where state vector, x g = [ẋ,ż, q, θ ] T and input vector, In a horizontal flight path, the motion equation of the quadcopter is defined in Equation (42), and the coefficient matrix is given in Equation (43) y v y p y r y φ 0 l v l p l r l φ 0 n v n p n r n φ 0 0 1 0 The transfer function of the quadcopter in the roll, pitch, yaw, and altitude motion are given in Equations  [34].

PID controller
PID controllers are one of the most commonly used controllers in the industrial application due to its robustness and simple structure configuration. For the controller implementation, the parallel structure of PID in a continuous-time domain is chosen. The PID controller attempts to minimize the error by adjusting the input value to reduce the contrast between the measured value and the desired value. Proportional, integral, and derivative gains are the three involved parameter gains in this structure, as shown in Figure 3. The PID controller gains used in this paper are shown in Table 2. The structure of the PID controller can be expressed in the following where u is controller output, K p is the proportional gain, K i is the integral gain and K d is the derivative gain.

PD controller
Other than the PID controller, the quadcopter system also can be stabilized using only the Proportional-Derivative (PD) controller configuration. As compared to the PID controller, it shows that the PD controller is better in terms of robustness [3]. Thus, the PD controller can be used to replace the PID controller ( Figure 4) since its structure is simpler to design, and it gives the easiest way to control the highly uncontrolled quadcopter vehicle. The gains of the PD controller are shown in Table 3. The structure of the PD controller in its respective motion can be designed as in the following equations:

LQR controller
The LQR controller is a feedback controller with an optimal control technique. The state or output of the   LQR controller is feedback and compared to the setpoint value. The output is feedback through the controller's gain K [35]. The LQR system ( Figure 5) can be expressed in a state variable form in the following equation [36,37]:ẋ To achieve the desired output, the controller's gain K needs to be obtained [35]. The optimal control vector for the state space form in the system is expressed as follows [36]: In order to determine an optimal control input, the minimization of the cost function is needed as shown in Equation (55) [38], where Q is a positive semi-definite symmetric matrix and R is a positive definite symmetric matrix. Q and R weighting matrices are chosen to control each state effectively using little control effort according to the performance index in the following equation: The algebraic Riccati Equation (56) must be solved in order to calculate the optimal gain K [39], where the controller's gain K can be obtained using Equation (57) [40]. By using MATLAB software, gain K can be obtained using LQR (A, B, C, D, Q, and R) command. The gains of the controller are given in Table 4.

P-LQR controller
To improve the performance of the quadcopter control system, a hybrid controller called the P-LQR controller   was developed [41], as shown in Figure 6. This controller consists of the combination of the Proportional (P) controller with the LQR controller. This controller was designed by adding another close-loop as negative feedback in the LQR system. The LQR controller's gain K will be added with the P controller's gain K P and form negative feedback to the system. This type of controller can perform better than the conventional LQR controller by shorten the rise time and setting time and improved the RMSE. However, this controller tends to increase the overshoot response of the system [41]. The proportional gains used for this controller are shown in Table 5.

PD-LQR controller
The PD-LQR controller is the combination of the Proportional-Derivative (PD) controller with the LQR controller ( Figure 7). This controller was designed by adding another close-loop as negative feedback in the LQR system. The LQR controller's gain . . will be added with the PD controller's gain K P , K d and form negative feedback to the system. The PD-LQR controller was designed to improve the performance of the LQR controller and P-LQR controller in terms of its stability and overshoot response without affecting the desired output. PD controller was able to improve the response performance while maintaining the overshoot within a limit constraint [41]. The proportional and derivative gains in all states are given in Table 6.

PD2-LQR controller (Proposed controller)
The entire controller mentioned above can control the quadcopter; however, the autonomous UAVs need to have a fast response in rising time, settling time and very low overshoot. Besides, the steady-state error and RMSE must be close to zero as much as possible. Thus, various methods and approaches have been studied, and numerous simulations have been done. In all simulations done, it has been observed that the performance of the quadcopter could be improved by adding another Derivative (D) controller in the closed-loop as negative feedback in the PD-LQR controller system. The proposed controllers (Figure 8) are the combination of the proportional-double derivative (PD2) controller with the conventional LQR controller becomes the PD2-LQR controller. By tuning the proportional and derivative gains of the controller accurately,    Tables 8-12 in Section 5 shows that the proposed PD2-LQR controller can improve the quadcopter performance by reducing the rise time and settling time, the overshoot is within the limit constraint, and the steady-state error and RMSE are approximately close to zero as compared to other controllers. The gains used in this controller are shown in Table 7.

Simulation technique
In this section, the simulation technique used to determine the performance of each controller is discussed. First, the controllers' structure, as shown in Figures 3-8 was design using the Simulink block diagram. Then, a MATLAB program code was written to link up the MATLAB interface with the Simulink interface. Note that the simulation was run with a default sample time which is 0. The desired performance specification of the system is that, the overshoot requirement of the system aimed to be less than 10% [42] and the control precision to be lower than ±1% [43]. Moreover, the ideal performance for rising time, settling time, overshoot, steady-state error, and root mean square error (RMSE) to be close to zero as much as possible. The expected level of precision aimed to be ±0.001 s [44] due to its small size of the quadcopter. Each controller's gain parameters were tuned using the Gradient Descent Optimization method with Sequential Quadratic Programming [45], where this is an optimization algorithm based on a convex function with multi-variable parameters defined. This method refines its parameters iteratively to minimize a given function as far as possible to its local minimum and if the function satisfied within the pre-given constraint to ensure the convergence to a local minimum. Initially, the transfer function of the quadcopter and the initial gain parameters values must be defined. These gain values must be defined as a set or array of value with a lower and upper limit, where in this work we have set between ±150. Then, the limit constraint of the required step response must be defined so that if the function did not satisfy the requirement, it would automatically stop the searching, where in this work the upper bound is limit to amplitude of 1 with 1% overshoot and the lower bound is limit to amplitude of 0 for 0 < t < 0.5, 0.9 for 0.5 < t < 1, and 0.99 for 1 < t < 3. Next, the simulation to obtain the first set of gain value is executed. In this step, the gradient descent optimization method was used. At this stage, the optimum gain values that satisfy the constraint are being searched by iteratively adjusting the value until it finds the feasible solution that satisfy all constraints to within specific tolerances. After the first sets of gain values are obtained, these steps must be repeated to find a better step response with the optimum parameters gain.
The step for the optimization process is illustrated in Figure 9.

Result and discussion
In this section, the simulation result of all controllers in pitch, roll, yaw, and altitude motion are presented. In this research work, a countless effort is dedicated to finding a suitable controller with better performance on controlling the quadcopter. Conventional PID control, PD control, LQR control, P-LQR control, PD-LQR control, and PD2-LQR control algorithm are the six controllers assessed.

Pitching motion
The PID, PD, LQR, P-LQR, PD-LQR, and PD2-LQR controller in pitch motion response are shown in Figure 10. From the figure, the LQR controllers have the slowest response in terms of the rise time, while the  PD2-LQR controller is the fastest. The PID and PD controller has an excellent performance in overshoot and RMSE respectively compared to other controllers. Even though the PID controller outperforms the PD2-LQR controller in terms of overshoot it worth to mention that the overshoot of the PD2-LQR controller is still within the acceptable limit constraint less than 10% in overshoot. Table 8 present the comparison of the rise time, settling time, percentage overshoot, steady-state error, and RMSE of all the controllers in pitch motion. From Table 8, we can see that the PD2-LQR controller has the lowest rise time with only 0.11860 s, while the LQR controller is the highest with 0.28512 s. For the PD, PID, P-LQR, and PD-LQR controller, the rise time is 0.22726, 0.27697, 0.28436, and 0.27859 s, respectively. From these values, we can see that the percentage improvement of the PD2-LQR controller is as big as In terms of settling time, the LQR controller is the highest with 0.88143 s, and the P-LQR controller is the second highest with only 0.00137 s indifference which is 0.88006 s. The settling time of the PD controller is 0.40718 s, which is lower by 0.09616 s than the PID controller. The settling time of the PD-LQR controller and PD2-LQR controller are 0.50166 and 0.18235 s, respectively, which make the PD2-LQR controller has a better performance in term of settling time. In terms of overshoot, the PID controller has the lowest percentage overshoot as compared to other controllers with 0% overshoot. In comparison, the P-LQR controller has the highest percentage overshoot with 7.81045% then followed by the LQR, PD2-LQR, PD-LQR, and PD controller with 7.75500%, 0.91639%, 0.00872%, and 0.00055%, respectively. However, the percentage overshoot of the proposed PD2-LQR is still within a 10% constraint limit that can be acceptable.
The steady-state error value of the PD, PID, LQR, P-LQR, PD-LQR, and PD2-LQR controller are 0.00968, 5.36208e−5, 0.00394, 0.00087, 8.38531e−5, and 2.58940e−5, respectively. From these values, we can see that the PD2-LQR controller has the lowest steady-state error as compared to other controllers, while the PD controller has the highest steady-state error. The RMSE of the PD controller is the lowest with 0.25126, followed by the PD2-LQR, PD-LQR, P-LQR, LQR, and PID controller, respectively. The bold value in the table represents the best value of the respective controller with the respective response.
The comparison of the performance of the controller is made for all step responses, rise time, settling time, percentage overshoot, steady-state error, and RMSE. From the table, we can see that the proposed PD2-LQR controller is performing better than other controllers. In order to see in better display, the P-LQR controller and the PD2-LQR are compared; the rise time of the PD2-LQR controller is improved by 58.3%, 79.3% improvement in settling time was achieved by the PD2-LQR controller, percentage overshoot of the controller has improved by 88.3%, the minimization of the steadystate error is up to 97.0%, and the RMSE reduce by 17.4%. The result also shows that the percentage overshoot of the PD, PID, and PD-LQR controller are better than that PD2-LQR controller. However, the overshoot value of the PD2-LQR controller is still within the acceptable limit constraint. Thus, the performance of the quadcopter control system in the pitch motion can be improved using the PD2-LQR controller.

Rolling motion
The PID, PD, LQR, P-LQR, PD-LQR, and PD2-LQR controllers' response in the roll motion is shown in Figure 11. From the figure, the LQR controller has the slowest response in terms of the rise time and settling time, and highest steady-state error value while the PD2-LQR controller is the fastest. However, the PID controller has an excellent performance in overshoot, and the PD controller is best in RMSE compared to other controllers. Even though the PID and PD controller outperform the PD2-LQR controller in terms of overshoot and RMSE respectively, it is worth to mention that the overshoot of the PD2-LQR controller is still within the acceptable limit constraint less than 10% in overshoot, and the difference in RMSE is very small. Table 9 presents the rise time, settling time, percentage overshoot, the steady-state error, and RMSE of all the controllers in roll motion. The PD2-LQR controller has the lowest rise time with only 0.08388 s, while the LQR controller is the highest with 0.54730 s. For the PD, PID, P-LQR, and PD-LQR controller, the rise time is 0.24698, 0.28322, 0.30698, and 0.26790 s, respectively. So, the percentage improvement of the PD2-LQR controller is as high as 84.7% in the rise time compared to the LQR controller. In terms of settling time, the LQR controller also is the highest with 0.90246 s, followed by the P-LQR controller with only 0.0679 s indifference which is 0.83456 s. The settling time of the PID controller is 0.51770 s, which is higher than the PD controller by 0.07535 s. The settling time of the PD-LQR controller and PD2-LQR controller are 0.48197 and 0.13786 s, respectively, which make the PD2-LQR controller has a better performance in term of settling time than other controllers.
In terms of overshoot, the PID controller has the lowest percentage overshoot as compared to other controllers with 0% overshoot. In comparison, the P-LQR controller has the highest percentage overshoot Figure 11. Response of various controllers in roll motion. with 4.02312% then followed by the LQR, PD2-LQR, PD, and PD-LQR controller with 0.05790%, 0.04306%, 0.01195%, and 0.00045%, respectively. However, the percentage overshoot of the proposed PD2-LQR is still within a 10% constraint limit that can be acceptable. The PD2-LQR controller has the lowest steady-state error as compared to other controllers, while the LQR controller has the highest steady-state error. As for the proposed PD2-LR controller, the value is 1.21465e−6.
The RMSE of the PD, PID, LQR, P-LQR, PD-LQR, and PD2-LQR controller are 0.26446, 0.33522, 0.37263, 0.34307, 0.31744, and 0.28503, respectively, which make the PD controller has the lowest RMSE. However, the difference between the PD and PD2-LQR controller is minimal, which is 0.02057; thus, it still can be accepted.
Overall, the proposed PD2-LQR controller is performing better than other controllers. In comparison between the PD-LQR and the PD2-LQR controller; the rise time of the PD2-LQR controller is improved by 68.7%, 71.4% improvement in settling time was achieved by the PD2-LQR controller, percentage overshoot of the controller has improved by 98.9%, the difference of the steady-state error between the PD-LQR controller and PD2-LQR controller is minimal thus the value can be negligible, and the RMSE reduce by 10.2%. The result also shows that the percentage overshoot of the PID, PD, and PD-LQR controller is better than that PD2-LQR controller. However, the overshoot value of the PD2-LQR controller is still within the acceptable limit constraint. Thus, the performance of the quadcopter control system in the roll motion can be improved using the PD2-LQR controller.

Yawing motion
The apparent response comparison of the PID, PD, LQR, P-LQR, PD-LQR, and PD2-LQR controller in yaw motion is shown in Figure 12. From the figure, we can see that the PD-LQR controller have the slowest response in terms of the rise time and settling time, while the PD2-LQR controller is the fastest. However, the PD2-LQR controller has slightly increased in steady-state error compared to PD controllers, but for the other controller, PD2-LQR still performs better. Though PD controller outperforms the PD2-LQR controller in terms of steady-state error, it is worth to  mention that the steady-state error of the PD2-LQR controller is still within the acceptable limit constraint, plus the value differences are minimal that can be approximated to zero. Table 10 presents the rise time, settling time, percentage overshoot, steady-state error, and RMSE of all the controllers in yaw motion. The PD2-LQR controller has the fastest rise time response with only 0.06103 s, while the PD-LQR controller has the highest response with 0.31452 s. For the PD, PID, LQR, and P-LQR controller, the rise time is 0.28114, 0.10479, 0.27685, and 0.31195 s, respectively. From these values, the percentage improvement of the PD2-LQR controller is as big as 80.6% in the rise time compared to the PD-LQR controller.
In terms of settling time, the PD-LQR controller also is the highest with 0.55901 s, and the P-LQR controller is the second highest with only 0.00123 s indifference, which is 0.55778 s. The settling time of the PD controller is 0.50296 s, which is higher than the PID controller by 0.3143 s. The settling time of the LQR controller and PD2-LQR controller are 0.49542 and 0.11072 s, respectively, which make the PD2-LQR controller has a better performance in term of settling time than other controllers.
From these values, the PD controller has the lowest steady-state error as compared to other controllers, while the P-LQR controller has the highest steady-state error. As for the proposed PD2-LR controller, the value can be approximated to zero since the differences in the value are very small. The RMSE of the PD2-LQR controller is the lowest with 0.14441 followed by the LQR, P-LQR, PID, PD, and PD-LQR controller, respectively.
Generally, the proposed PD2-LQR controller is performing better than other controllers. In comparison between PD-LQR controller and the PD2-LQR, the rise time of the PD2-LQR controller is improved by 80.6%, 80.2% improvement in settling time was achieved by the PD2-LQR controller, percentage overshoot of the controller has improved by 100%, the difference of the steady-state error between the PD-LQR controller and PD2-LQR controller is minimal thus the value can be negligible, and the RMSE reduce by 34.3%. Thus, the performance of the quadcopter control system in the yaw motion can be improved using the PD2-LQR controller.

Altitude motion
The apparent response comparison of the PID, PD, LQR, P-LQR, PD-LQR, and PD2-LQR controller in altitude motion are shown in Figure 13. From the figure, we can see that the PD and LQR controller has the slowest response in terms of the rise time and settling time respectively, while the PD2-LQR controller is the fastest in rising time and settling time. However, the PD2-LQR controller also has slightly increased in overshoot and steady-state error compared to the PID and PD-LQR controller with 0% overshoot. Though the PID and PD-LQR controller outperforms the PD2-LQR controller in terms of overshoot, the PD2-LQR controller is still within the limit constraint of 10%. Other than that, PID also has the lowest value of steady-state error with only 8.08649e-11, while the PD2-LQR with 0.00034. As for the RMSE, the PD2-LQR controller outperformed the other controllers.
The rise time, settling time, percentage overshoot, steady-state error, and RMSE of all the controllers in altitude motion are presented in Table 11. Here, the Figure 13. Response of various controllers in altitude motion. In terms of settling time, the LQR controller has the highest settling time with 1.08887 s, and the P-LQR controller is the second highest with only 0.10422 s indifference which is 0.98465 s. The settling time of the PID controller is 0.53652 s, which is higher than the PD controller by 0.00981 s. The settling time of the PD-LQR controller and PD2-LQR controller are 0.56058 and 0.08132 s, respectively, which make the PD2-LQR controller has a better performance in term of settling time than other controllers.
From these values, the PID controller has the lowest steady-state error as compared to other controllers, while the LQR controller has the highest steady-state error. As for the proposed PD2-LR controller, the value can be approximate to zero since the value is minimal. The PD2-LQR controller has the lowest RMSE with 0.25820 and followed by the LQR (0.31462), P-LQR (0.34269), PD-LQR (0.35388), PD (0.41045), and PID (0.42895) controller, respectively.
Collectively, the proposed PD2-LQR controller is performing better than other controllers. When the PD-LQR controller and the PD2-LQR are compared, the rise time of the PD2-LQR controller is improved by 84.5%, 85.5% improvement in settling time was achieved by the PD2-LQR controller. The difference in percentage overshoot of the controller is minimal and still within the limit; thus, it still can be acceptable. The steady-state error was improved by 95.6% and the RMSE reduce by 27%. Therefore, the performance of the quadcopter control system in attitude motion can be improved using the PD2-LQR controller.

Summary of findings
In the previous subsection, the simulation result of the PD, PID, LQR, P-LQR, PD-LQR, and PD2-LQR controller in all four motions, pitch, roll, yaw, and altitude have been presented and discussed. From all the controller design approaches, a comparative study has been done to elucidate a collective performance. The comparisons of the entire controller in all motion and percentage improvement of PD2-LQR controller against other controllers are presented in Table 12. In summary, the result shows that the PD2-LQR controller has a better performance in all motions in most of the step responses than other controllers.
From Table 12, we can see that the PD2-LQR controller can perform better than the other controllers in terms of rising time in all motion. In an average of 69.35% improvement can be made if the proposed PD2-LQR controller is used to stabilize the quadcopter.
In terms of settling time, the performance of the PD2-LQR controller is excellent since it can improve all the responses in all motions. The proposed PD2-LQR controller can improve the settling time up to 76% on average. For the overshoot response, the PD2-LQR controller gives a better improvement than most of the other controllers. In an average of 15.7% improvement in overshoot can be achieved using the PD2-LQR controller. However, in pitch motion, the PD, PID, and PD-LQR controllers outperformed the PD2-LQR controller by 99.9%, 100%, and 99.1% improvement, respectively. In contrast, in roll motion, the PD, PID, and PD-LQR controllers give better improvement with 72.4%, 100%, and 98.9%, respectively than PD2-LQR. Though the PD, PID, and PD-LQR controllers are outperformed the PD2-LQR controller in pitch and roll motion, the overshoot of the PD2-LQR controller is still within the acceptable limit constraint that is less than 10% in overshoot.
In pitch motion, the PD2-LQR controller gives an outstanding result in steady-state error compared to PD, PID, LQR, P-LQR, and PD-LQR with 99.73%, 51.7%, 99.3%, 97.0%, and 69.1% improvement, respectively. In roll motion, the steady-state error was improved by 99.8% on average using the PD2-LQR controller. In yaw motion, only the PD controller outperformed the PD2-LQR controller with 65.2% improvement in steady-state error but compared to the PID, LQR, P-LQR, and PD-LQR controllers it still lags by 96.1%, 98.9%, 99.8%, and 99.8%, respectively. In altitude motion, only PD and PID controller outperforms the PD2-LQR controller with both 99.9% improvement in steady-state error. However, the value of the steady-state error in all motion is minimal between the proposed PD2-LQR controllers with the other controllers. Therefore, the value of the steady-state error for the entire controllers can be approximated to be zero. Lastly, in terms of RMSE, only in roll motion where the PD controller outperforms the PD2-LQR controller with only 7.2% improvement. For the others, PD2-LQR gives an excellent performance than the other controllers. In average, a 69.5% improvement can be made if the proposed PD2-LQR controller is used in all motions.

Conclusion
In this paper, modelling and control of the quadcopter in all four motions, pitch, roll, yaw, and altitude have been done. The dynamic model of the quadcopter used in this research was derived based on the Newton-Euler approach. Six controllers, including the proposed controller, namely PD, PID, LQR, P-LQR, PD-LQR, and PD2-LQR controllers, have been designed to access how it stabilizes the quadcopter. Their performance in terms of rising time, settling time, percentage overshoot, steady-state error, and RMSE has been compared to find the best-suited controller for the quadcopter. The simulation results show that the proposed PD2-LQR controller was able to improve the performance of the quadcopter in almost all step responses than other controllers. Though some controllers can outperform the PD2-LQR controller in certain responses, it is worth to mention that the differences between those values are minimal and some of them can be approximately equal to zero. Plus, all responses of the PD2-LQR controller is within the acceptable limit constraint. Therefore, based on this result, the proposed PD2-LQR controller is suitable to be used to controlling the quadcopter in all pitch, roll, yaw, and altitude motion.