Trajectory planning of unmanned aerial vehicle based on the improved biogeography-based optimization algorithm

This paper is concerned with trajectory planning for unmanned aerial vehicle in a three-dimensional complex workspace. Biogeography-based optimization algorithm is widely used in solving practical problems because of its fewer parameters, fast convergence rate, and good global optimization ability. In this paper, some improvements, modifying migration and mutation operations are made on the biogeography-based optimization algorithm to make it suitable for solving the trajectory planning problem. The optimal trajectory obtained by the improved algorithm can be used to generate the reference trajectory. Then, a control scheme of unmanned aerial vehicle based on the Lyapunov theory and radial basis function neural network is formed to track the reference trajectory. The improved trajectory algorithm generates the shortest trajectory and the time consumption is the lowest. Finally, the designed control scheme makes the unmanned aerial vehicle track the different trajectories quite well, the effectiveness of it can be illustrated by algorithm accuracy and electricity consumption.


Introduction
Unmanned aerial vehicle (UAV) is often seen for reconnaissance, search, and rescue missions in dangerous areas because of its high mobility, low risk, and low cost. 1,2 In order to ensure the efficiency and safety of UAV in the task completion, it is usually necessary to estimate an optimal flight trajectory before a mission execution. The trajectory planning for UAV in complex environments to avoid a series of obstacles is really a challenging problem. For these reasons, UAV trajectory planning has become a research hotspot. [1][2][3][4][5][6] Samaniego et al. 7 regarded the space of UAV flight as a discrete adaptive grid with minimum step size, and used cost response algorithm and recursive calculation to conduct trajectory planning, which reduced the response time, Lupascu et al. 8 extended the square in two dimensions to the cube in three dimensions for trajectory planning, and demonstrated the feasibility of the algorithm. Contreras-Cruz et al. 9 trajectory planning in a static environment using artificial bee colony algorithm was proposed. Firstly, artificial bee colony algorithm was used to explore the local environment, and then evolutionary algorithm was used to obtain the optimal trajectory. Li et al. 10 used the balance strategy to make an improvement on the artificial bee colony algorithm, and collected the convergence information in the iterative process to control the exploration accuracy, so as to achieve a balance between local and global information. Particle swarm optimization algorithm with dynamic adjustment of inertia weight (WLIPSO) used in Lu et al. 11 initialized a swarm of particles with a random solution. The cooperation and competition ideas were introduced to update its speed and it found the optimal solution by searching for the personal best and the global best. However, in the late stage of the convergence, the convergence speed becomes slow, all particles tend to be the same and lose diversity. When the algorithm converges to a certain degree, it cannot be further optimized and the accuracy it can achieve is not high. Biogeography-based optimization with covariance matrix based migration (CMM-BBO) 12 is a novel evolutionary algorithm. The covariance matrix based migration operator combined with the original migration randomly, thus the population diversity is increased. CMM-BBO can get the optimal solution of the shortest trajectory, but it is inefficient because it traverses many nodes and performs many repeated operations. The above algorithms have some disadvantages, with the expansion of the planning area, their computational complexities will increase exponentially, resulting in a ''combinatorial explosion,'' and they are prone to fall into local optimal solutions, which needs to be avoided. Compared with these algorithms, the improved BBO algorithm can deal with the uncertainty in trajectory planning more effectively and improve the reliability of trajectory planning and the stability of the system.
Biogeography-based optimization (BBO) algorithm, proposed in Simon, 13 is a global optimization algorithm that studies the distribution of organisms in geographical areas. It uses migration operation to realize information sharing among solutions (habitats) and uses mutation operation to enrich the population diversity in habitats. 14 It describes the migration, formation, and extinction of species by the mathematical model based on biogeography. 15 The improved BBO algorithm is similar to particle swarm optimization (PSO) algorithm, ant colony optimization algorithm, and genetic algorithm, but it has fewer designed parameters, low computational complexity, and strong optimization performance. 3,13,16,17 According to the grid-based workspace modeling algorithm in Zhang et al., 18 Islam et al., 19 and He et al., 20 the UAV's workspace is divided into a series of small blocks by using grids through the threedimensional space, and the vertices of each block are selected as trajectory nodes. Mark these nodes as collision and collision-free nodes by determining whether they are in obstacles or not. 21,22 Simply select a series of available trajectory nodes (collision-free nodes) in a certain order and put them into a trajectory node list, that list consists of some available trajectories. Each available trajectory can be regarded as a habitat in the biogeography algorithm, and its nodes can be regarded as suitability index variables (SIVs) 23 of the habitat. The habitat suitability index (HSI) 24 of each habitat can be obtained by taking its nodes as parameters into the cost function calculations. According to the obtained HSIs, the immigration rate, emigration rate, and mutation probability corresponding to each habitat can be calculated, which can be used for the migration operation and mutation operation. 25,26 Finally, the optimal trajectory is generated. In particular, an improved migration and mutation operation is proposed in section 2.D for UAV trajectory planning. In addition, WLIPSO and CMM-BBO algorithm are used to complete the task of the UAV trajectory planning in the same workspace, and then compared with the proposed algorithm.
The optimal trajectory generated by the proposed biogeography algorithm can be used to generate the flight reference trajectory for UAV. Then, a fixed-wing UAV mathematical model under external interference is constructed and selected as the research object. 27 Finally, according to the generated reference trajectory, a robust controller designed based on Lyapunov stability theory and radial basis function neural network (RBFNN) 28,29 is used for the fixed-wing UAV tracking the reference trajectory.
Our main contributions are summarized as follows: In this paper, the algorithm of setting collision nodes is used in the 3D workspace to model the UAV operation environment, which effectively improves the operation efficiency of the trajectory planning algorithm in the 3D workspace. The novel trajectory planning algorithm based on biogeography algorithm improves the migration and mutation operations compared with the original biogeography algorithm, making it more suitable for UAV trajectory planning. According to the trajectory generated by the improved BBO algorithm proposed in this paper, an interpolation algorithm based on time step is designed, which can convert the discrete points in the workspace to a relatively continuous trajectory, and can effectively realize the UAV's accurate tracking of the reference trajectory after combining with the designed UAV control scheme.
The arrangement of this paper is made as follows: In section 2, the improved trajectory planning algorithm based on BBO in the 3D workspace is presented. We give the mathematical model of the UAV in section 3. The control scheme of UAV with the planned trajectory is proposed in section 4. Section 5 presents the experimental details and shows the effectiveness of the improved BBO algorithm and the control scheme. We give a conclusion in section 6.
The improved trajectory planning algorithm based on BBO in threedimensional environment For ease of expression, the following notations are exploited in this paper: (1) R denotes a real constant space, R n denotes an n-dimensional real vector space, R m 3 n represents an m 3 n-dimensional real matrix pace. (2) T represents the transpose operation of a matrix, k k represents the Euclidean norm of a matrix and can be expressed as ffiffiffiffiffiffiffiffiffiffiffiffiffiffi tr( T ) p , and tr() represents the trace of a matrix.
(3) There exists a pseudo inverse in a non-full rank matrix M 2 R m 3 l , m 6 ¼ l, such that MM + = I m . 30 BBO is a biology evolutionary algorithm using biogeographic dynamic models and ideas that describe the movement of species from habitat to habitat in an ecosystem and how species are created or lost. 31 In BBO, each habitat resembles an island in the sea, is regarded as a possible solution and has a HSI to test the suitability and the priority of the habitat. Other aspects, for example, plant and animal diversity, rainfall capacity, etc., which characterize HSI are called SIVs. 31,32 In the following proposed BBO based trajectory optimizing process, the habitat is considered as the trajectory in the trajectory planning, a SIV of each habitat as a route node, the HIS of each habitat as the cost function.

