A UAV flight trajectory planning method based on improved whale algorithm
By constructing a multi-cost UAV trajectory index function and optimizing the trajectory through the improved whale algorithm, the problem of stability and accuracy of UAV flight trajectory planning in an uncertain environment is solved, and a more flexible obstacle avoidance capability is achieved. .
Patent Information
- Application Number
- CN202210422861.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-04-21
AI Technical Summary
Existing UAV flight trajectory planning algorithms are difficult to provide high accuracy and stability when facing uncertain environments, cannot effectively avoid obstacles, and lack flexibility and autonomy.
An improved whale algorithm is proposed. By constructing a trajectory index function of flight length cost, flight energy consumption cost, cargo quality cost and weather threat cost, the improved whale algorithm is used to solve the UAV trajectory, using inertia weight and different search methods. Update position and optimize flight trajectory.
It improves the stability and accuracy of UAV flight trajectory planning, obtains optimal trajectories, and enhances flight capabilities in uncertain environments.
Smart Images

Figure CN114840020B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of unmanned aerial vehicles (UAVs), and in particular relates to a UAV flight trajectory planning method based on an improved whale algorithm. Background Art
[0002] Drone (UAV) flight trajectory planning has become one of the most crucial elements in defining UAV mission planning, demonstrating immense potential in both military and civilian applications. It enables drones to autonomously calculate the optimal trajectory from their starting point to their destination, based on mission requirements and constraints. During operation, drones are equipped with intelligent devices that simulate their operating environment in real time, determine their position, control their flight state, detect obstacles, and calculate avoidance paths, enabling them to successfully avoid obstacles and complete their missions. Calculating a safe path is crucial for drones to reach their destination from their takeoff point and is a crucial prerequisite for mission completion. The correct selection of pathpoints is a crucial step in UAV path planning. Therefore, choosing the right algorithm is crucial for UAV path planning.
[0003] In recent years, various algorithms have been proposed to solve the problem of UAV flight trajectory planning, such as the artificial potential field method (APF), genetic algorithm (GA), artificial intelligence algorithm, etc. However, since UAVs are subject to interference from the external environment during flight (such as weak GPS signals in remote areas and harsh air environments), these algorithms cannot provide UAVs with effective and accurate flight trajectory guidance, and UAVs do not have the flexible and autonomous capabilities to face uncertain environments.
[0004] Currently, the whale algorithm has achieved good results in fields such as multi-objective optimization, function optimization, and training neural networks. Although the whale algorithm can enable the population to quickly jump out of local extreme values when performing target optimization, the overall optimization ability has not been improved. The present invention proposes an improved UAV flight trajectory planning method based on the whale algorithm, which defines the flight costs in the flight trajectory: flight length cost, cargo mass cost, flight energy consumption cost, and weather threat cost, thereby improving the stability and accuracy of flight trajectory planning and obtaining the optimal trajectory.
[0005] In summary, the technical problem existing in the prior art is: how to improve the stability and accuracy of flight trajectory planning and obtain the optimal trajectory when performing flight trajectory planning operations on a UAV. Summary of the Invention
[0006] In order to solve the above technical problems, the present invention proposes a UAV flight trajectory planning method based on an improved whale algorithm when performing flight trajectory planning operations on a UAV, with the goal of improving the stability and accuracy of trajectory planning and obtaining the optimal trajectory.
[0007] A UAV flight trajectory planning method based on an improved whale algorithm includes the following steps:
[0008] S1: Based on the flight length cost, flight energy consumption cost, cargo mass cost, and weather threat cost, simulate the UAV flight environment and construct the UAV trajectory index function;
[0009] S2: Based on the improved whale algorithm, the drone trajectory index function is used as the objective function to be optimized, and the drone trajectory index function is solved to obtain the optimal trajectory of the drone flight;
[0010] Wherein, the step S2 specifically includes:
[0011] S21: Initialize the whale population, set the maximum number of iterations T, the current number of iterations t, the initial probability P, the new convergence factor a, the number of whales n, and set t = 1;
[0012] S22: Take the UAV trajectory index function as the individual fitness, calculate the new convergence factor a through the maximum number of iterations T and the number of iterations t, and calculate the coefficient vector A;
[0013] S23: Set the random probability P1 = 1-log(1+9t / T), and introduce the inertia weight W to update the individual position of the whale according to the individual update mechanism of the whale algorithm;
[0014] If the initial probability P<P1 and |A|>1, the position is updated by random search according to the new convergence factor a;
[0015] If the initial probability P<P1 and |A|≤1, the position is updated in a bracketing manner according to the new convergence factor a;
[0016] If the initial probability P ≥ P1, the position is updated in a spiral manner according to the new convergence factor a;
[0017] S24: If t < the maximum number of iterations T, set t = t + 1 and return to step S22; if t ≥ T, output the global optimal solution; this solution serves as the minimum value of the drone path index evaluation function, that is, the optimal solution of the objective function;
[0018] S25: The optimal solution obtained in S24 is converted into an n-dimensional discrete point set;
[0019] S26: Smoothly connect the discrete trajectory points in order to obtain the optimal trajectory of the UAV flight.
[0020] Preferably, simulate the UAV flight environment, obtain the UAV altitude information in the three-dimensional coordinate system through the logistic-tent sequence, convert the three-dimensional coordinates into two-dimensional coordinates, the starting point coordinates are S(0,0), the end point coordinates are D(xD,yD), draw a perpendicular line from point D to the y-axis, intersecting the y-axis at D′(xD,0), divide the line segment SD′ into n equal parts, and record the endpoints as y1, y2, ..., yn, then Y i =i×SD′ / n(i=1,2,3.....n); draw perpendicular lines to the y-axis through the endpoints, denoted as L1, L2,…, Ln respectively, and transform the path planning problem into the optimization of the X-coordinate sequence, that is, to find the best waypoint X-axis coordinate [X 1 *(t),X 2 *(t),X 3 *(t)......X n *(t)], so that the value of the UAV trajectory index function is minimized.
[0021] Furthermore, in the three-dimensional coordinate system, the UAV flight altitude information is obtained through the logistic-Tent sequence:
[0022]
[0023] Among them, rand() is a random number in the interval (0,1), N is the number of drones in the drone cluster, r is a parameter, which is between [0,4]; Z i is the coordinate of the drone mapped to the Z axis, Z′ is the coordinate of the Z axis of the drone after logistic-tent mapping, then the coordinate of the drone after logistic-tent mapping is updated to (X i , Y i , Z′).
[0024] Preferably, the objective function is constructed based on the flight length cost, flight energy consumption cost, cargo quality cost, and weather threat cost:
[0025] F(X)=w1*E1+w2*FL+w3*G+w4*FM
[0026] Among them, F(X) is the UAV trajectory index function, that is, the objective function; X is the arbitrary position of the whale; E1 is the flight energy cost; FL is the flight length cost; G is the cargo mass cost; FM is the total weather threat cost; w1+w2+w3+w4=1, where w1, w2, w3, and w4 represent the weights of length cost, flight energy cost, cargo mass cost, and weather threat cost, respectively.
[0027] Furthermore, the flight length cost, flight energy consumption cost, cargo quality cost, and weather threat cost are composed of:
[0028] Flight energy cost: The UAV flies in two flight states in a simulated environment: uniform straight-line flight and variable-speed flight with acceleration. The energy consumption cost function is:
[0029] E1=t1*E(q(t))+t2*E(V,a(t))
[0030] Among them, E(q(t)) is the energy consumption of the UAV during uniform flight; E sLF (V) is the energy consumption of the UAV during accelerated flight; t1 is the UAV's uniform flight time, and t2 is the UAV's accelerated flight time; V is the UAV's velocity vector; q(t) is the UAV's coordinates projected onto the two-dimensional plane;
[0031] Flight length cost:
[0032]
[0033] Among them, (X i , Y i ) is the two-dimensional coordinate of any track point; (X i-1 , Yi i-1 ) are the two-dimensional coordinates of adjacent track points; i is the number of designed UAV track points;
[0034] Goods quality price:
[0035]
[0036] Where K is the infinite penalty coefficient for drone overload; Gi is the demand for goods at the i-th delivery point; i is the number of delivery points with goods demand; Fji indicates that delivery point i is completed by drone j; V is the maximum carrying capacity of the drone;
[0037] Cost of weather threats:
[0038]
[0039] Where F is the trajectory L i P(D) is the probability that the UAV will encounter obstacles.
[0040] Furthermore, the energy consumption of uniform straight-line flight is:
[0041]
[0042] Where E(V,a(t)) is the energy consumption of the drone when changing direction, T is the total flight time of the drone, T = t1 + t2; c1 and c2 are two parameters related to the aircraft weight, wing area and air density, a(t) represents the drone acceleration vector, g is the acceleration due to gravity, and V is the drone speed.
[0043] Furthermore, the energy consumption of variable speed flight with acceleration is:
[0044]
[0045] Among them, q(t) represents the coordinates of the drone projected onto the two-dimensional plane; x(t) and y(t) represent the horizontal coordinate positions; v(t) represents the instantaneous velocity vector of the drone; a(t) represents the acceleration vector of the drone; the values of c1 and c2 are two parameters related to the weight of the aircraft, the wing area, and the air density; g represents the acceleration due to gravity; m represents the mass of the drone; a T (t) represents centrifugal acceleration; v(T) represents the speed of the drone at time T; v(0) represents the speed of the drone at time T=0; a(t) represents the acceleration of the drone; v(t) represents the speed of the drone at time t; T represents the total flight time of the drone.
[0046] Furthermore, the weather threat cost is equivalent to a thunderstorm as a sphere with a radius of R. The distance between the UAV and the center of the sphere is D. The maximum radius of the area affected by severe weather is D1. D2 represents the distance from the center of the sphere where the probability of the UAV crashing due to severe weather is 1. The probability that the UAV will hit an obstacle is:
[0047] When D>R, P(D)=0;
[0048] When D<R, P(D)=1;
[0049] When D<D1<D2, P(D)=1 / D.
[0050] Preferably, a new convergence factor a is calculated:
[0051]
[0052] Calculate the coefficient vector A:
[0053] A=2ar-a
[0054] Where r is a random number in the interval (0,1); is the current number of iterations; T is the maximum number of iterations; and π is a constant.
[0055] Preferably, an inertia weight W is introduced to update the whale position, and W is defined as:
[0056]
[0057] Where t is the current iteration number, T is the maximum iteration number, and π is a constant;
[0058] The whale population position update formula is:
[0059] When the initial probability P < 1-log(1+9t / T) and |A| > 1, then X(t+1) = Xrand × WA × Drand;
[0060] When the initial probability P < 1-log(1+9t / T) and |A| ≤ 1, then X(t+1) = X*(t) × WA × D1;
[0061] When the initial probability P≥1-log(1+9t / T), X(t+1)=D2×e bl cos(2πl)+X*(t)×(1-W);
[0062] Where W is the inertia weight, A is the vector coefficient, t is the current iteration number, T is the maximum iteration number, X*(t) is the position of the optimal solution, X(t) is the position of the drone at time t, X(t+1) is the position of the drone at time t+1, D1 = |c·X*(t)-X(t)|, Drand = |c·Xrand-X(t)|, c = 2r, r is a random vector in [0,1], and Xrand is the position of any whale in the whale group.
[0063] The present invention simulates the flight environment of a UAV, constructs a UAV trajectory index function, takes the UAV trajectory index function as the objective function based on the improved whale algorithm, sets parameters to initialize the whale population, uses the UAV trajectory index function as the individual fitness to calculate a new convergence factor a and a calculation coefficient vector A, establishes a random probability P1=1-log(1+9t / T) to judge the individual whale update mechanism, introduces an inertia weight W, updates the individual whale position through the position update mechanism of the whale algorithm, and obtains the optimal flight trajectory; when the present invention uses the improved whale algorithm to plan the flight trajectory of the UAV, the stability and accuracy of the flight trajectory planning are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 This is a top view of the drone trajectory of the present invention
[0065] Figure 2 This is the flow chart of the improved whale algorithm of the present invention
[0066] Figure 3 This is the weather effect on the UAV flight trajectory diagram of the present invention
[0067] Figure 4 The curve diagram of the convergence factor a of the present invention changing with the number of iterations
[0068] Figure 5 The present invention is a flight simulation diagram in a restricted scenario
[0069] Figure 6This is a flowchart of the improved whale algorithm used in this invention to plan the flight trajectory of a drone. DETAILED DESCRIPTION
[0070] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0071] A UAV flight trajectory planning method based on an improved whale algorithm. Figure 1-4 As shown, the following steps are included:
[0072] S1: Based on the flight length cost, flight energy consumption cost, cargo mass cost, and weather threat cost, simulate the UAV flight environment and construct the UAV trajectory index function;
[0073] S2: Based on the improved whale algorithm, the drone trajectory index function is used as the objective function to be optimized, and the drone trajectory index function is solved to obtain the optimal trajectory of the drone flight;
[0074] Wherein, the step S2 specifically includes:
[0075] S21: Initialize the whale population, set the maximum number of iterations T, the current number of iterations t, the initial probability P, the new convergence factor a, the number of whales n, and set t = 1;
[0076] S22: Take the UAV trajectory index function as the individual fitness, calculate the new convergence factor a through the maximum number of iterations T and the number of iterations t, and calculate the coefficient vector A;
[0077] S23: Set up random probability P1=1-log(1+9t / T) to replace the original probability, introduce inertia weight W according to the whale individual update mechanism, and update the individual position through the three search methods of the whale algorithm;
[0078] If the initial probability P<P1 and |A|>1, the position is updated by random search according to the new convergence factor a;
[0079] If the initial probability P<P1 and |A|≤1, the position is updated in a bracketing manner according to the new convergence factor a;
[0080] If the initial probability P ≥ P1, the position is updated in a spiral manner according to the new convergence factor a;
[0081] S24: If t < the maximum number of iterations T, set t = t + 1 and return to step S22; if t ≥ T, output the global optimal solution; this solution serves as the minimum value of the drone path index evaluation function, that is, the optimal solution of the objective function;
[0082] S25: The optimal solution obtained in S24 is converted into an n-dimensional discrete point set;
[0083] S26: Smoothly connect the discrete trajectory points in order to obtain the optimal trajectory of the UAV flight.
[0084] Preferably, simulate the UAV flight environment, fix the UAV flight altitude in the three-dimensional coordinate system through the logistic-tent sequence, convert the three-dimensional coordinates into two-dimensional coordinates, the starting point coordinate is S(0,0), the end point coordinate is D(xD,yD), draw a perpendicular line from point D to the y-axis, intersecting the y-axis at D′(xD,0), divide the line segment SD′ into n equal parts, and record the endpoints as y1, y2, ..., yn, then Y i =i×SD′ / n(i=1,2,3.....n); draw perpendicular lines to the y-axis through the endpoints, denoted as L1, L2,…, Ln respectively, and transform the path planning problem into the optimization of the X-coordinate sequence, that is, to find the best waypoint X-axis coordinate [X 1 *(t),X 2 *(t),X 3 *(t)......X n *(t)]; obtain the UAV flight altitude information through the logistic-Tent sequence:
[0085]
[0086] Among them, rand() is a random number in the interval (0,1), N is the number of drones in the drone cluster, r is a parameter, which is between [0,4]; Z i is the coordinate of the drone mapped to the Z axis, Z′ is the coordinate of the Z axis of the drone after logistic-tent mapping, then the coordinate of the drone after logistic-tent mapping is updated to (X i , Y i , Z′).
[0087] Preferably, the X-axis coordinates of the whale population position are initialized based on the improved logistic-Tent chaotic sequence X=[X1,X2,X3,.....X n ] and the position of the drone, and according to the initial whale population position X-axis coordinate [X 1初 ,X 2初 ,X3beginning,.....X n初]Substitute the drone trajectory index function F(X)=F(X1initial, X2initial, X3initial, .....X n初 ), calculate the initial fitness value of the whale population, and set the maximum number of iterations T, the number of populations N, the number of iterations t = 1, the dimension of the whale population n (that is, the search space is n-dimensional, and the whale searches for the best position in the n-dimensional space). The drone trajectory index function obtained by S1 is regarded as the objective function to be optimized.
[0088] Preferably, Figure 1 As shown, the UAV flight environment is simulated and a UAV maneuverability function model is established, which includes the flight length cost, flight energy consumption cost, cargo mass cost and weather threat cost;
[0089] Flight energy cost: UAVs fly in two flight states, namely, uniform straight-line flight and variable-speed flight with acceleration. For variable-speed flight with acceleration, the total energy consumption of the UAV consists of two parts. The first is the energy related to communication, which is generated by radiation, signal processing, and other circuits. The other component is propulsion energy, which is the energy required to ensure that the UAV remains at a high altitude and supports its maneuverability when needed. The UAV is in a three-dimensional Cartesian coordinate system, and the coordinates of the ground terminal are (0,0,0). The UAV flies at a constant altitude H. The trajectory of the UAV projected on the horizontal plane can be expressed as q(t) = [x(t), y(t)]. The energy consumption model can be expressed as:
[0090]
[0091] Where q(t) represents the actual position of the UAV; x(t) and y(t) represent the horizontal coordinate positions; v(t) represents the instantaneous velocity vector of the UAV; a(t) represents the acceleration vector of the UAV; the values of c1 and c2 are two parameters related to the weight of the aircraft, the wing area, and the air density; g represents the acceleration due to gravity; m represents the mass of the UAV; for horizontal flight at a fixed altitude, the energy consumption of the UAV depends only on the velocity vector v(t) and the acceleration vector a(t), not on its actual position q(t); the integral term is guaranteed to be positive and is the work done by the aircraft engine to overcome the air resistance; it depends on the UAV velocity v(t) and its centrifugal acceleration The direction is perpendicular to the UAV velocity vector. According to the kinetic energy theorem, the second term of the energy consumption model represents the change in the UAV's kinetic energy. This is the aggregation effect of the UAV's tangential acceleration component and is parallel to the UAV's velocity vector. Therefore, the magnitude of this term depends on the UAV's final velocity v(T) and initial velocity v(0), and has nothing to do with the UAV's intermediate state velocity.
[0092] For uniform straight-line flight, ||v(t)||=V, a(t)=0. The energy consumption model can be transformed into:
[0093]
[0094] For the same flight speed, changing direction consumes additional energy compared to straight-line flight. The energy consumption model is then transformed into:
[0095]
[0096] The energy required for the drone to accelerate is more than that required for the drone to fly at a constant speed. Therefore, the acceleration flight time and the constant speed flight time should be balanced. Let the acceleration flight time be t1 and the constant speed flight time be t2. The energy consumption cost function is:
[0097] E1=t1*E(q(t))+t22*E sLF (V)
[0098] Cargo Quality Cost: Calculate the penalty cost for drone overloading:
[0099]
[0100] Where K is the infinite penalty coefficient for drone overload; Gi is the demand for goods at the i-th delivery point; i is the number of delivery points with goods demand; Fji indicates that delivery point i is completed by drone j; V is the maximum carrying capacity of the drone;
[0101] Flight length cost: Since the kinetic energy change in the UAV energy consumption cost already contains the altitude change, in order to calculate the flight length cost, the UAV's flight trajectory is converted into a two-dimensional plane and represented using the grid method, as shown in the following example: Figure 2 As shown, the black area is the obstacle area, and the white area is the flyable area. The drone needs to bypass the obstacles to reach the target point. The green square is the starting point and the red square is the end point. The horizontal and vertical coordinates are accurate to one unit length. The cost of each route segment during the drone's straight flight process is calculated:
[0102] The flight path of the UAV is evenly divided into 11 points. The number of points is defined according to the number of times the UAV changes direction. Each time the direction changes, it is a track point. Together with the first and last track points, there are a total of 11 track points. There are 10 route segments. In the two-dimensional plane, the UAV is at the track point (X i ,Yi i ) and adjacent track points (X i-1 ,Y i-1 ) is L i ,but
[0103] The cost of the drone’s flight length is:
[0104] Among them, (X i , Yi i ) is the two-dimensional coordinate of any track point; (X i-1 , Y i-1 ) are the two-dimensional coordinates of adjacent track points; i is the number of designed UAV track points;
[0105] Cost of weather threats: Figure 4 As shown in the figure, since drones are affected by bad weather during flight, the impact of weather on drone trajectories should be considered. For example, in rain, hail, sleet and snow, drones should avoid obstacles to ensure safety. Based on this, thunderstorm weather is equivalent to a sphere with a radius of R. The distance between the drone and the center of the sphere is D. The maximum radius of the area affected by bad weather is D1. D2 represents the distance from the center of the sphere where the probability of the drone crashing due to bad weather is 1. The probability that the drone will hit an obstacle is:
[0106] When D>R, P(D)=0;
[0107] When D<R, P(D)=1;
[0108] When D<D1<D2, P(D)=1 / D;
[0109] In order to calculate the threat cost of a section of the journey, the path is divided into 11 equal parts, divided into 11 track points, that is, there are 10 route segments, namely L1-L 10 , then for path L i On the sphere, there are C threat weather points, which means there are C spherical threat areas. Then L i The weather threats to the segment are expressed as:
[0110]
[0111] The cost of weather threats is calculated as:
[0112]
[0113] Where F is the trajectory L i P(D) is the probability that the UAV will encounter obstacles.
[0114] Then the drone trajectory index function:
[0115] F=w1*E1+w2*FL+w3*G+w4*FM
[0116] Where E1 is the flight energy cost; FL is the flight length cost; G is the cargo mass cost; FM is the total weather threat cost; w1+w2+w3+w4=1, where w1, w2, w3, and w4 represent the weights of the length cost, flight energy cost, cargo mass cost, and weather threat cost, respectively.
[0117] Therefore, the above problem is converted into an optimization problem with constraints and objective functions, that is, the fitness function is the objective function. In order to minimize the cost, the value of the path index function F(X) should be minimized.
[0118] Furthermore, since the drone path index function is composed of multiple different constraints, the problem is transformed into the problem of minimizing the objective function with multiple known constraints. This problem is an NP problem and is relatively difficult to solve. Therefore, an improved whale optimization algorithm is proposed to optimize the objective function. Here, the objective function is the drone path index function. We need to minimize the drone path index function, that is, minimize the objective function to achieve the minimum drone path index function.
[0119] Preferably, the fitness value of each whale is calculated, and the position of the whale that makes the fitness value the smallest is recorded; after obtaining the current optimal path planning method, it is converted into the whale individual position vector, and the controllable selection scheme of each route is regarded as a whale, and the whale group set is represented as X = [X1, X2, X3…X n ], where n is the total number of route plans; when the UAV path has N waypoints, there are N-1 route segments. After each update of the fitness function, the position X*(t) with the minimum fitness value is selected. After multiple iterations, the position matrix [X 1 *(t),X 2 *(t),X 3 *(t)......X N *(t)]; connect each track point of the position matrix with a straight line to obtain the waypoint of the UAV flight.
[0120] Preferably, Figure 5 As shown, a new convergence factor a is established. The value of a changes nonlinearly with t. In the early stage of iteration, the proposed a is smaller than the original a. The whale individual focuses on local search. In the later stage of iteration, in order to avoid falling into the local optimum, the whale individual should have the ability to jump out of the local optimum. Therefore, the a proposed in the later stage of iteration is larger than the original a. Calculate the new convergence factor a:
[0121]
[0122] Calculate the coefficient vector A:
[0123] A=2ar-a
[0124] Where r is a random number in the interval (0,1); is the current number of iterations; T is the maximum number of iterations; and π is a constant.
[0125] Preferably, the whale walks randomly in the n-dimensional search space to search for the optimal whale, that is, to search for the optimal path among n solutions. The whale has three hunting mechanisms, namely random search, bracket search, and spiral search. If the initial probability P<1-log(1+9t / T) and |A|>1, the whale individual is allowed to perform random learning and the whale position is updated according to the random search method. If the initial probability P<1-log(1+9t / T) and |A|≤1, the position is updated by bracket search to remove the route planning scheme that does not meet the objective function. If the initial probability P≥1-log(1+9t / T), the whale position is updated according to the spiral method.
[0126] Furthermore, the idea of inertia weight W is introduced and added to the whale algorithm position update formula to update the drone waypoint position;
[0127] Furthermore, it is determined whether the maximum number of iterations has been reached. If so, the optimal solution is output, which is the minimum value of the drone path indicator function. The optimized path is output, and the path selection optimization is completed.
[0128] Preferably, Figure 3 As shown in Figure 2, the specific steps for minimizing the objective function using the improved whale algorithm are as follows:
[0129] Furthermore, the improved whale algorithm is used to optimize the position of the drone. The whale walks randomly in the n-dimensional search space to search for the optimal whale, that is, to search for the optimal trajectory among n optional optimal path solutions. The whale has three hunting mechanisms, namely random search, encirclement search, and spiral search.
[0130] Furthermore, the present invention replaces the traditional random probability P=0.5 and sets the current random probability P to:
[0131] P1=1-log(1+9t / T)
[0132] This formula shows that P changes with time t and changes nonlinearly. When t = 0, P = 1, and when t = T, P = 0; the random probability changes nonlinearly from 1 to 0. This method enables the algorithm to have better local search capabilities in the early stage of iteration and better global search capabilities in the later stage of iteration.
[0133] Preferably, the idea of inertia weight W is introduced to update the whale position, and W is defined as: And the idea of inertia weight is added to the position update formula of the whale algorithm. The new position update formula is:
[0134] When the initial probability P < 1-log(1+9t / T) and |A| > 1, the position is updated using a random search method: X(t+1) = Xrand × WA × Drand;
[0135] When the initial probability P<1-log(1+9t / T) and |A|≤1, the position is updated using the bracketing search method: X(t+1)=X*(t)×WA×D1;
[0136] When the initial probability P≥1-log(1+9t / T), the spiral search method is used to update the position: X(t+1)=D2×e bl cos(2πl)+X*(t)×(1-W);
[0137] Based on the position update formula, the drone selects the value of X*(t) that minimizes the fitness value to update its own position each time. In the XOY plane, the starting coordinate is S(0,0), the end coordinate is D(xD,yD), and a perpendicular line is drawn from point D to the y-axis, intersecting the y-axis at D′(xD,0). The line segment SD′ is divided into n equal parts, and the endpoints are denoted as y1, y2, ..., yn. Then Y i =i×SD′ / n(i=1,2,3.....n); draw perpendicular lines to the y-axis through the endpoints, denoted as L1, L2,…, Ln respectively, and transform the path planning problem into the optimization of the X-coordinate sequence, that is, to find the best waypoint X-axis coordinate [X 1 *(t),X 2 *(t),X 3 *(t)......X n *(t)], forming the UAV waypoint position matrix [(X 1 *(t),Y1,Z11),(X 2 *(t),Y2,Z22),(X 3 *(t),Y3,Z3′)......(X n *(t),Y n ,Z′ n )], and finally connect the discrete track points in order to generate a path and obtain the optimal flight trajectory of the UAV.
Claims
1. A UAV flight trajectory planning method based on an improved whale algorithm, characterized in that: include: S1: According to the flight length cost, flight energy consumption cost, cargo quality cost, and weather threat cost, simulate the UAV flight environment and construct the UAV trajectory index function; S2: Based on the improved whale algorithm, the drone trajectory index function is used as the objective function to be optimized, and the drone trajectory index function is solved to obtain the optimal trajectory of the drone flight; Wherein, the step S2 specifically includes: S21: Initialize the whale population, set the maximum number of iterations T, the current number of iterations t, the initial probability P, the new convergence factor a, the number of whales n, and set t = 1; S22: Taking the drone trajectory index function as the individual fitness, calculate the new convergence factor a through the maximum number of iterations T and the number of iterations t, and calculate the coefficient vector A; Calculate the new convergence factor a: Calculate the coefficient vector A: A=2ar-a Among them, r is a random number in the interval (0,1); π is a constant; S23: Set up random probability P1=1-log(1+9t / T), introduce inertia weight W to update the individual position of whales according to the individual update mechanism of whale algorithm; If the initial probability P < P1 and |A| > 1, the position is updated by random search according to the new convergence factor a; If the initial probability P < P1 and |A| ≤ 1, the position is updated in an encircling manner according to the new convergence factor a; If the initial probability P ≥ P1, the position is updated in a spiral manner according to the new convergence factor a; Introduce the inertia weight W to update the whale's position. W is defined as: The whale population position update formula is: When the initial probability P<1-log(1+9t / T) and |A|>1, the position is updated by random search: X(t+1)=Xrand×WA×Drand; When the initial probability P<1-log(1+9t / T) and |A|≤1, the position is updated by the bracket search method: X(t+1)=X*(t)×WA×D1; When the initial probability P≥1-log(1+9t / T), the spiral search method is used to update the position: X(t+1)=D2×e bl cos(2πl)+X*(t)×(1-W); Where X*(t) is the position of the optimal solution, X(t) is the position of the drone at time t, X(t+1) is the position of the drone at time t+1, D1=|c·X*(t)-X(t)|, Drand=|c·Xrand-X(t)|, c=2r, and Xrand is the position of any whale in the whale group; S24: If t < the maximum number of iterations T, set t = t + 1 and return to step S22; if t ≥ T, output the global optimal solution; this solution is the minimum value of the drone path index evaluation function, that is, the optimal solution of the objective function; S25: The optimal solution obtained in S24 is constructed into an n-dimensional discrete point set; S26: Smoothly connect the discrete trajectory points in order to obtain the optimal trajectory of the UAV flight.
2. According to claim 1, a method for UAV flight trajectory planning based on improved whale algorithm is characterized in that: Simulate the UAV flight environment. In the three-dimensional coordinate system, the UAV altitude information is obtained through the logistic-Tent sequence. The three-dimensional coordinates are converted into two-dimensional coordinates. The starting point coordinates are S(0,0) and the end point coordinates are D(xD,yD). Draw a perpendicular line from point D to the y-axis, intersecting the y-axis at D′(xD,0). Divide the line segment SD′ into n equal parts, and record the endpoints as y1, y2, …, yn. Then Y i =i×SD′ / n(i=1,2,3.....n); draw perpendicular lines to the y-axis through the endpoints, respectively denoted as L1, L2,…, Ln, and transform the path planning problem into the optimization of the X-coordinate sequence, that is, to find the best waypoint X-axis coordinate [X 1 *(t),X 2 *(t),X 3 *(t)......X n *(t)], so that the value of the UAV trajectory index function is minimized.
3. The method for planning the flight trajectory of an unmanned aerial vehicle based on the improved whale algorithm according to claim 2 is characterized in that: In the three-dimensional coordinate system, the flight altitude information of the drone is obtained through the logistic-Tent sequence: Where rand() is a random number in the interval (0,1), N is the number of drones in the drone cluster, r is a parameter between [0,4]; Z i is the coordinate of the drone mapped to the Z axis, and Z′ is the coordinate of the Z axis of the drone after logistic-Tent mapping. The coordinate of the drone after logistic-Tent mapping is updated to (X i , Y i , Z′).
4. The method for planning the flight trajectory of an unmanned aerial vehicle based on the improved whale algorithm according to claim 1, characterized in that: Construct the objective function based on the flight length cost, flight energy consumption cost, cargo quality cost, and weather threat cost: F(X)=w1*E1+w2*FL+w3*G+w4*FM Among them, F(X) is the UAV trajectory index function, that is, the objective function; X is the arbitrary position of the whale; E1 is the flight energy consumption cost; FL is the flight length cost; G is the cargo mass cost; FM is the total weather threat cost; w1+w2+w3+w4=1, w1, w2, w3, w4 represent the weights of length cost, flight energy consumption cost, cargo mass cost, and weather threat cost, respectively.
5. The method for planning the flight trajectory of an unmanned aerial vehicle based on the improved whale algorithm according to claim 4 is characterized in that: The flight length cost, flight energy consumption cost, cargo quality cost, and weather threat cost are composed of: Flight energy cost: The UAV flies in two flight states in a simulated environment: uniform straight-line flight and variable-speed flight with acceleration. The energy consumption cost function is: E1=t1*E(q(t))+t2*E(V,a(t)) Where E(q(t)) is the energy consumption of the UAV during uniform flight; E sLF (V) is the energy consumption of the drone during accelerated flight; t1 is the drone's uniform flight time, and t2 is the drone's accelerated flight time; V is the drone's velocity vector; q(t) is the drone's coordinates projected onto a two-dimensional plane; Flight length cost: Among them, (X i , Y i ) is the two-dimensional coordinate of any track point; (X i-1 , Y i-1 ) are the two-dimensional coordinates of adjacent track points; i is the number of designed UAV track points; Goods quality price: Among them, K is the infinite penalty coefficient for drone overload; Gi is the demand for goods at the i-th delivery point; i is the number of delivery points with goods demand; Fji means that delivery point i is completed by drone j; V is the maximum carrying capacity of the drone; Cost of weather threats: Where F is the trajectory L i P(D) is the probability that the UAV will encounter obstacles.
6. The method for planning the flight trajectory of an unmanned aerial vehicle based on the improved whale algorithm according to claim 5, characterized in that: The energy consumption of uniform straight-line flight is: Among them, E(V,a(t)) is the energy consumption of the drone when changing direction, T is the total flight time of the drone, T=t1+t2; c1 and c2 are two parameters related to the aircraft weight, wing area and air density, a(t) represents the drone acceleration vector, g is the gravity acceleration, and V is the drone speed.
7. The method for planning the flight trajectory of an unmanned aerial vehicle based on the improved whale algorithm according to claim 5, characterized in that: The energy consumption of variable speed flight with acceleration is: Among them, q(t) represents the coordinates of the drone projected onto the two-dimensional plane; x(t), y(t) represent the horizontal coordinate positions; v(t) represents the instantaneous velocity vector of the drone; a(t) represents the acceleration vector of the drone; the values of c1 and c2 are two parameters related to the weight of the aircraft, the wing area and the air density; g represents the acceleration due to gravity; m represents the mass of the drone; a T (t) represents centrifugal acceleration; v(T) represents the speed of the drone at time T; v(0) represents the speed of the drone at time T=0; a(t) represents the acceleration of the drone; v(t) represents the speed of the drone at time t; T represents the total flight time of the drone.
8. The method for planning the flight trajectory of an unmanned aerial vehicle based on the improved whale algorithm according to claim 5, characterized in that: The weather threat cost is that thunderstorm weather is equivalent to a sphere with a radius of R. The distance between the drone and the center of the sphere is D. The maximum radius of the area affected by severe weather is D1. D2 represents the distance from the center of the sphere to the area where the probability of the drone crashing due to severe weather is 1. The probability that the drone will hit an obstacle is: When D>R, P(D)=0; When D<R, P(D)=1; When D<D1<D2, P(D)=1 / D.
