Attitude and Altitude Control of Quadrotor Carrying a Suspended Payload using Genetic Algorithm

T he need for quick airborne transportation is critical, especially in emergencies. Drones with suspended payloads might be used to accomplish quick airborne transportation. Due to the environment or the drone's motion, the slung load may oscillate and lead the drone to fall. The altitude and attitude controls are the backbones of the drone's stability, and they must be adequately designed. Because of their symmetrical and simple structure, quadrotor helicopters are one of the most popular drone classes. In this work, a genetic algorithm with two weighted terms fitness function is used to adjust a Proportional-Integral-Derivative (PID) controller to compensate for the altitude and attitude controllers in a quadrotor drone with a slung load.


INTRODUCTION
Uncrewed Aerial Vehicles (UAVs), also known as drones, are airborne robots that have been related to defense uses in the past. UAVs may now be employed for civilian jobs such as carrying medications, parcels, and other products in containment zones in the COVID-19-affected region, developing precision agriculture, surveillance, sensor technologies, and communication owing to technical improvements in disaster-stricken areas ( Because the quadrotor is a nonlinear, highly coupled, Multiple-Input, Multiple-Output (MIMO), and underactuated system, improving its underactuated or unstable behavior is difficult. Furthermore, the slung load transportation is a challenge that might disrupt the quadrotor model, causing the controllers that were developed based on the current model to break down and the quadrotor to crash. These difficult issues impede payload transfer in real-world applications and restrict the operation of the system (Raptis and Valavanis, 2010), (Jain et al., 2015), (Bangura and Mahony, 2012) and (Najm and Ibraheem, 2019). When there is a variation in the system operational range, a PID controller that is mainly used due to its simplicity will not deliver a satisfactory response. As a result, soft computing-based PID controller adjustment has been frequently advocated by researchers in recent years ( To achieve effective reference tracking and the slung load force effect mitigation control in the quadrotor with a suspended payload system, strong heuristic algorithms like GA must be used to tune the PID parameters. Because the delivery aspect of quadrotor uses is so important, several studies have sought to help improve implementation accuracy. Wire package lifting is divided into three phases (Cruz and Fierro, 2017): "setup, pull, and raise". Every one of those states illustrates the quadrotor with load dynamics at different stages of operation. They built a composite system that relies on these phases, proving that it's a reasonably flat composite system. They utilized this property to build a path using a series of connected waypoints for each mode.
A back-stepping approach is used to create a nonlinear controller that assures tracking of a path of the copter independent of the payload motion. Also, the error's source in tracking is shown to be globally absolutely stable (Klausen, Fossen, and Johansen, 2017). An adaptive controller is created by (Dai, Lee and Bernstein, 2014) for a quadrotor helicopter with a suspended payload by use of an elastic wire that is joined in a succession of stiff connections, then to correct for the load mass effect, a retroactive cost adaptive controller is utilized, and a static gain nonlinear PD controller is provided to get the needed performance for a specified load mass. (Mosco-Luciano, Castro-Linares, and Rodriguez-Cortes, 2020) constructed a linearizing saturated regulator for altitude and then utilized the back-stepping technique to create a feedback loop controller. However, the letter's weak point is the altitude controller, which is linearization-based, limiting the controller's capabilities in the actual physical system. (Hashemi and Heidari, 2020) and (Alothman, Jasim, and Gu, 2015) proposed an optimal control technique for carrying and transporting the packages utilizing a linear quadratic regulator (LQR) control approach. Although LQR provides resilient stability with a reduced energy-like performance index and is also extremely computationally efficient in linear systems, it can never operate in nonlinear systems unless the system is linearized, which can lead to system failure in various circumstances. Genetic Algorithms (GA) have been used to address tuning a PID controller (Ünal Erdal, and Topuz, 2012), (Mirzal, Yoshii, and Furukawa, 2012), (Khuwaja et al., 2018). This work designed proper attitude and altitude controllers using a GA with different parameters. The GA is used to optimize the PID gains that minimize the desired objective function composed of two terms. The first one is an integral square error that enables the algorithm to sense the transient response. The second is a time product integral part that makes the algorithm capable of treating the system's steady-state response when the error approaches zero. Optimized factors weight the two terms.

SYSTEM MODELING
This section goes through creating a mathematical model of the understudying system that is a quadrotor helicopter lifting a slung load. A quadrotor is a helicopter with four engines and propellers attached to it. It is extremely well designed with a cross (X) arrangement style. Each motor rotates clockwise and counter-clockwise in the same manner. This arrangement of opposing pairs eliminates the requirement for a tail, which is required for stability in traditional helicopter structures (Nizar Hadi and Ahmed Ramz 2018). The quadrotor with a slung load system is considered as two rigid bodies connected by a massless wire. This section's modeling method aims to provide a systematic analytical formulation for a quadrotor with a slung payload that can be utilized to improve UAV control performance (Valavanis and Vachtsevanos, 2015), (Johnson, 2017). Fig. 1. depicts the quadrotor understudying with a suspended payload. The six quadrotor dynamical motions are represented by six equations, three of which are translational and represent quadrotor displacements in the X, Y, and Z axes. The following three movements are rotational motions, which reflect rotations about the three axes specified in equations (1)-(6).

Journal of Engineering
where x, y, and z are the quadrotor's translational locations. The Euler angles are , , and for pitching, rolling, and yawing movements in radians, respectively. The mass of the UAV is M; , , and are the moments of inertia about the quadrotor Center of Mass (COM), and l is the distance between the rotor and the COM. The force components generated by the payload are , , and . Fig. 2 has the following definitions: Journal of Engineering Volume 28 May 2022 Number 5 , are the payload angles in radian as in Eq. (14) and Eq. (15), is the payload mass.
1 , 2 , 3 , and 4 are the system inputs which could be defined as follows: The forces and moments created by the four rotors that make up the system input, 1 , 2 , 3 , and 4 are proportional to the square of the rotor's rotating speed. The overall thrust created by the UAV is 1 which is equal to the algebraic sum of each rotor's thrusts. 1 and 2 indicate the roll torque and pitch torque, respectively. The yaw moment is represented by 3 (moment about the zaxis). 4 variations modify the yaw motion while keeping 1 constant.

Figure 2. Payload induced forces analysis.
The payload is modeled as a three-dimensional point mass pendulum (Spherical Pendulum) with a two-degree of freedom dynamics. The payload is asymptotically stable, but reaching equilibrium takes time, depending on the payload mass, starting quadrotor speed, friction, and other factors (Valavanis and Vachtsevanos, 2015). During this time, it oscillates, and three forces, , , and , change in a sinusoidal manner, as given in equations (7), (8), and (9) respectively. The payload angles ( , ) can be derived using the Lagrange method which finally gives the angular accelerations (̈, ̈) . The formulas of these accelerations are complex, with many trigonometric The quadrotor model used in this work is the F450 model, where its parameters are tabulated in Table 1.

CONTROL STRATEGY
Quadrotors are inherently unstable systems, necessitating the selection of a suitable controller not only to stabilize the system but also to enhance system performance metrics like rising time, settling time, maximum overshoot, and steady-state error. A slung load is also present, which may cause oscillations that impair the UAV's stability or possibly the payload itself. As a result, effective feedback controllers are necessary for managing the now eight-degree-of-freedom system: the quadrotor has six degrees of freedom, and the payload has two degrees of freedom. There are usually two or three control loops in quadrotor feedback control: an inner controller for attitude, an outer controller for position or velocity, and an optional independent controller for altitude control. Inner feedback loop controllers should have a quick reaction (often a critically damped response) and a short rise time (PD or PID controllers). The overall system block diagram is shown in Fig. 3.

Classical PID Controller
A PID controller is a closed-loop system control technique in which the controlled system's output follows the intended set point. PID controllers continue to be frequently utilized in the industry because no other advanced control schemes, such as Sliding Mode Control (SMC), Model Predictive Control (MPC), or internal model control (IMC), can match its simplicity, flexibility, and ease of use. They may be used to control both simple and complicated systems. Fig. 4 depicts a generic block diagram for the PID controller. 32 frequency-response model can all be used to describe the system. One may examine and visualize system behavior in the time and frequency domains using applications and functions like step response plot and Bode plot. In this study, the MATLAB control toolbox will be used to tune the inner-loop controllers while it's not capable of doing that for the outer-loop because in this case, the system is not linearizable. So, the trial-and-error approach is used to adjust the outer-loop controllers 3.2 Genetic Algorithm (GA) A GA is an optimization approach based on natural selection, which is the driving force behind biological growth. The GA iteratively modifies a population of candidate solutions. At each level, the GA randomly selects parents from the existing population and uses them to create the offspring of the next generation. Over several generations, the population evolved toward an optimal solution. Many optimization problems that aren't well suited for classic optimization approaches, such as those with discontinuities, stochastic non-differentiable, or highly nonlinear objective functions, can be solved using the GA. GA is also used to set the parameters of a PID controller. The GA steps can be summarized as follows (Jayachitra and Vinodha, 2014): Step 1: A population of random solutions is created for the parameter, such as crossover rate, mutation rate, number of clusters, and generations. The coding mode is determined.
Step 2: The fitness function's value is calculated and assessed.
Step 3: The new cluster is compiled using crossover and mutation operations Step 4: Step 2 is repeated till the best result is achieved. Or it can be described in the flowchart shown in Fig. 5. Instead of considering parameters directly, GA work with a population of strings or chromosomes. As a result, the controller parameter vector should be coded to a string named chromosome to address our problem. Many optimization problems that standard approaches fail to address are thought to be solved by the binary genetic algorithm. However, in the case of a problem, the variables' values are decimal and must be described to the full machine precision. Individual variables in such a problem require multiple bits to express them. If the number of variables is large, the chromosome will be enormous (Kubba and Esmieel, 2018). Also, because binary encoding discards the parameter value if it exceeds its precision capacity, encoding is done in real numbers (Double Vector) rather than binary.
, , , , are five parameters on each chromosome, where , are the objective function weighting parameters as the next section would show. There are many cases where convergence cannot be achieved if the parameter value bounds are set arbitrarily, despite the optimal results being within those bounds range. The bounds of the three PID parameters , , should be set according to the values that we got from the classical tuning to ensure convergence.
, bounds will be discussed in the objective function section. Each generation's population is represented by an 80 x 6 matrix, with each row representing a chromosome consisting of , , , , and the last column is added to accommodate fitness values (F) of related chromosomes. Fitness is a criterion for assessing the fitness of a chromosome. According to the survival of the fittest idea, a chromosome with a fitter value has a better probability of producing offspring in the next generation. The performance requirements are linked to the fitness function using a GA, and optimum PID gains are generated by optimizing OF to its minimal value. The primary operator of the GA is reproduction. It is based on the "survival of the fittest" idea. Each generation, the chromosome of the existing population is replicated or duplicated into the next generation. The GA's search for the fittest individuals is guided by reproduction. The crossover (sometimes Xover) stage is used to mix the information of any two chromosomes in the population via a probabilistic choice and to offer a method for mixing chromosomes at the splice site. When one superior gene begins to dominate after a few generations in GAs, the genetic diversity tends to become more homogenous over time, resulting in the convergence rate of a nonoptimal solution. To overcome this undesirable convergence, another genetic operator should be included in the GA, which is the mutation that is applied with a specified probability.

Genetic-PID Controller
Nonlinear, complicated, partially known plants can be controlled using genetic-PID controllers. Genetic-PID controllers are controllers that use GAs to design their parameters. Indeed, traditional tuning methods such as Ziegler Nichols methods could be used to tune the parameters in a PID control scheme. When working with complicated or nonlinear systems, however, these traditional methods, if applicable, are found to produce poor results and be time-consuming. As a result, Genetic-PID control has become popular due to the difficulty of tuning PID controllers in a nonlinear situation. In this work, the attitude and the altitude PID controllers' parameters will be adjusted using a GA with a specific Objective Function (OF). OF is composed of two terms; an Integral Square Error (ISE) and an Integral Time multiplied by Square Error (ITSE) part with different weighting coefficients. The ISE term is to improve the transient response where the time is still short, while the ITSE term treated the system's steady-state response when the error value became insignificant. OF can be formulated as follows:

Journal of Engineering
Where and are the weighting coefficients that will be optimized by the algorithm. The number of variables that be optimized is eight; ( , , , , ) and ( , , , , ) The block diagram of the genetic-PID controller is illustrated in Fig. 6. The characteristics of the genetic-PID controller are found in Table 2.

RESULTS AND DISCUSSION
After initializing the GA with 200 generations, it's noticeable that OF started to converge after 160 generations. As shown in Fig. 7, the final convergence is about 10.7432. The Genetic-PID parameters are tabulated in Table 3 and Table 4. Before that, the classical PID controller's gains are tuned, and its parameters are tabulated in Table 3. Figure 7. The GA convergence curve. The results from the Genetic-PID showed a significant improvement in the system response. For instance, the peak overshoot in the attitude is damped from 37.1929% to 4.3558%. The quadrotor altitude in the case of the Genetic-PID controller is settled at 4.2505 seconds, but in the case of using the classical PID controller, the system never settled because of the significant effect of the payload oscillations. The only drawback is that the rise time is extended from 1.43246 seconds to 1.5862 seconds which is an expected action because the system has damped. The steady-state error has been improved by 59.9648%. The overall time response parameters of the attitude controller are shown in Table 5. Where refers to the settling time. The altitude and attitude output signals are shown in Fig. 8  and Fig. 9, respectively.

CONCLUSIONS
Journal of Engineering Volume 28 May 2022 Number 5 38 The altitude controller is noticed to be highly sensitive because the values of the PID gains are significantly large. On the other hand, the two attitude controllers are less sensitive; however they have to damp the overshoot as possible because they represent the x,y outer loop cascaded stage, and they need to be fast. In the GA fitness function or the objective function OF choice in such a way enables the PID controller to maintain the transient and the steady-state response, and one can note that the algorithm is relatively given priority to the ITSE part in the objective function which is greater than the . Finally, it's concluded that the genetic PID is better than the classical PID controller in canceling the payload force effect, which fluctuates with time.