The construction of the UAV's workspace
The first step of the vehicle's trajectory planning in three-dimensional space is to construct the vehicle's work environment in a meaningful way. According to He et al. 20 and Garrido et al., 33 the grid-based workspace modeling algorithm is introduced to describe the vehicle's workspace. As shown in Figures 1 and 2, this algorithm cuts the UAV's workspace into n x 3 n y 3 n z blocks (n x , n y , and n z are the number of cutting layers on the x, y, and z axes, respectively), the vertexes of each block are selected as the trajectory node, and the nodes in obstacles are defined as collision nodes, 34 which means that UAV cannot pass through them. On the contrary, UAV can plan a trajectory from start to end by constructing a list only containing collision-free nodes.
A trajectory generation algorithm based on the constructed workspace Before operating BBO algorithm, some initial trajectories need to be generated randomly so that they can be used as initial habitats in BBO to facilitate the formation of optimal trajectories by immigration, mutation, and other operations.
As shown in Figure 3, according to the construction algorithm of UAV's workspace described above, the node where the UAV is currently located can be marked as node(i), the i-th node in UAV's constructed  workspace, i 2 ½1, 2, :::, n x Ã n y Ã n z . Where n x , n x n x are the number of UAV's workspace cutting layers on xaxis, y-axis, and z-axis in the inertial coordinate frame, respectively. The adjacent nodes on its x, y, and z axes can be marked as node(i 2 1), node(i + 1), node(i 2 n y ), node(i + n y ), node(i 2 n x 3 n y ), and node(i + n x 3 n y ), respectively.
The steps of the trajectory generation algorithm are as follows: Step 1. A trajectory node list PL is initialized as an empty list; the iteration times IR is initialized as zero, the maximum iteration times is set as IR max ; the current node and goal node is initialized as node(i) and node(j), i, j 2 ½1, 2, ::, n x Ã n y Ã n z , respectively; an available node set VS is initialized as an empty set.
Step 2. Firstly, the node(i) is selected into PL; Then, judging whether node(i) or node(x) is a collision node, if it is, return error information, else, obtain the three-dimensional position of node(i) and node(j), which is (x i , y i , z i ) and (x j , y j , z j ), respectively. Here, x, y, and z are x-axis position, y-axis position, and zaxis position in the inertial coordinate frame, respec- there is no node on the x-axis of node(i) can be selected. If y j .y i , node(i + n y ) is selected into VS, else if y j \y i , node(i 2 n y ) is selected into VS, else, there is no node on the y-axis of node(i) can be selected. If z j .z i , node(i + n x 3 n y ) is selected into VS, else if z j \z i , node(i 2 n x 3 n y ) is selected into VS, else, there is no node on the z-axis of node(i) can be selected.
Step 3. Firstly, the collision nodes in VS is eliminated; then, one node in VS is randomly selected as the next position of UAV; particularly, an adjacent node of node(i) that is not collision node is randomly selected as the next position of UAV, when there is no node in VS. The randomly selected node is set as node(k), and IR = IR + 1.
Step 4. To avoid duplicate nodes in PL, node(i) is set as a collision node, then the selected node in Step 3 is set as the current node by letting i = k. If threedimensional position of the current node is equal to goal node or IR . IR max , save the trajectory list PL and return success information, else, skip to Step 2.
To illustrate the trajectory generation algorithm visually, all available trajectories generated from the current node to the goal node are shown in Figure 4.

