A nonlinear adversarial strategy optimization method
By obtaining the position and parameter information of the UAV, calculating and determining the take-off speed and route, and constructing an avoidance model to adjust the flight attitude and route in real time, the computational complexity and parameter adjustment in the UAV nonlinear confrontation strategy optimization method are solved Difficulty problem, efficient adaptive flight control is achieved, and the performance and response speed of the drone are improved.
Patent Information
- Application Number
- CN202410813159.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-24
AI Technical Summary
Existing nonlinear countermeasure optimization methods for UAVs have problems such as computational complexity, difficulty in parameter adjustment, and slow convergence speed, resulting in high system complexity, increased cost, and low response speed.
By obtaining the position, parameters and mission information of the UAV, we calculate and determine the take-off speed, take-off height and route, and build an avoidance model to adjust the flight attitude and route in real time. We combine the inter-frame difference algorithm and the AlexNet model for obstacle avoidance to achieve Adaptive flight control.
It improves the adaptability and flight performance of the drone, optimizes power consumption, speed and attitude, and ensures real-time dynamic adjustment to adapt to mission requirements and environmental changes.
Smart Images

Figure CN118377318B
Abstract
Description
Technical Field
[0001] The invention discloses a nonlinear confrontation strategy optimization method and relates to the field of unmanned aerial vehicles. Background Art
[0002] The existing nonlinear countermeasure strategies for drones have the following shortcomings:
[0003] Computational complexity: Nonlinear adversarial strategy optimization methods usually involve complex mathematical models and algorithms and require high-performance computing resources to support real-time optimization, which increases the complexity and cost of the system.
[0004] Difficulty in parameter adjustment: In actual applications, the nonlinear countermeasure strategy for drones still requires professionals to adjust parameters according to specific circumstances to achieve the best effect, which increases the difficulty of operation and possible human errors.
[0005] Convergence speed: Some nonlinear optimization algorithms (such as the Gauss-Newton method) may converge slowly or even fail to converge in certain situations, which will affect the UAV's response speed and mission execution efficiency. Summary of the invention
[0006] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a nonlinear confrontation strategy optimization method to solve the problem of difficult control of the flight state of unmanned aerial vehicles.
[0007] In order to achieve the above object, the present invention is implemented by the following technical solution: a nonlinear confrontation strategy optimization method, characterized in that the optimization method includes:
[0008] Step S1: Obtain the take-off position and the docking position of the drone to obtain the position information;
[0009] Obtain the weight of the drone, the output power and instantaneous acceleration of the motor, and the battery capacity to obtain parameter information;
[0010] Obtain the work route, work route length, work time and target location to obtain task information;
[0011] Step S2: Obtain the quantity and weight of the drone's payload to determine whether the drone is available;
[0012] If available, calculate and determine the takeoff speed, takeoff altitude and takeoff route of the UAV by combining the position information, parameter information and mission information;
[0013] If it is not available, step S3 is skipped and an error message is fed back to the user;
[0014] Step S3: construct an avoidance model; obtain drone images in real time, and judge and avoid obstacles based on the avoidance model;
[0015] Obtain the deflection status of the drone in real time and adjust the flight attitude of the drone;
[0016] Obtain the current position and speed of the drone in real time; adjust the flight speed or take-off route of the drone based on the drone’s current position, speed and target position;
[0017] Step S4: Feedback the error information and the drone image to the user; continue to monitor the drone until the current position of the drone coincides with the target position or the docking position;
[0018] Furthermore, the specific steps of step S2 are as follows:
[0019] Step S21: Get the rated take-off altitude, recorded as ho; record the take-off position as (Xo, Yo); record the target position as (Xe, Ye); record the working time as To;
[0020] Step S22: Obtain the number and weight of the objects carried, record the number of objects carried as n, and calculate the horizontal speed range of the UAV;
[0021] Calculate the optimal horizontal speed of the drone, denoted as Vm; Vm is calculated as follows:
[0022] ;
[0023] Calculate the worst horizontal speed of the drone, denoted as Vl; Vl = Vm / 2n;
[0024] Reference range of drone horizontal speed: [Vl, Vm];
[0025] Step S23: Calculate the minimum speed of the vertical velocity Vy of the drone, denoted as Vyl; Vyl is calculated as follows:
[0026] ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0027] Step S24: Determine whether the drone is available;
[0028] Step S241: record the output power of the motor as W, the instantaneous acceleration as a, and the battery capacity as E; calculate the battery power supply time te, te = E / W;
[0029] Step S242: Obtain the current power of the drone, recorded as eo; calculate the available time ty of the drone, ; Determine whether ty is greater than or equal to To;
[0030] If ty is less than To, it means that the drone is unavailable, and a prompt indicating that the drone is unavailable is given to the user;
[0031] If ty is greater than or equal to To, the take-off speed and take-off height of the UAV are calculated according to eo and ty, and the process goes to step S25;
[0032] Furthermore, the subsequent steps of step S24 are as follows:
[0033] Step S25: record the weight of the drone as m1 and the weight of the payload as m2; determine the take-off speed Vx1 and the maximum take-off altitude H1 of the drone at the speed V1;
[0034] Step S26: Determine the take-off speed Vx2 and the minimum take-off height H2 of the UAV at the speed Vm;
[0035] Step S27: Calculate the coefficient of change of Vx1 with respect to Vx2 vb=log Vx2 (Vx1); horizontal speed of the drone ;
[0036] Calculate the coefficient of variation of H2 with respect to H1 hb = log H1 (H2); The flight altitude of the drone ;
[0037] Step S28: Select the shortest working route as the take-off route; proceed to step S3, continuously monitor and adjust the flight speed, flight attitude and flight route of the UAV;
[0038] Furthermore, the specific steps of step S25 are as follows:
[0039] Step S251: Calculate the minimum number of complete working times of the UAV in Vl, recorded as wn; wn is calculated as follows:
[0040] ;wn is rounded down;
[0041] Step S252: Calculate the maximum energy consumption of the drone at a time, ne, where ne=eo / wn, and ne is rounded down;
[0042] Step S253: Calculate the maximum take-off height Hm of the drone. Hm is calculated as follows:
[0043] ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0044] Calculate the maximum vertical speed Vym of the drone, ;
[0045] Step S254: Calculate the maximum acceleration time tym of the vertical speed of the drone. , a represents instantaneous acceleration;
[0046] Calculate the shortest acceleration time txl of the drone's horizontal speed, ;
[0047] Step S255: Determination and the size of Vl;
[0048] like If it is less than or equal to Vl, the horizontal acceleration time of the drone is txl and the take-off speed is Vl;
[0049] like is greater than Vl, then the horizontal acceleration time of the drone is txl, and the take-off speed is ;
[0050] Step S256: Determine the size of Hm and ho;
[0051] If Hm is greater than or equal to ho, the maximum take-off altitude Hm of the UAV remains unchanged;
[0052] If Hm is less than ho, the maximum take-off height Hm of the drone becomes ho;
[0053] Step S257: Summarize the take-off speed and maximum take-off altitude of the UAV determined in steps S255 to S256, and record them as Vx1 and H1 respectively;
[0054] The specific steps of step S26 are as follows:
[0055] Step S261: Calculate the maximum number of complete working times of the UAV in Vm, recorded as wm; wm is calculated as follows:
[0056] ;wm is rounded down;
[0057] Step S262: Calculate the minimum energy consumption of the drone per time, ye, where ye = eo / wm, and ye is rounded down;
[0058] Step S263: Calculate the minimum take-off height H1 of the drone. H1 is calculated as follows:
[0059] ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0060] The minimum vertical speed of the drone Vyl is changed to Vyl`. The calculation formula of Vyl` is as follows:
[0061] ;
[0062] Step S264: Calculate the shortest acceleration time tyl of the vertical speed of the drone, tyl=(2Hl / a) 1 / 2 ; Calculate the longest acceleration time txm of the drone's horizontal speed, , To represents working time;
[0063] Step S265: Determination and the size of the VM;
[0064] like If it is less than or equal to Vm, the horizontal acceleration time of the drone is txm and the take-off speed is Vm;
[0065] like is greater than Vm, the horizontal acceleration time of the drone is txl, and the take-off speed is ;
[0066] Step S266: Determine the size of H1 and ho;
[0067] If Hl is greater than or equal to ho, the minimum take-off height Hl of the drone remains unchanged;
[0068] If Hl is less than ho, the minimum take-off height Hl of the drone becomes ho;
[0069] Step S267: Summarize the take-off speed and minimum take-off altitude of the drone determined in steps S265 to S266, and record them as Vx2 and H2 respectively.
[0070] Furthermore, the specific steps of step S3 are as follows:
[0071] Step S31: Acquire unmanned real-time drone images;
[0072] Step S32: constructing an avoidance model;
[0073] Step S33: inputting the drone image into the avoidance model to judge and avoid obstacles;
[0074] Step S34: obtaining the deflection state of the UAV in real time and adjusting the flight attitude of the UAV;
[0075] Step S35: Acquire the current position and current speed of the drone in real time; adjust the flight speed or take-off route of the drone according to the current position, current speed and target position of the drone.
[0076] Furthermore, the specific steps of step S32 are as follows:
[0077] Step S321: using an inter-frame difference algorithm to define an expression for the obstacle target and background changes;
[0078] Step S3211: importing the CIFAR image library; randomly selecting an image containing an obstacle in the CIFAR image library as a test image;
[0079] Step S3212: Continuously extract test images, the number of extracted frames is 3; use A i (x, y) represents the i-th frame image, A i-2 (x, y) represents the (i-2)th frame image, D k (x, y) represents the difference between the i-th frame image and the (i-2)-th frame image, that is: D k (x,y)=|A i (x,y)-A i-2 (x,y)|; (x,y) represents the position of the obstacle in the test image;
[0080] Step S3213: Assume that each video frame image I(x,y,t) is composed of a background image b(x,y,t) and an obstacle target m(x,y,t): I(x,y,t)=b(x,y,t)+m(x,y,t); that is, D k (x,y) consists of two parts, namely obstacle target and background change:
[0081] D k (x,y)=b(x,y,i)-b(x,y,i-2)+m(x,y,i)-m(x,y,i-2);
[0082] [b(x,y,i)-b(xy,i-2)] represents the background change; [m(x,y,i)-m(x,y,i-2)] represents the change of the obstacle target; where t represents the time sequence;
[0083] Step S322: determining an image cropping area;
[0084] Step S3221: establishing an image detection window for the test image;
[0085] From the bottom of the image upwards, select rows with a height of h / 2, where h represents the length of the test image, and convert the test image into a grayscale image;
[0086] Step S3222: Record the transition points where the grayscale values of two consecutive frames in the grayscale image change from 0 to 1 or from 1 to 0, and mark them as (X 1 ,Y 1 ),(X 2 ,Y 2 )~(X q ,Y q ); where (X 1 ,Y 1 )~(Xq ,Y q ) represents the coordinates of the transition point in the image detection window, and q represents the number of transition points;
[0087] Step S3223: Take the average value of the jump point and as the bottom point of the detection window, that is, select (X 1 +X 2 +~+X q ) / q is the bottom left point of the detection window, (Y 1 +Y 2 +~+Y q ) / q is the upper and lower points, and a rectangular image detection window is obtained, which is the image cropping area;
[0088] Step S323: establishing a plane coordinate system;
[0089] Step S3231: the x-axis represents the direction indicating east, the y-axis represents the direction indicating north, the black solid dot represents the position of the UAV, the starting point represents the take-off position of the UAV, and the end point represents the target position or the docking position;
[0090] Step S3232: Define the avoidance logic for the drone encountering obstacles on the left side:
[0091] The direction of the drone's nose is fixed, always pointing from the starting point to the end point, and the speed is v;
[0092] When there is an obstacle on the left side of the drone, the drone accelerates to fly over the obstacle; after the drone moves away from the obstacle, it returns to its original speed v;
[0093] Step S3233: Based on the avoidance logic of the left side of the drone encountering obstacles, define the avoidance logic of the right side and upper side of the drone encountering obstacles;
[0094] Step S324: Taking the AlexNet model as the basic model, taking steps S321 to S323 as the constraints of the fully connected layer, and obtaining an avoidance model.
[0095] Furthermore, the specific steps of step S34 are as follows:
[0096] Step S341: construct a spatial coordinate system with the drone as the origin, the east direction as the X-axis, the north direction as the Y-axis, and the vertical direction to the ground as the Z-axis; detect whether the drone gyroscope is offset;
[0097] If there is no deviation, continue monitoring;
[0098] If it deviates, it means that the drone encounters strong winds, and the wind speed is calculated, and the process goes to step S342;
[0099] Step S342: Obtain the current speed of the drone, recorded as vv; calculate the wind speed vw to which the drone is subjected; the calculation formula of vw is as follows:
[0100] ;
[0101] Calculate the vertical speed of the drone, recorded as vp, vp = (vv) 2 / 3 ; Define the vector expressions of vp, vv and vw:
[0102] vp vector , size |vp|, direction parallel to the Z axis;
[0103] Vector of vv , size |vv|, direction parallel to the Y axis;
[0104] vw vector , size |vw|;
[0105] , and satisfy: ;
[0106] Step S343: Calculate the angle θ1 between vw and the Z axis; the calculation formula of θ1 is as follows:
[0107] ;
[0108] Calculate the angle θ2 between vw and the Y axis; the calculation formula for θ2 is as follows:
[0109] ;
[0110] Step S344: Adjust the flight attitude of the drone, that is, the drone returns to the negative direction of the Z axis by θ1 degrees and returns to the positive direction of the Y axis by θ2 degrees.
[0111] Furthermore, the specific steps of step S35 are as follows:
[0112] Step S351: Get the current position of the drone, recorded as (xx1, yy1);
[0113] Step S352: Count the number of working routes other than the take-off route, recorded as rn; summarize the lengths of the first to rn working routes, recorded as l 1 ~l rn ;
[0114] Count the number of stops, recorded as sn; summarize the positions of stops 1 to sn, recorded as (sx 1 ,sy 1 ),~(sx sn ,sysn );
[0115] Step S353: Calculate the distance ΔX from the current position of the drone to the target position. The calculation formula of ΔX is as follows:
[0116] ; Where (Xe, Ye) represents the target position;
[0117] Calculate the time coefficient of the drone's extended takeoff route, recorded as Δt, and the calculation formula of Δt is as follows:
[0118] ; Among them, (Xo, Yo) represents the take-off position, To represents the working time, and n represents the number of objects carried;
[0119] Step S354: define judgment formula 351: ;
[0120] Among them, i represents 1~rn; l i represents the length of the i-th working route;
[0121] Will l 1 ~l rn Substitute into judgment formula 351, select the working routes that meet judgment formula 351 as candidate routes, and count the number of candidate routes as fln;
[0122] Step S355: determine whether fln is 0;
[0123] If it is 0, it means that there is no working route that is better than the take-off route, and the flight speed or take-off route of the drone remains unchanged;
[0124] If it is not 0, the length of the take-off route is obtained as 11, and the judgment formula 352 is defined to proceed to step S356; the judgment formula 352 is as follows:
[0125] ; where i represents 1 to fln; j represents 1 to sn; l i represents the length of the i-th working route; sx j and sy j Respectively represent the horizontal and vertical coordinates of the j-th stop position;
[0126] Step S356: Substitute the alternative route into the judgment formula 352, select the alternative route that satisfies the judgment formula 352 as the preferred route; read the length of the preferred route, recorded as fl;
[0127] Step S357: Calculate the adjusted horizontal flight speed zv and flight altitude zh of the UAV according to the preferred route;
[0128] The calculation formula of zv is: ; Where vv represents the current speed of the drone;
[0129] zh calculation formula: ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0130] Step S358: Change the take-off route of the UAV to the preferred route, adjust the horizontal flight speed to zv, and adjust the flight altitude to z.
[0131] Compared with the prior art, the present invention has the following beneficial effects:
[0132] Adaptability: The present invention has the ability to adaptively adjust parameters, so that the UAV can make real-time adjustments according to different mission requirements and environmental changes, improving the flexibility and adaptability of flight.
[0133] Performance optimization: The present invention comprehensively considers multiple performance indicators of the UAV, such as power consumption, flight speed, flight attitude and mission distance, so as to make the flight control of the UAV more reasonable and realize the overall performance optimization of the UAV.
[0134] Real-time dynamic adjustment: The present invention can perform real-time dynamic adjustment during the flight of the UAV; by continuously collecting and analyzing the flight data of the UAV, adjusting the flight status of the UAV, adapting to the ever-changing flight environment and mission requirements, it ensures that the UAV always remains in the best flight state. BRIEF DESCRIPTION OF THE DRAWINGS
[0135] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0136] Figure 1 It is a schematic diagram of the optimization method of the present invention;
[0137] Figure 2 It is a schematic diagram of the plane coordinate system of the present invention;
[0138] Figure 3 Schematic diagram of the spatial coordinate system of the present invention. DETAILED DESCRIPTION
[0139] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0140] See also Figure 1 , a nonlinear adversarial strategy optimization method includes:
[0141] Step S1: Obtain the take-off position and the docking position of the drone to obtain the position information;
[0142] Obtain the weight of the drone, the output power and instantaneous acceleration of the motor, and the battery capacity to obtain parameter information;
[0143] Obtain the work route, work route length, work time and target location to obtain task information;
[0144] It should be noted that the "working route" in the present invention refers to the set of routes "set by the user or relevant technical personnel from the take-off position to the target position"; if the user or relevant technical personnel does not set the "working route", the "working route" defaults to: a straight line route from the take-off position to the target position.
[0145] Step S2: Obtain the quantity and weight of the drone's payload to determine whether the drone is available;
[0146] If available, calculate and determine the takeoff speed, takeoff altitude and takeoff route of the UAV by combining the position information, parameter information and mission information;
[0147] If it is not available, step S3 is skipped and an error message is fed back to the user;
[0148] The specific steps of step S2 are as follows:
[0149] Step S21: Get the rated take-off altitude, recorded as ho; record the take-off position as (Xo, Yo); record the target position as (Xe, Ye); record the working time as To;
[0150] Step S22: Obtain the number and weight of the objects carried, record the number of objects carried as n, and calculate the horizontal speed range of the UAV;
[0151] Calculate the optimal horizontal speed of the drone, denoted as Vm; Vm is calculated as follows:
[0152] ;
[0153] Calculate the worst horizontal speed of the drone, denoted as Vl; Vl = Vm / 2n;
[0154] Reference range of drone horizontal speed: [Vl, Vm];
[0155] It should be noted that the "load" in the present invention refers to the items or equipment carried by the drone when performing a flight mission; if the drone has no load, the value of n is 1, and the weight of the load in the subsequent step (step S25) is 0.
[0156] Step S23: Calculate the minimum speed of the vertical speed Vy of the drone; the minimum speed Vyl of Vy is calculated as follows:
[0157] ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0158] Step S24: Determine whether the drone is available;
[0159] Step S241: record the output power of the motor as W, the instantaneous acceleration as a, and the battery capacity as E; calculate the battery power supply time te, te = E / W;
[0160] Step S242: Obtain the current power of the drone, recorded as eo; calculate the available time ty of the drone, ; Determine whether ty is greater than or equal to To;
[0161] If ty is less than To, it means that the drone is unavailable, and an error message of "drone unavailable" is fed back to the user, and steps S25 to S28 are skipped;
[0162] If ty is greater than or equal to To, the take-off speed and take-off height of the UAV are calculated according to eo and ty, and the process goes to step S25;
[0163] Step S25: record the weight of the drone as m1 and the weight of the payload as m2; determine the take-off speed Vx1 and the maximum take-off altitude H1 of the drone at the speed V1;
[0164] It should be noted that if the drone has no payload, m2 is equal to 0;
[0165] Step S251: Calculate the minimum number of complete working times of the UAV in Vl, recorded as wn; wn is calculated as follows:
[0166] ;wn is rounded down;
[0167] Step S252: Calculate the maximum energy consumption of the drone at a time, ne, where ne=eo / wn, and ne is rounded down;
[0168] Step S253: Calculate the maximum take-off height Hm of the drone. Hm is calculated as follows:
[0169] ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0170] Calculate the maximum vertical speed Vym of the drone, ;
[0171] Step S254: Calculate the maximum acceleration time tym of the vertical speed of the drone. , a represents instantaneous acceleration;
[0172] Calculate the shortest acceleration time txl of the drone's horizontal speed, ;
[0173] Step S255: Determination and the size of Vl;
[0174] like If it is less than or equal to Vl, the horizontal acceleration time of the drone is txl and the take-off speed is Vl;
[0175] like is greater than Vl, then the horizontal acceleration time of the drone is txl, and the take-off speed is ;
[0176] Step S256: Determine the size of Hm and ho;
[0177] If Hm is greater than or equal to ho, the maximum take-off altitude Hm of the UAV remains unchanged;
[0178] If Hm is less than ho, the maximum take-off height Hm of the drone becomes ho;
[0179] Step S257: Summarize the take-off speed and maximum take-off altitude of the UAV determined in steps S255 to S256, and record them as Vx1 and H1 respectively;
[0180] Step S26: Determine the take-off speed Vx2 and the minimum take-off height H2 of the UAV at the speed Vm;
[0181] Step S261: Calculate the maximum number of complete working times of the UAV in Vm, recorded as wm; wm is calculated as follows:
[0182] ;wm is rounded down;
[0183] Step S262: Calculate the minimum energy consumption of the drone per time, ye, where ye = eo / wm, and ye is rounded down;
[0184] Step S263: Calculate the minimum take-off height H1 of the drone. H1 is calculated as follows:
[0185] ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0186] The minimum vertical speed of the drone Vyl is changed to Vyl`. The calculation formula of Vyl` is as follows:
[0187] ;
[0188] Step S264: Calculate the shortest acceleration time tyl of the vertical speed of the drone, tyl=(2Hl / a)1 / 2 ; Calculate the longest acceleration time txm of the drone's horizontal speed, , To represents working time;
[0189] Step S265: Determination and the size of the VM;
[0190] like If it is less than or equal to Vm, the horizontal acceleration time of the drone is txm and the take-off speed is Vm;
[0191] like is greater than Vm, the horizontal acceleration time of the drone is txl, and the take-off speed is ;
[0192] Step S266: Determine the size of H1 and ho;
[0193] If Hl is greater than or equal to ho, the minimum take-off height Hl of the drone remains unchanged;
[0194] If Hl is less than ho, the minimum take-off height Hl of the drone becomes ho;
[0195] Step S267: Summarize the take-off speed and minimum take-off altitude of the UAV determined in steps S265 to S266, and record them as Vx2 and H2 respectively;
[0196] Step S27: Calculate the coefficient of change of Vx1 with respect to Vx2 vb=log Vx2 (Vx1); horizontal speed of the drone ;
[0197] Calculate the coefficient of variation of H2 with respect to H1 hb = log H1 (H2); The flight altitude of the drone ;
[0198] Step S28: Select the shortest working route as the take-off route.
[0199] Step S3: construct a (UAV) avoidance model; obtain UAV images in real time, and judge and avoid obstacles according to the avoidance model;
[0200] Obtain the deflection status of the drone in real time and adjust the flight attitude of the drone;
[0201] Obtain the current position and speed of the drone in real time; adjust the flight speed or take-off route of the drone based on the drone’s current position, speed and target position;
[0202] The specific steps of step S3 are as follows:
[0203] Step S31: Obtaining unmanned real-time drone images through a high-definition camera;
[0204] Step S32: constructing a (UAV) avoidance model;
[0205] Step S321: using an inter-frame difference algorithm to define an expression for the obstacle target and background changes;
[0206] It should be noted that the "obstacle" in the present invention refers to objects such as trees, walls, houses, etc. that block the flight of the drone.
[0207] Step S3211: importing the CIFAR image library; randomly selecting an image containing an obstacle in the CIFAR image library as a test image;
[0208] Step S3212: Continuously extract test images, the number of extracted frames is 3; use A i (x, y) represents the i-th frame image, A i-2 (x, y) represents the (i-2)th frame image, D k (x, y) represents the difference between the i-th frame image and the (i-2)-th frame image, that is: D k (x,y)=|A i (x,y)-A i-2 (x,y)|; (x,y) represents the position of the obstacle in the test image;
[0209] Step S3213: Assume that each video frame image I(x,y,t) is composed of a background image b(x,y,t) and an obstacle target m(x,y,t): I(x,y,t)=b(x,y,t)+m(x,y,t); that is, D k (x,y) consists of two parts, namely obstacle target and background change:
[0210] D k (x,y)=b(x,y,i)-b(x,y,i-2)+m(x,y,i)-m(x,y,i-2);
[0211] [b(x,y,i)-b(xy,i-2)] represents the background change; [m(x,y,i)-m(x,y,i-2)] represents the change of the obstacle target; where t represents the time sequence;
[0212] Step S322: determining an image cropping area;
[0213] Step S3221: establishing an image detection window for the test image;
[0214] From the bottom of the image upwards, select rows with a height of h / 2, where h represents the length of the test image, and convert the test image into a grayscale image;
[0215] Step S3222: Record the transition points where the grayscale values of two consecutive frames in the grayscale image change from "0 to 1" or from "1 to 0" and mark them as (X 1 ,Y 1 ),(X 2 ,Y 2 )~(X q ,Y q ); where (X 1 ,Y 1 )~(X q ,Y q ) represents the coordinates of the transition point in the image detection window, and o represents the number of transition points;
[0216] Step S3223: Take the average value of the jump point and as the bottom point of the detection window, that is, select (X 1 +X 2 +~+X q ) / q is the bottom left point of the detection window, (Y 1 +Y 2 +~+Y q ) / q is the upper and lower points, and a rectangular image detection window is obtained, which is the image cropping area;
[0217] Step S323: Please refer to Figure 2 , establish a plane coordinate system;
[0218] Step S3231: the x-axis represents the direction indicating east, the y-axis represents the direction indicating north, the black solid dot represents the position of the UAV, the starting point represents the take-off position of the UAV, and the end point represents the target position or the docking position;
[0219] Step S3232: Define the avoidance logic for the drone encountering obstacles on the left side:
[0220] The direction of the drone's nose is fixed, always pointing from the starting point to the end point, and the speed is v;
[0221] When the drone is located at (X t1 ,Y t1 ) position, there is an obstacle on its left side;
[0222] The drone gets a speed v 1 , the direction of the speed is to the right (along the x-axis, that is, eastward), and by synthesizing it with the original speed v, a new speed v is generated t1 ;
[0223] Drone with v t1The speed of the drone passes the obstacle and the position of the drone becomes (X t2 ,Y t2 ); at position (X t2 ,Y t2 ) The drone has moved away from the obstacle and now returns to its original speed v;
[0224] It should be noted that the speed v in step S3232 1 ” will be described in the subsequent step (step S35).
[0225] Step S3233: Based on the avoidance logic of the left side of the drone encountering obstacles, define the avoidance logic of the right side and upper side of the drone encountering obstacles;
[0226] Step S324: Taking the AlexNet model as the basic model, taking steps S321 to S323 as the constraints of the fully connected layer, and obtaining the (UAV) avoidance model;
[0227] Step S33: inputting the drone image into the (drone) avoidance model to judge and avoid obstacles;
[0228] Step S34: obtaining the deflection state of the UAV in real time and adjusting the flight attitude of the UAV;
[0229] Step S341: Please refer to Figure 3 , taking the drone as the origin, the east direction as the X-axis, the north direction as the Y-axis, and the vertical direction to the ground (sky) as the Z-axis, construct a spatial coordinate system; detect whether the drone's gyroscope is offset;
[0230] If there is no deviation, continue monitoring;
[0231] If it deviates, it means that the drone encounters strong winds, and the wind speed is calculated, and the process goes to step S342;
[0232] Step S342: Correct the flight attitude of the drone in the "southwest wind from top to bottom"; obtain the current speed of the drone, recorded as vv; calculate the wind speed vw to which the drone is subjected; the calculation formula of vw is as follows:
[0233] ;
[0234] Calculate the vertical speed of the drone, recorded as vp, vp = (vv) 2 / 3 ; Define the vector expressions of vp, vv and vw:
[0235] vp vector , size |vp|, direction parallel to the (negative) Z axis;
[0236] Vector of vv , size |vv|, direction parallel to the (positive) Y axis;
[0237] vw vector , size |vw|;
[0238] , and satisfy: ;
[0239] Step S343: Calculate the angle θ1 between vw and the Z axis; the calculation formula of θ1 is as follows:
[0240] ;
[0241] Calculate the angle θ2 between vw and the Y axis; the calculation formula for θ2 is as follows:
[0242] ;
[0243] Step S344: adjusting the flight attitude of the drone, that is, the drone returns to positive θ1 degrees in the negative direction of the Z axis and returns to positive θ2 degrees in the positive direction of the Y axis;
[0244] Step S345: continuously monitor the gyroscope status of the UAV, repeat the same steps of correcting the flight attitude of the UAV in the "top-down southwest wind", and correct the flight attitude of the UAV in other wind directions;
[0245] Step S35: obtaining the current position and current speed of the drone in real time; adjusting the flight speed or take-off route of the drone according to the current position, current speed and target position of the drone;
[0246] Step S351: Get the current position of the drone, recorded as (xx1, yy1);
[0247] Step S352: Count the number of working routes other than the take-off route, recorded as rn; summarize the lengths of the first to rn working routes, recorded as l 1 ~l rn ;
[0248] Count the number of stops, recorded as sn; summarize the positions of stops 1 to sn, recorded as (sx 1 ,sy 1 ),~(sx sn ,sy sn );
[0249] Step S353: Calculate the distance ΔX from the current position of the drone to the target position. The calculation formula of ΔX is as follows:
[0250] ; Where (Xe, Ye) represents the target position;
[0251] Calculate the time coefficient of the drone's extended takeoff route, recorded as Δt, and the calculation formula of Δt is as follows:
[0252] ; Among them, (Xo, Yo) represents the take-off position, To represents the working time, and n represents the number of objects carried by the (drone);
[0253] Step S354: define judgment formula 351: ; where i represents 1 to rn; l i represents the length of the i-th working route;
[0254] Will l 1 ~l rn Substitute into judgment formula 351, select the working routes that meet judgment formula 351 as candidate routes, and count the number of candidate routes as fln;
[0255] Step S355: determine whether fln is 0;
[0256] If it is 0, it means that there is no working route that is better than the take-off route, and the flight speed or take-off route of the drone remains unchanged;
[0257] If it is not 0, the length of the take-off route is obtained as 11, and the judgment formula 352 is defined to proceed to step S356; the judgment formula 352:
[0258] ; where i represents 1 to fln; j represents 1 to sn; sx j and sy j Respectively represent the horizontal and vertical coordinates of the j-th stop position;
[0259] Step S356: Substitute the alternative route into the judgment formula 352, select the alternative route that satisfies the judgment formula 352 as the preferred route; read the length of the preferred route, recorded as fl;
[0260] Step S357: Calculate the adjusted horizontal flight speed zv and flight altitude zh of the UAV according to the preferred route;
[0261] The calculation formula of zv is: ; Where vv represents the current speed of the drone;
[0262] zh calculation formula: ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ;
[0263] Step S358: Change the take-off route of the UAV to the preferred route, adjust the horizontal flight speed to zv, and adjust the flight altitude to zh.
[0264] It should be noted that the speed v in the above step S3232 is 1 and speed v t1 The adjustment steps are the same as those in step S35.
[0265] Step S4: Feedback the error information and the drone image to the user; continue to monitor the drone until the current position of the drone coincides with the target position or the docking position.
[0266] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technical personnel in this field according to actual conditions. For example, if there are weight coefficients and proportional coefficients, their set sizes are to quantify each parameter to obtain a specific value, which is convenient for subsequent comparison. Regarding the size of the weight coefficient and the proportional coefficient, it is sufficient as long as it does not affect the proportional relationship between the parameter and the quantized value.
[0267] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A nonlinear adversarial strategy optimization method, characterized in that: The optimization method comprises: Step S1: Obtain the take-off position and the docking position of the drone to obtain the position information; Obtain the weight of the drone, the output power and instantaneous acceleration of the motor, and the battery capacity to obtain parameter information; Obtain the work route, work route length, work time and target location to obtain task information; Step S2: Obtain the quantity and weight of the drone's payload to determine whether the drone is available; If available, calculate and determine the takeoff speed, takeoff altitude and takeoff route of the UAV by combining the position information, parameter information and mission information; If it is not available, step S3 is skipped and an error message is fed back to the user; Step S3: construct an avoidance model; obtain drone images in real time, and judge and avoid obstacles based on the avoidance model; Obtain the deflection status of the drone in real time and adjust the flight attitude of the drone; Obtain the current position and speed of the drone in real time; adjust the flight speed or take-off route of the drone based on the drone’s current position, speed and target position; Step S4: Feedback the error information and the drone image to the user; continue to monitor the drone until the current position of the drone coincides with the target position or the docking position; The specific steps of step S2 are as follows: Step S21: Get the rated take-off altitude, recorded as ho; record the take-off position as (Xo, Yo); record the target position as (Xe, Ye); record the working time as To; Step S22: Obtain the number and weight of the objects carried, record the number of objects carried as n, and calculate the horizontal speed range of the UAV; Calculate the optimal horizontal speed of the drone, denoted as Vm; Vm is calculated as follows: ; Calculate the worst horizontal speed of the drone, denoted as Vl; Vl = Vm / 2n; Reference range of drone horizontal speed: [Vl, Vm]; Step S23: Calculate the minimum speed of the vertical velocity Vy of the drone, denoted as Vyl; Vyl is calculated as follows: ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ; Step S24: Determine whether the drone is available; Step S241: record the output power of the motor as W, the instantaneous acceleration as a, and the battery capacity as E; calculate the battery power supply time te, te = E / W; Step S242: Obtain the current power of the drone, recorded as eo; calculate the available time ty of the drone, ; Determine whether ty is greater than or equal to To; If ty is less than To, it means that the drone is unavailable, and a prompt indicating that the drone is unavailable is given to the user; If ty is greater than or equal to To, the take-off speed and take-off height of the UAV are calculated according to eo and ty, and the process goes to step S25; The subsequent steps of step S24 are as follows: Step S25: record the weight of the drone as m1 and the weight of the payload as m2; determine the take-off speed Vx1 and the maximum take-off altitude H1 of the drone at the speed V1; Step S26: Determine the take-off speed Vx2 and the minimum take-off height H2 of the UAV at the speed Vm; Step S27: Calculate the coefficient of change of Vx1 with respect to Vx2 vb=log Vx2 (Vx1); horizontal speed of the drone ; Calculate the coefficient of variation of H2 with respect to H1 hb = log H1 (H2); The flight altitude of the drone ; Step S28: Select the shortest working route as the take-off route; proceed to step S3, continuously monitor and adjust the flight speed, flight attitude and flight route of the UAV; The specific steps of step S25 are as follows: Step S251: Calculate the minimum number of complete working times of the UAV in Vl, recorded as wn; wn is calculated as follows: ;wn is rounded down; Step S252: Calculate the maximum energy consumption of the drone at a time, ne, where ne=eo / wn, and ne is rounded down; Step S253: Calculate the maximum take-off height Hm of the drone. Hm is calculated as follows: ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ; Calculate the maximum vertical speed Vym of the drone, ; Step S254: Calculate the maximum acceleration time tym of the vertical speed of the drone. , a represents instantaneous acceleration; Calculate the shortest acceleration time txl of the drone's horizontal speed, ; Step S255: Determination and the size of Vl; like If it is less than or equal to Vl, the horizontal acceleration time of the drone is txl and the take-off speed is Vl; like is greater than Vl, then the horizontal acceleration time of the drone is txl, and the take-off speed is ; Step S256: Determine the size of Hm and ho; If Hm is greater than or equal to ho, the maximum take-off altitude Hm of the UAV remains unchanged; If Hm is less than ho, the maximum take-off height Hm of the drone becomes ho; Step S257: Summarize the take-off speed and maximum take-off altitude of the UAV determined in steps S255 to S256, and record them as Vx1 and H1 respectively; The specific steps of step S26 are as follows: Step S261: Calculate the maximum number of complete working times of the UAV in Vm, recorded as wm; wm is calculated as follows: ;wm is rounded down; Step S262: Calculate the minimum energy consumption of the drone per time, ye, where ye = eo / wm, and ye is rounded down; Step S263: Calculate the minimum take-off height H1 of the drone. H1 is calculated as follows: ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ; The minimum vertical speed of the drone Vyl is changed to Vyl`. The calculation formula of Vyl` is as follows: ; Step S264: Calculate the shortest acceleration time tyl of the vertical speed of the drone, tyl=(2Hl / a) 1 / 2 ; Calculate the longest acceleration time txm of the drone's horizontal speed, , To represents working time; Step S265: Determination and the size of the VM; like If it is less than or equal to Vm, the horizontal acceleration time of the drone is txm and the take-off speed is Vm; like is greater than Vm, the horizontal acceleration time of the drone is txl, and the take-off speed is ; Step S266: Determine the size of H1 and ho; If Hl is greater than or equal to ho, the minimum take-off height Hl of the drone remains unchanged; If Hl is less than ho, the minimum take-off height Hl of the drone becomes ho; Step S267: Summarize the take-off speed and minimum take-off altitude of the drone determined in steps S265 to S266, and record them as Vx2 and H2 respectively.
2. A nonlinear confrontation strategy optimization method according to claim 1, characterized in that: The specific steps of step S3 are as follows: Step S31: Acquire unmanned real-time drone images; Step S32: constructing an avoidance model; Step S33: inputting the drone image into the avoidance model to judge and avoid obstacles; Step S34: obtaining the deflection state of the UAV in real time and adjusting the flight attitude of the UAV; Step S35: Acquire the current position and current speed of the drone in real time; adjust the flight speed or take-off route of the drone according to the current position, current speed and target position of the drone.
3. A nonlinear confrontation strategy optimization method according to claim 2, characterized in that: The specific steps of step S32 are as follows: Step S321: using an inter-frame difference algorithm to define an expression for the obstacle target and background changes; Step S3211: importing the CIFAR image library; randomly selecting an image containing an obstacle in the CIFAR image library as a test image; Step S3212: Continuously extract test images, the number of extracted frames is 3; use A i (x, y) represents the i-th frame image, A i-2 (x, y) represents the (i-2)th frame image, D k (x, y) represents the difference between the i-th frame image and the (i-2)-th frame image, that is: D k (x,y)=|A i (x,y)-A i-2 (x,y)|; (x,y) represents the position of the obstacle in the test image; Step S3213: Assume that each video frame image I(x,y,t) is composed of a background image b(x,y,t) and an obstacle target m(x,y,t): I(x,y,t)=b(x,y,t)+m(x,y,t); that is, D k (x,y) consists of two parts, namely obstacle target and background change: D k (x,y)=b(x,y,i)-b(x,y,i-2)+m(x,y,i)-m(x,y,i-2); [b(x,y,i)-b(xy,i-2)] represents the background change; [m(x,y,i)-m(x,y,i-2)] represents the change of the obstacle target; where t represents the time sequence; Step S322: determining an image cropping area; Step S3221: establishing an image detection window for the test image; From the bottom of the image upwards, select rows with a height of h / 2, where h represents the length of the test image, and convert the test image into a grayscale image; Step S3222: Record the transition points where the grayscale values of two consecutive frames in the grayscale image change from 0 to 1 or from 1 to 0, and mark them as (X1, Y1), (X2, Y2)~(X q ,Y q ); where (X1,Y1)~(X q ,Y q ) represents the coordinates of the transition point in the image detection window, and q represents the number of transition points; Step S3223: Take the average value of the jump point and as the bottom point of the detection window, that is, select (X1 + X2 + ~ + X q ) / q is the bottom point on the left side of the detection window, (Y1+Y2+~+Y q ) / q is the upper and lower points, and a rectangular image detection window is obtained, which is the image cropping area; Step S323: establishing a plane coordinate system; Step S3231: the x-axis represents the direction indicating east, the y-axis represents the direction indicating north, the black solid dot represents the position of the UAV, the starting point represents the take-off position of the UAV, and the end point represents the target position or the docking position; Step S3232: Define the avoidance logic for the drone encountering obstacles on the left side: The direction of the drone's nose is fixed, always pointing from the starting point to the end point, and the speed is v; When there is an obstacle on the left side of the drone, the drone accelerates to fly over the obstacle; after the drone moves away from the obstacle, it returns to its original speed v; Step S3233: Based on the avoidance logic of the left side of the drone encountering obstacles, define the avoidance logic of the right side and upper side of the drone encountering obstacles; Step S324: Taking the AlexNet model as the basic model, taking steps S321 to S323 as the constraints of the fully connected layer, and obtaining an avoidance model.
4. A nonlinear confrontation strategy optimization method according to claim 2, characterized in that: The specific steps of step S34 are as follows: Step S341: construct a spatial coordinate system with the drone as the origin, the east direction as the X-axis, the north direction as the Y-axis, and the vertical direction to the ground as the Z-axis; detect whether the drone gyroscope is offset; If there is no deviation, continue monitoring; If it deviates, it means that the drone encounters strong winds, and the wind speed is calculated, and the process goes to step S342; Step S342: Obtain the current speed of the drone, recorded as vv; calculate the wind speed vw to which the drone is subjected; the calculation formula of vw is as follows: ; Calculate the vertical speed of the drone, recorded as vp, vp = (vv) 2 / 3 ; Define the vector expressions of vp, vv and vw: vp vector , size |vp|, direction parallel to the Z axis; Vector of vv , size |vv|, direction parallel to the Y axis; vw vector , size |vw|; , and satisfy: ; Step S343: Calculate the angle θ1 between vw and the Z axis; the calculation formula of θ1 is as follows: ; Calculate the angle θ2 between vw and the Y axis; the calculation formula for θ2 is as follows: ; Step S344: Adjust the flight attitude of the drone, that is, the drone returns to the negative direction of the Z axis by θ1 degrees and returns to the positive direction of the Y axis by θ2 degrees.
5. A nonlinear confrontation strategy optimization method according to claim 2, characterized in that: The specific steps of step S35 are as follows: Step S351: Get the current position of the drone, recorded as (xx1, yy1); Step S352: Count the number of working routes other than the take-off route, recorded as rn; summarize the lengths of the 1st to rn working routes, recorded as l1 to l2. rn ; Count the number of stops, recorded as sn; summarize the positions of stops 1 to sn, recorded as (sx1, sy1), ~ (sx sn ,sy sn ); Step S353: Calculate the distance ΔX from the current position of the drone to the target position. The calculation formula of ΔX is as follows: ; Where (Xe, Ye) represents the target position; Calculate the time coefficient of the drone's extended takeoff route, recorded as Δt, and the calculation formula of Δt is as follows: ; Among them, (Xo, Yo) represents the take-off position, To represents the working time, and n represents the number of objects carried; Step S354: define judgment formula 351: ; Among them, i represents 1~rn; l i represents the length of the i-th working route; l1~l rn Substitute into judgment formula 351, select the working routes that meet judgment formula 351 as candidate routes, and count the number of candidate routes as fln; Step S355: determine whether fln is 0; If it is 0, it means that there is no working route that is better than the take-off route, and the flight speed or take-off route of the drone remains unchanged; If it is not 0, the length of the take-off route is obtained as 11, and the judgment formula 352 is defined to proceed to step S356; the judgment formula 352 is as follows: ; where i represents 1 to fln; j represents 1 to sn; l i represents the length of the i-th working route; sx j and sy j Respectively represent the horizontal and vertical coordinates of the j-th stop position; Step S356: Substitute the alternative route into the judgment formula 352, select the alternative route that satisfies the judgment formula 352 as the preferred route; read the length of the preferred route, recorded as fl; Step S357: Calculate the adjusted horizontal flight speed zv and flight altitude zh of the UAV according to the preferred route; The calculation formula of zv is: ; Where vv represents the current speed of the drone; zh calculation formula: ; Where g represents the acceleration due to gravity, which is 9.8 m / s 2 ; Step S358: Change the take-off route of the UAV to the preferred route, adjust the horizontal flight speed to zv, and adjust the flight altitude to zh.