Cost function
In the process of UAV trajectory planning, choosing an optimal trajectory is the ultimate goal. Usually, there is a cost function to measure whether the current trajectory is optimal. If the algorithm has a small value of cost function, then the computational complexity is small. Compared with other trajectories, the generated trajectory with the smallest value of cost function will be considered as the optimal trajectory. 5 The cost function is defined as follows: In the cost function, N number represents the number of nodes in the trajectory's node list.
The term related to the length of the planned trajectory is represented as follows:  Where pos(i) = x i y i z i ð Þ, i 2 1, 2, :::, N number ½ is threedimensional position of the node(i) in the trajectory node list.

The migration and mutation operation
Migration. The i-th habitat PL i (a trajectory node list of the i-th habitat) and j-th habitat PL j (a trajectory node list of the j-th habitat) are selected for immigration and emigration operation respectively, i, j 2 1, 2, ::, Np ½ , where Np is the number of habitats or trajectories. Before the migration operation, in order to improve the diversity of species in each habitat, if there is a same node node(k), k 2 ½1, 2, :::, n x Ã n y Ã n z , between PL i and PL j , all nodes in PL i after node(k) will be cleared. Then, node(m) is randomly selected from PL j and use it as the start node to generate a new trajectory to the goal node by using the trajectory generation algorithm proposed in section 2.B. Similarly, node(p) is randomly selected from PL i and use it as the start node to generate a new trajectory to node(m). In the end, clear the node(p) and all subsequent nodes in PL i and put the two new generated trajectories into PL i .
Mutation. The i-th habitat PL i is selected for mutation operation. Firstly, a node node(m) that is not a collision code is randomly selected from the UAV's workspace in Figure 2 and use it as the start node to generate a new trajectory to the goal node by using the trajectory generation algorithm, then, similarly, node(p) is randomly selected from PL i and use it as the start node to generate a new trajectory to the node(m). In the end, clear the node(p) and all subsequent nodes in PL i and put the two new generated trajectories into PL i .

An improved BBO algorithm
Each habitat has its specific emigration rate m k and immigration rate l k in BBO, 13,32 which are the functions of the HSIs in habitats and can be represented as follows: Where E and I denote the maximum value of the emigration and immigration rate, respectively. F k cost is the k-th habitat's cost function, and F maximum cost = max ½F 1 cost , F 2 cost , :::, F Np cost . Now, the variable P k denotes the probability of the habitat's population migration, and can be updated as P k = P k + _ P k , and according to Mo and Li 32 and Huang et al., 35 the updating laws of the probability _ P k are defined as: The mutation probability m k for each habitat's population is defined as: Where k 2 1, 2, :::, Np ½ , P max = max P 1 , P 2 , ::, P Np Â Ã . The steps of the improved BBO algorithm are summarized as follows: Step 1. The trajectory generation algorithm proposed in section 2.2 is used to randomly generate Np trajectories, which are used as the initial habitats, between the start node and the goal node. These parameters are initialized: the max emigration rate E, the max immigration rate I, the probability P k , and the mutation probability m k of each habitat. In the end, the iteration times NR of the improved BBO algorithm is initialized as zero, the maximum iteration times is set as NR max .
Step 2. The cost function F k cost , the immigration l k , and emigration rate m k , the population migration probability P k and the mutation probability m k of each habitat are calculated in this iteration process. The optimal trajectory, that is the trajectory with the lowest cost function, is saved. Figure 5. The fixed-UAV in three-dimensional space.
Step 3. If l i .rand(0, d), m j .rand(e, 1), 0\d, 1.e, i 6 ¼ j, i, j 2 ½1, 2, :::, Np are satisfied, the i-th habitat and the j-th habitat are selected for migration operation in section 2.D; especially, the i-th habitat is selected for the immigrant operation and the j-th habitat is selected for the emigrant operation; besides, the upper limit d and the lower limit e are selected to ensure that elites in habitats do not lose. Then, if m i .rand(0, 1), the i-th habitat can be selected for mutation operation, and NR = NR + 1.
Step 4. If NR . NR max , save the optimal trajectory and return the success information, else, skip to Step 2.

The mathematical model of the fixed-wing UAV
Usually, the UAV's motion in three-dimensional space needs to be transformed among three coordinate frames: body coordinate frame, inertial coordinate frame, and airflow coordinate frame, expressed in letters n, b, w, respectively. [36][37][38] The relationships between three coordinate frames are shown in Figure 5.
Firstly, some definitions are given as: P = x, y, z ð Þ T and _ P = _ x, _ y, _ z ð Þ T represent the position vector and velocity vector in the inertial coordinate frame, respectively. E = u, u, c ð Þ T and _ E = _ u, _ u, _ c À Á T are the attitude angle and attitude angular velocity vectors in the inertial coordinate frame, respectively. u, u, c are the roll angle, pitch angle, and yaw angle in the inertial coordinate frame, respectively. V b = u, v, w ð Þ T and X b = p, q, r ð Þ T are the linear velocity and attitude angle velocity vectors in the body coordinate frame, respectively. u, v, w are linear velocities in the body coordinate frame of x-axis, y-axis, and z-axis, respectively. The relationships between them are given as: The coordinate transform matrices R b n and C b n are given in Appendix 1. According to Newtonian mechanics, 27,39 the UAV's mathematical model can be defined as: The coordinate transform matrix C b w is given in Appendix 1. The forces G b , F b engine , and F w aerodynamic acting on the UAV are given in Appendix 2. The moment M b and the inertial matrix I b are given in Appendix 3. Let are the UAV's engine force on x-axis, y-axis, and z-axis in the body coordinate frame, respectively.d a1 is the controller of the left aileron, d a2 is the controller of the right aileron, d e1 is the controller of the left elevator, d e2 is the controller of the right elevator, and d r is the controller of the rudder. The UAV's mathematical model is simplified as: The complete form of A, B, Q v , F, G, and Q X are given in Appendix 4.
The external disturbances and model uncertainty issues are considered, equations (10) and (11) are rewritten as: Where Þ T are the unknown external disturbances or model uncertainties.

The control scheme of UAV with the planned trajectory
According to the trajectory optimization algorithm proposed in section 2.E, an optimal trajectory PL connecting the initial node and the goal node is obtained. In particular, this trajectory consists of a series of trajectory nodes.
The reference trajectory and its derivative required by UAV is as follows: Step 1. The start node in PL is initialized as the current node node(i), the air speed of UAV is set as v s , and the time step is set as h. The time t is initialized as zero. The time T is initialized as zero. According to equation (2), the total length of the trajectory PL is P length . The time the UAV spends on this trajectory is T all = P length =v s .
Step 2. The time it takes to fly from the current node(i) to the following node(i + 1) is designed as T s = norm(pos(i + 1) À pos(i))=v s , pos(i) = x i y i z i ð Þ, and pos(i + 1) = x i + 1 y i + 1 z i + 1 ð Þ are threedimensional positions of the node(i) and node(i + 1) respectively. Let x s = 0, y s = 0, z s = 0, while T ł t\T + T s , do the following: x r (t) = x i + x s , y r (t) = y i + y s , z r (t) = z i + z s , t = t + h Step 3. The time T is updated by T = T + T s , the current node is updated by letting i = i + 1, that is transferred from the i-th node to the i + 1-th node in PL. If node(i) is equal to the goal node in PL, return the reference trajectory x r (t), y r (t), z r (t) and its derivatives _ x r (t), _ y r (t), _ z r (t) between t = 0 and t = T all , else, skip to Step 2.
Lemma 1 40,42 : Let R(t) 2 R be a continuous positive function with a bounded initial R(0). If the inequality holds _ R(t) łÀ bR(t) + h, where b and h are positive constants, then the following inequality is obtained: Lemma2 28,42 :x(t), y(t) 2 R m are bounded functions with continuous values, the following formula can be obtained by Young's inequality and Cauchy inequality: The control scheme for UAV's attitude and position is designed as follows: The error dynamic between the agent and the reference is represented as: A Lyapunov function is given as follows: According to equation (12), the derivative of V 1 is obtained: Where f l = P À P r À V b r is a smooth function with bounded area, and satisfies f l k k ł a. Here, a is a positive value. According to Lemma 2, the following one is obtained: Use equation (17), equation (16) is rewritten as: To complete the UAV's task, the desired controller u v is designed as: Let k = g(1=2 + 1 = 2g )B + , g.0, and substitute it into equation (16), yields: Use Lemma 1, one can obtain that: f v is unknown, thus the controller in equation (19) cannot be introduced to equation (12) immediately. According to Luan et al. 41 and Tang et al., 42 the RBFNN is often used to estimate the unknown function.
where w Ã 2 R N 3 p is the optimal weight, e(z) is an estimated error, and e(z) k kł d,ŵ 2 R N 3 p is used to estimate the optimal weight, and the error between them can be defined asw =ŵ À w Ã . h i (z) = exp ( À z À j i k k 2 =z 2 i ) and h(z) = h 1 (z), :::, h N (z) ½ T 2 R N . j i is the center in the receptive field and z i is the width of the receptive field. z = e 2 R m is the input unknown disturbance.
Then, a redesigned Lyapunov function is generated as: By combining equations (12), (17), and (22), the derivative of equation (23) is obtained as: According to Lemma 2, the following one is obtained: Use equation (25), equation (24) is rewritten as: To finish the control task, the controller is redesigned as: Where k = g(1=2 + 1=g)B + , g.0, and the weight adaptive law of the neural network is designed as: Substitute equations (27) and (28) into equation (26), yields: Based on the fact that 22 : The following result is obtained: So, equation (29) is rewritten as: Where b = min g, sh ½ , h = 1 2 str(w ÃT w Ã ) + a 2 + d 2 2 . Use Lemma 1, the following one can be obtained: From it one can conclude that the trajectory tracking error can become very small in the situation of selecting the suitable parameters and choosing RBFNN to estimate the unknown disturbance.
Similarly, the controller u O in equation (13) is designed as: Where The elements of the reference attitude vector E r = u r , u r , c r ð Þ T related to the inertial coordinate frame are follows: u r = arcsin u=V T ð Þ, u r = arcsin w=V T ð Þ, and c r = arcsin v=V T ð Þ. To verify the RBFNN's performance of estimating the external disturbance, the contrasted controllers without RBFNN of equations (27) and (34) are set as: Simulation results The experiment is conducted on a personal computer of Inter Core I7 eight-core processor, 16 GB memory, 1T hard disk, and MATLAB R2018a is used for simulation analysis. The effectiveness of the proposed trajectory planning algorithm and UAV control scheme is verified in this section. The specific simulation process is represented as follows: Firstly, the map in Figure 1 is selected as the UAV's workspace, the coordinates pos(start) = 5, 47, 0 ð Þ and pos(goal) = 1, 1, 0 ð Þ are selected as the of the start node and the goal node, respectively. Then the proposed trajectory planning algorithm is compared with the state-of-the-art competitive algorithms, such as WLIPSO and CMM-BBO. Secondly, a reference trajectory is generated by the proposed BBO based trajectory planning algorithm. Finally, the proposed control scheme is used to track the reference trajectory to complete the task of transportation. The detailed default parameters can be found in Appendix 5, Appendix 6, and Appendix 7.
The specific simulation results are as follows: The simulation results of trajectory planning using WLIPSO, CMM-BBO, and the improved BBO algorithm can be obtained as follows. The optimal trajectory length obtained by WLIPSO is 108 m, and it takes 7.1 s to solve the trajectory planning problem. The CMM-BBO algorithm is 99 m and it takes 6.7 s. The improved BBO is 94 m and it takes 4.8 s. After 30 iterations, the values of the cost function of WLIPSO, CMM-BBO, and improved BBO are 93.5, 90.3, and 88.2, respectively. The improved BBO achieves the lowest value of cost function, the computational complexity is the lowest compared with other two algorithms. After obtaining the optimal path quickly, the UAV follow the optimal path to complete the specific task. It can be concluded that the improved BBO based trajectory planning algorithm has good performance, and the trajectories planned by these algorithms in threedimensional workspace are shown in Figure 6.
As shown in Figures 7 and 8, the improved BBO based trajectory planning algorithm is used to find an optimal trajectory connecting the start node and the goal node in the complex working environment. The trajectory generated by the improved BBO is selected as the reference trajectory. From the two-dimensional plane and the three-dimensional plane, it can be seen that the actual flight trajectory of the UAV almost coincides with the reference trajectory. From Figure 9, it can be seen that the control scheme without RFBNN is bad in following the reference trajectory. The reason why the proposed control scheme has good tracking effect is that it can better compensate for the compound interference terms and eliminate the influence of various interferences in the flight process.
The trajectory tracking effects of different methods can be seen from Figures 10 to 15. By using the proposed control scheme, the UAV can track the trajectory quite well in three different situations. The position deviation and the attitude deviation are small in all    The average algorithm accuracy is 96.55%. The electricity consumption is a crucial problem for UAV tracking. The time consumption of UAV in tracking     (27) and (34) are used to track the different trajectories, the control effects are better than controllers without neural network proposed in equations (35) and (36). That is because the neural network used in this paper can accurately estimate the unknown external disturbance. From Figures  16 to 17, it can be concluded that the estimated values are close to the actual values, the neural network has good estimation ability.

Conclusions
This paper proposes an off-line trajectory planning algorithm and a robust trajectory tracking control scheme for fixed-wing UAV. In this paper, an improved trajectory planning algorithm based on BBO is proposed to generate an optimal trajectory connecting the start node and the goal node for obstacle collision avoidance. By comparing with WLIPSO and CMM-BBO algorithm, it is concluded that this algorithm has certain advantages in UAV trajectory planning. A robust controller with RBFNN to estimate unknown disturbances is proposed to track the trajectory generated by three algorithms. Compared with other two algorithms, the improved BBO algorithm and the designed control scheme generate the optimal trajectory in the subjective and objective aspects. In the following work, the reduction of the algorithm complexity will be considered.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.