Virtual-real homologous bidirectional iteration unmanned aerial vehicle cluster agility test method, electronic equipment and medium
By using a bidirectional iterative approach that combines virtual and real-world components, and adjusting the simulation model using real machine parameters, the problems of high physical testing costs and inaccurate simulation reproduction in UAV swarm development are solved, achieving efficient simulation verification and shortening the development cycle.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV
- Filing Date
- 2026-01-16
- Publication Date
- 2026-04-21
AI Technical Summary
In the development of agile drone swarms, physical testing is costly, risky, and limited by specific scenarios. Simulations cannot accurately replicate the effects of real-world testing, leading to extended development cycles.
A bidirectional iterative approach based on the same source of virtual and real data is adopted. By running the same collaborative control algorithm on the virtual and real UAV swarms, the parameters in the simulation model are adjusted in reverse using the flight parameters of the real aircraft. Through a closed-loop process of repeated deviation comparison and simulation parameter correction, the consistency between the simulation model and the real aircraft is ensured, reducing the need for physical testing.
Simulation models can replace most of the actual debugging work, reduce testing costs and risks, overcome site and weather limitations, and shorten the R&D cycle.
Smart Images

Figure CN121900213A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of unmanned aerial vehicle (UAV) technology, and more specifically, to an agile testing method, electronic equipment, and medium for UAV swarms based on bidirectional iteration of virtual and real sources. Background Technology
[0002] In modern defense, energy security, and public safety, scenarios such as swarm warfare, power grid maintenance, and emergency rescue place increasingly stringent demands on operational efficiency, safety, and task coordination. Swarm warfare requires rapid penetration of target areas, distributed reconnaissance, and coordinated strikes to cope with complex battlefield environments. Power grid maintenance necessitates efficient fault diagnosis and status monitoring of remote mountainous areas and cross-regional transmission lines, avoiding the terrain and safety risks associated with manual inspections. Emergency rescue scenarios require rapid coverage of disaster areas to locate trapped personnel, assess the disaster situation, and accurately deliver supplies. These scenarios collectively highlight the urgent need for efficient, flexible, and reliable operational modes. Traditional single-equipment or manual operation modes are no longer sufficient, necessitating new technological solutions to overcome bottlenecks.
[0003] Agile drone swarms effectively overcome the limitations of traditional methods by combining the agility of single nodes with the collaboration of multiple nodes. At the individual drone level, each drone possesses rapid attitude adjustment, obstacle avoidance, and multi-sensor fusion perception capabilities, enabling it to independently complete precise operations in complex environments. At the swarm level, distributed collaborative control allows for dynamic formation reorganization, intelligent task allocation, and information sharing, creating advantages for large-scale operations. In practical applications, during swarm warfare, the swarm can evade enemy interception through millisecond-level formation changes and achieve fire coverage through multi-node collaboration; in power system maintenance, it can traverse mountainous terrain to complete power line inspections; and in emergency rescue, it can quickly establish communication links in disaster areas, providing real-time data support for rescue decisions, significantly improving operational efficiency and mission success rates.
[0004] However, the inherent limitations of the physical testing phase have become a major obstacle to the rapid deployment of agile drone swarm systems. A swarm system consists of multiple drones, and physical testing requires a sufficient number of drones and supporting ground control equipment, resulting in high costs for hardware procurement and maintenance alone. During testing, the complex swarm collaboration logic, especially with a large number of nodes, can easily lead to problems such as formation loss of control and node collisions, resulting in equipment damage and personnel safety issues. In extreme maneuvering tests such as swarm warfare, or in harsh environments such as strong winds during power line inspections, not only is the risk of equipment damage extremely high, but there are also potential safety hazards. Physical testing is limited by objective conditions such as site and weather, making it difficult to quickly conduct multi-scenario, high-frequency verification, thus extending the development cycle. Furthermore, if the simulated drone model differs from the actual drone in key dimensions such as model structure, controller structure, and interface protocols, even if the algorithm architecture and control parameters are optimized in the virtual environment, they cannot be directly applied to the actual drone due to compatibility issues, creating a disconnect between the virtual and the real world. When parameters that have been successfully debugged in the simulation are transferred to the actual drone, the actual results will still differ slightly from the simulation due to uncertainties in the real environment. The simulation model still requires accurate model data to optimize its structure. As a result, since the simulation cannot accurately reproduce the actual drone effect, the R&D process still needs to rely on high-frequency and high-cost physical testing, which cannot make up for the inherent defects of physical testing (high cost, high risk, and limited scenarios), ultimately leading to an extended R&D cycle. Summary of the Invention
[0005] In view of this, the purpose of this application is to provide a method, electronic device and medium for agile testing of UAV swarms based on bidirectional iteration of virtual and real sources. This can improve the problem that simulation cannot accurately reproduce the effect of the actual machine. The research and development process still needs to rely on high-frequency and high-cost physical testing, which cannot make up for the inherent defects of physical testing (high cost, high risk and limited scenarios), and ultimately leads to the extension of the research and development cycle.
[0006] To achieve the above technical objectives, the technical solution adopted in this application is as follows:
[0007] In a first aspect, embodiments of this application provide a method for agile testing of UAV swarms using a bidirectional iterative approach based on both virtual and real-world origins, the method comprising:
[0008] S100: Obtain the first trajectory deviation of the virtual drone swarm and the second trajectory deviation of the actual drone swarm, wherein the virtual drone swarm is a virtual model of the actual drone swarm in a virtual scene, and both the virtual drone swarm and the actual drone swarm are based on the same cooperative control algorithm.
[0009] S200: Compare the first trajectory deviation and the second trajectory deviation. When the difference between the first trajectory deviation and the second trajectory deviation is greater than the difference threshold, obtain the flight parameters of the UAV cluster.
[0010] S300: Based on the flight parameters, correct the simulation parameters of the virtual drone swarm so that the difference is reduced after the virtual drone swarm runs based on the corrected simulation parameters;
[0011] S400: Repeat S100-S300 until the difference between the first trajectory deviation and the second trajectory deviation is less than or equal to the difference threshold.
[0012] Furthermore, the flight parameters include motor thrust and throttle value, and the simulation parameters include inertial parameters;
[0013] The step of correcting the simulation parameters of the virtual drone swarm based on the flight parameters includes:
[0014] Based on the angular velocity of the machine body and the motor tension, the current inertial parameters are calculated;
[0015] The current inertial parameter is replaced with the previous inertial parameter to correct the simulation parameters.
[0016] Furthermore, the flight parameters include motor thrust, counter-torque, and motor rotational angular velocity, and the simulation parameters include motor parameters;
[0017] The step of correcting the simulation parameters of the virtual drone swarm based on the flight parameters includes:
[0018] Based on the motor tension, counter-torque, and motor rotational angular velocity, the current motor parameters are calculated according to the first preset model.
[0019] The current motor parameter is replaced with the previous motor parameter to correct the simulation parameters.
[0020] Furthermore, the motor parameters include motor joint damping, tension coefficient, and reverse torque constant;
[0021] The first preset model is:
[0022]
[0023] in, Provide power voltage to the motor. , , These are the motor tension, counter-torque, and motor rotational angular velocity, respectively.
[0024] Furthermore, the flight parameters include the motor rotational angular velocity and air pressure, and the simulation parameters include sensor parameters;
[0025] The step of correcting the simulation parameters of the virtual drone swarm based on the flight parameters includes:
[0026] Based on the motor rotational angular velocity and air pressure, the current sensor parameters are calculated according to the second preset model;
[0027] The current sensor parameter is replaced with the previous sensor parameter to correct the simulation parameters.
[0028] Furthermore, the sensor parameters include gyroscope noise, accelerometer noise, and barometer noise, and the second preset model is:
[0029]
[0030] in, It is the acceleration due to gravity. This is the average value from the barometer. Indicates gyroscope noise. Indicates accelerometer noise. This represents the noise level of the barometer. N1, N2, and N3 represent the number of data points collected by the gyroscope sensor, the accelerometer sensor, and the barometer sensor, respectively, where i1 = 1, 2…N1, i2 = 1, 2…N2, and i3 = 1, 2…N3. This represents the data of the angular velocity of the i1th machine body. This represents the data for the i2th acceleration. This represents the data for the i3rd air pressure.
[0031] Furthermore, the virtual drone swarm includes multiple virtual drones, and the actual drone swarm includes multiple actual drones; prior to S100, the method further includes: configuring an undirected graph. This is used to describe the communication topology of virtual and real drone swarms, where the vertex set... The edge set corresponds to the nodes of all virtual drones in the virtual drone swarm and the nodes of all actual drones in the actual drone swarm. This corresponds to the two-way communication link between virtual drones and the two-way communication link between actual drones;
[0032] Based on the undirected graph, obtain the first self-state and the first neighbor state of each virtual drone, and obtain the second self-state and the second neighbor state of each actual drone.
[0033] Based on all the first self-state and first neighbor state inputs, the current first control variable of each virtual drone is obtained, and based on all the second self-state and second neighbor states, the current second control variable of each actual drone is obtained.
[0034] The current first control value is input into the corresponding virtual drone, and the current second control value is input into the corresponding actual drone, so that the virtual drone operates according to the current first control value, and the actual drone operates according to the current second control value, and then the steps of obtaining the first trajectory deviation of the virtual drone group and the second trajectory deviation of the actual drone group are executed.
[0035] Further, based on all the first self-state and first neighbor state inputs, the current first control variable of each virtual drone is obtained, and based on all the second self-state and second neighbor states, the current second control variable of each actual drone is obtained, including:
[0036] Configure the trajectory tracking cost function, expressed as:
[0037]
[0038] , These are the position deviation weight matrix and the velocity deviation weight matrix, respectively. , For the desired position and velocity, Let the virtual drone and the actual drone be in three-dimensional position at time k. Let the virtual drone and the actual drone have their velocities at time k. ;
[0039] The configuration control smoothness cost function is expressed as:
[0040]
[0041] The weight matrix is used to control the smoothness of the input. To control the input, it is expressed as total tension and triaxial torque. ;
[0042] The obstacle avoidance cost function and the neighbor collision avoidance cost function are respectively expressed as follows:
[0043]
[0044] , These are indexes for obstacles and neighboring drones, respectively. , , These represent the current virtual or actual drone position, the i-th obstacle position, and the positions of neighboring virtual or actual drones, respectively. This is the weight matrix. The set collision safety distance;
[0045] The configuration formation preservation cost function is expressed as:
[0046]
[0047] This represents the expected formation distance between adjacent virtual drones, or adjacent real drones. To maintain the term weight matrix for formation;
[0048] The total cost function is configured as follows:
[0049]
[0050] Where J is the total cost function;
[0051] This represents the trajectory tracking cost function;
[0052] This represents the cost function for controlling smoothness;
[0053] This represents the obstacle avoidance cost function;
[0054] This represents the formation preservation cost function;
[0055] Represent the neighbor collision avoidance cost function;
[0056] All first self-states and first neighbor states, as well as all second self-states and second neighbor states, are input into the total cost function so that, after solving, the current first control variable of each virtual UAV and the current second control variable of each actual UAV are obtained.
[0057] Secondly, embodiments of this application also provide an electronic device, characterized in that the electronic device includes a processor and a memory coupled to each other, the memory storing a computer program, and when the computer program is executed by the processor, the electronic device performs the above-described method.
[0058] Thirdly, embodiments of this application also provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when run on a computer, causes the computer to perform the above-described method.
[0059] The invention employing the above technical solution has the following advantages:
[0060] In the technical solution provided in this application, firstly, by having the virtual and actual drone swarms run the same collaborative control algorithm, the interference of algorithm differences on trajectory deviation is eliminated; then, using the flight parameters of the actual aircraft, the corresponding parameters in the simulation model are adjusted in reverse to ensure that the physical characteristics of the virtual model are consistent with those of the actual aircraft; finally, through a closed-loop process of repeated deviation comparison and simulation parameter correction, the difference between the first trajectory deviation and the second trajectory deviation is continuously reduced to within the threshold, enabling the simulation model to have the ability to reproduce the flight effect of the actual aircraft. This allows simulation to replace most of the actual aircraft debugging work, thereby eliminating the need to rely on high-frequency actual aircraft testing to complete algorithm parameter optimization and multi-scenario verification, reducing the cost and risk of actual aircraft testing, and overcoming objective limitations such as site and weather. The efficient iteration of simulation shortens the R&D cycle. Attached Figure Description
[0061] This application can be further illustrated by the non-limiting embodiments given in the accompanying drawings. It should be understood that the following drawings only illustrate certain embodiments of this application and should not be considered as limiting the scope. For those skilled in the art, other related drawings can be obtained from these drawings without any inventive effort.
[0062] Figure 1 A flowchart of the agile testing method for a drone swarm based on bidirectional iteration with virtual and real origins provided in this application embodiment.
[0063] Figure 2 The overall structure of the agile flight swarm of unmanned aerial vehicles provided in this application embodiment.
[0064] Figure 3 This is a schematic diagram of the motor distribution method provided in the embodiments of this application.
[0065] Figure 4 A simulation model diagram of a drone swarm provided in an embodiment of this application.
[0066] Figure 5 A diagram of a real-world drone swarm platform provided in this application embodiment.
[0067] Figure 6 A three-dimensional spatial location trajectory diagram of a drone swarm provided in an embodiment of this application.
[0068] Figure 7A diagram illustrating the effect of three-dimensional position trajectory tracking of a drone swarm provided in an embodiment of this application.
[0069] Figure 8 The static and dynamic obstacle avoidance effect of the drone swarm provided in the embodiments of this application.
[0070] Figure 9 The position tracking error of the drone swarm simulation provided in the embodiments of this application.
[0071] Figure 10 The actual position tracking error of the UAV cluster provided in the embodiments of this application.
[0072] Figure 11 The simulation position tracking error is provided after the model is optimized for the embodiments of this application.
[0073] Figure 12 The actual machine position tracking error after model optimization provided in the embodiments of this application. Detailed Implementation
[0074] The present application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that similar or identical parts are referred to by the same reference numerals in the drawings or description. Implementations not shown or described in the drawings are forms known to those skilled in the art. In the description of this application, terms such as "first" and "second" are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0075] This application provides an electronic device that may include a processing module and a storage module. The storage module stores a computer program, which, when executed by the processing module, enables the electronic device to perform corresponding steps in the following virtual-real source bidirectional iterative agile test method for drone swarms.
[0076] Please refer to Figure 1 This application also provides a method for agile testing of UAV swarms using a bidirectional iterative approach based on both virtual and real-world data. This method may include the following steps:
[0077] S100: Obtain the first trajectory deviation of the virtual drone swarm and the second trajectory deviation of the actual drone swarm, wherein the virtual drone swarm is a simulation model of the actual drone swarm on the simulation end, and the virtual drone swarm and the actual drone swarm are both based on the same cooperative control algorithm;
[0078] S200: Compare the first trajectory deviation and the second trajectory deviation. When the difference between the first trajectory deviation and the second trajectory deviation is greater than the difference threshold, obtain the flight parameters of the UAV cluster.
[0079] S300: Based on the flight parameters, correct the simulation parameters of the virtual drone swarm so that the difference is reduced after the virtual drone swarm runs based on the corrected simulation parameters;
[0080] S400: Repeat S100-S300 until the difference between the first trajectory deviation and the second trajectory deviation is less than or equal to the difference threshold.
[0081] In the above implementation, the actual drone swarm includes multiple actual drones. These drones utilize an "X"-shaped quadcopter as the basic platform, whose vertical takeoff and landing and hovering flexibility allow for rapid swarm deployment and flexible task scheduling. The lightweight and simple structure ensures both the drones' flight agility and economic efficiency in multi-drone collaborative scenarios. Performance-wise, a stable power system and lightweight fuselage enhance the agility of individual drone start-stop and attitude adjustment. A low-latency communication module and RTK positioning + IMU combined navigation ensure synchronized status and accurate relative position perception among multiple drones. Structurally, the "X"-shaped quadcopter design unifies fuselage size and center of gravity distribution, resulting in higher formation regularity and improved swarm collaboration stability. Compared to the "+" type quadcopter, the diagonal symmetrical design of the "X" type layout can quickly complete attitude adjustments such as roll and pitch through differentiated rotation speeds, and the response speed is more in line with the agility requirements of a single aircraft. Compared with six- or eight-rotor models, its structure is simpler and the maintenance cost is lower. The lightweight design can effectively avoid the shortcomings of insufficient endurance of multi-rotor models, and provide support for long-term collaborative tasks in a cluster.
[0082] To achieve the core functions of agile single-aircraft flight and collaborative swarm operations, such as Figure 2 As shown, the system's performance and structural module design is divided into four aspects: power unit, computing unit, communication unit, and navigation and positioning unit, which work together to meet the dual requirements of single-machine reliability and cluster functionality.
[0083] 1. Power unit
[0084] 1.1 Rack
[0085] Common structural forms of quadcopter drones include cross-shaped, X-shaped, and other special configurations. Compared to the cross-shaped structure, the X-shaped structure offers higher flight stability and a simpler mechanical layout. The overall structure includes the fuselage and landing gear. The layout design must clearly define the installation positions of the battery rack, power distribution board, ESC, flight controller, data transmission module, onboard computer, and RTK positioning module, ensuring that the wiring harness length is appropriate and the wiring is neat. At the same time, the drone's center of gravity is adjusted by optimizing the position of components to ensure flight attitude stability.
[0086] 1.2 Motor blades
[0087] To meet the core requirements of agile flight, suitable power components must be selected, and an efficient and stable power system must be built. Excessive power supply will directly increase the overall weight of the drone, resulting in wasted power and reducing the overall efficiency of the power system. Insufficient power supply will lead to insufficient system power output, causing motor overload and burnout, thus increasing the risk of a crash. Therefore, brushless motors with the corresponding power level must be selected, and a reasonable power margin must be reserved to ensure that the drone can adapt to complex operating conditions such as attitude adjustment and wind resistance. In short:
[0088]
[0089] In the formula: T is the total tension provided by the power system;
[0090] W represents the total weight of the drone.
[0091] E represents the power required for the UAV's maneuvering and wind resistance.
[0092] E, representing the power required for the drone's maneuvering, is a floating value. Typically, a portion of the output thrust from a single motor is used for hovering, while the remaining power is reserved for flight maneuvers and wind resistance. The overall weight should be less than 2 / 5 of the motor's maximum power; this drone is designed to weigh 1.5 kg. Proper matching of the motor and propellers is crucial for improving the efficiency of the power system. A core motor parameter directly related to propeller selection is the KV value, defined as the motor's rotational speed increase when 1V is applied under no-load conditions. Motors with lower KV values can handle greater power and generate greater torque to drive larger propellers. The basic selection principle is to use smaller propellers with higher KV value motors and larger propellers with lower KV value motors. Therefore, this design uses the Tmotor F90 KV1300 motor, paired with an 8-inch two-blade propeller, to ensure the drone's basic lift and maneuvering requirements.
[0093] 1.3 Battery and ESC
[0094] The ESC amplifies the input signal and receives the PWM signal transmitted from the flight controller to adjust the motor output voltage, thereby adjusting the motor speed. The ESC needs to be matched to the motor's maximum current and have sufficient margin to prevent instantaneous current overload from burning out the ESC.
[0095] Batteries primarily provide energy to the power system. Their weight, capacity, and discharge rate affect the drone's flight efficiency and endurance. For example, a 5200mAh battery, discharging at 5.2A, can operate for one hour. Using a battery with too large a capacity increases the overall weight of the drone, reducing flight efficiency; using a battery with too small a capacity results in insufficient endurance, making it impossible to conduct a complete test.
[0096] The formula for calculating battery life is:
[0097]
[0098] in, For battery life, This refers to the total battery capacity (mAh). This is the minimum protection capacity for battery discharge, typically set at 0.15~0.2. , The total battery current must not exceed the maximum discharge current.
[0099]
[0100] in, This represents the discharge rate.
[0101] To ensure that the system's operating time is sufficient to support the completion of basic cluster flight tests, and to prevent the battery from becoming too large or heavy, which would reduce the system's efficiency and thus not significantly increase the operating time, a current value of 7.22A at 50% throttle was set, which determined that a 4000mAh lithium battery would be used.
[0102] 2. Calculation Unit
[0103] 2.1 Onboard computer
[0104] The onboard computer of the UAV agile flight swarm system is used to deploy and run algorithms for swarm trajectory planning, collaborative control, and group obstacle avoidance. The Magic Cube M6S onboard computer is compact and portable, using an Intel 12th generation N100 quad-core CPU processor with a frequency of up to 3.4GHz and 12GB of RAM, providing the speed and capability for running the system's algorithms. The onboard computer is equipped with a gigabit Ethernet port, dual HDMI ports, and a USB communication port to meet system requirements. Control commands are output to the underlying flight controller via the USB interface. Through efficient data processing and stable communication collaboration, it supports the UAV swarm system in completing diverse and complex tasks in complex dynamic environments, ensuring the agility, collaboration, and reliability of swarm flight.
[0105] 2.2 Flight Control
[0106] To ensure the agile and stable flight of a drone swarm, the flight controller needs to receive position, attitude, and speed control commands to control the rotor speed and track the desired trajectory. The NxtPX4v2 is small, lightweight, and high-performance, using an STM32H7 series processor and integrating dual BMI088 high-performance, low-noise IMU sensors, along with an SPL06 barometer sensor, ensuring the drones are aware of their own inertia and altitude. For expansion interfaces, it features an RC receiver, a serial port for the data transmission module, and a GPS interface, facilitating the connection of subsequent data transmission modules and RTK positioning modules for swarm communication. For communication with the onboard computer, a USB-Type-C interface is provided to receive upper-level control commands.
[0107] 2.3 Communication Unit
[0108] At the system communication level, a low-latency signal transmission channel needs to be constructed to ensure real-time interaction between control commands and status data, guaranteeing the timeliness and accuracy of information transmission and providing strong support for the collaborative operation of the system. Amu Labs' LQ UAV star-shaped mesh networking data transmission module boasts excellent high-bandwidth transmission performance and stability. The device consists of a ground end and a sky end. The sky end is compact and lightweight, weighing as little as 30.6g, making it ideal for mounting on UAVs and other equipment. Simultaneously, LQ possesses ultra-long-range transmission capabilities, with a maximum transmission distance exceeding 3000m under ideal conditions, meeting a wide range of communication needs. It supports web-based visual configuration for easier operation; with a maximum transmission bandwidth of 40Mbps, its high-bandwidth, low-latency data transmission characteristics enable real-time processing of large amounts of data, ensuring the smoothness and stability of cluster communication.
[0109] 2.4 Navigation and Positioning Unit
[0110] In terms of navigation and positioning, the UAVs are planned to integrate a multi-source fusion positioning scheme and be equipped with a centimeter-level high-precision RTK positioning module to ensure that the UAV agile flight swarm system can accurately grasp its own position information during operation. RTK real-time dynamic positioning technology is a high-precision differential GNSS global navigation satellite system positioning technology based on carrier phase observation, providing centimeter-level positioning with higher accuracy than GPS. The Quanfang R3C RTK positioning module is small, highly integrated, easy to install, and requires no configuration. Its data interface transmits data via serial port, adapting to the interface configuration of this UAV flight control system. The RTK positioning module ensures the accurate self-positioning of the UAV swarm outdoors, facilitating precise control of the UAVs.
[0111] The simulation is built using Gazebo, a 3D dynamic simulator that supports deployment on multiple platforms including Linux, macOS, and Windows. It is integrated with the ROS robot operating system and includes a rich library of robot models and environments, a variety of sensors with noise models, and multiple precise physics engines. It can accurately simulate complex indoor and outdoor environments and robot swarms, as well as perform high-fidelity physical simulations. Custom physics engine plugins can be written, the program is easy to design, and it has multiple user interfaces, including command line, graphical, and web interfaces, providing a very user-friendly interactive experience.
[0112] Gazebo acquires model parameters of actual drones by loading SDF files. SDF (Simulation Description Format) files contain detailed information describing the model's geometry, physical properties, joints, sensors, and other model attributes. They define the model's geometry, materials, motion rules, etc., and are used to load the robot model into the Gazebo simulation software.
[0113] The UAV model parameters in the SDF file mainly include modifications to inertial parameters, geometric parameters, motor parameters, sensor parameters, and aerodynamic parameters to make the simulation model closely resemble the physical model of a real UAV. Initial model parameters are initialized based on physical measurements, hardware specifications, and theoretical formulas. Specifically:
[0114] The inertial parameters include the mass of the fuselage and rotor assembly, as well as the moment of inertia of the fuselage. The mass of the fuselage and rotor assembly can be directly measured using an electronic scale.
[0115] For a standard quadcopter drone, which has centrosymmetric characteristics, the moment of inertia matrix can be simplified as follows:
[0116]
[0117] The central principal moment of inertia was measured using the double-line pendulum method. The upper ends of two thin ropes were tied to a horizontally placed thin rod, and the lower ends were fixed to the multi-rotor fuselage. The two contact points were at the same height and evenly distributed on both sides of the center of gravity.
[0118] Rotate the multirotor around Oz by a small angle and record the time T for 50 oscillation cycles. Then the period of the bilinear pendulum is T0 = T / 50. The central principal moment of inertia measured in this experiment is... for
[0119]
[0120] in For multi-rotor mass, This represents the local gravitational acceleration. By successively changing the suspension axis to the x and y axes of the aircraft and substituting these values into the calculation, we obtain... , .
[0121] The geometric parameters include the body dimensions and the motor's coordinates relative to the body center. The body dimensions are measured using calipers to determine the length, width, and height of the body, and the motor coordinates are also obtained by direct measurement of the three-dimensional coordinates relative to the body center.
[0122] Motor parameters: including maximum speed Ascent and descent time constants Tensile constant Anti-torque constant of propeller Etc., rise and fall time constants Referring to the motor specifications, the calculation formulas for other parameters are as follows:
[0123]
[0124] in, , The motor's KV value and the supply voltage are given. , , The data on the pulling force, counter-torque, and motor rotational angular velocity were measured at a certain throttle position when the motor was equipped with a propeller.
[0125] Aerodynamic parameters, including the drag coefficient and roll moment coefficient of the UAV, are used to represent the roll disturbance torque caused by aerodynamic asymmetry of a single blade, etc., and are derived from the air drag formula and the rotor roll moment formula:
[0126]
[0127] The formulas for calculating the rotor drag coefficient and rolling moment coefficient are as follows:
[0128]
[0129] in, air density, The rotor radius is... For windward area, For the blade area, For wind speed, The rolling torque of a single rotor. This represents the angular velocity of the motor. The magnitude of the resistance was obtained from simulation experiments using simulation software. Set to a tiny default value.
[0130] Sensor parameters represent the sensor type, physics engine, and sensor noise. The output data of the simulated sensors are adjusted by setting these parameters. Referring to the hardware specifications of a real flight controller, the noise density, random walk coefficient, and output frequency of the gyroscope, accelerometer, and barometer are set. For devices where the noise density is not given, it can be derived from bias stability.
[0131]
[0132] in, For noise density, For bias stability, the random walk coefficients are derived from the noise density:
[0133]
[0134] in This refers to the system bandwidth.
[0135] After constructing a simulation model that is identical to the actual machine, its physical characteristics are highly consistent with the real machine. Conducting frequent, full-scenario simulation experiments based on this model can fully verify the effectiveness and robustness of the cluster cooperative control algorithm. Furthermore, because the simulation and the actual machine share the same physical characteristics, under the same cluster cooperative control algorithm architecture, the core configurations such as control parameters and formation strategies obtained through iterative optimization during the simulation process can be quickly transferred to the actual machine system. This directly supports the implementation of actual cluster experiments, significantly shortening the cycle from algorithm verification to actual machine deployment, while also reducing the cost and risk of actual machine debugging.
[0136] This embodiment first constructs a virtual-real homogeneous model, building a homogeneous simulation environment based on Gazebo and ROS. Key parameters such as UAV inertia, geometry, and motors are configured using SDF files, and an environmental scenario is established. Under the same controller structure and related interface protocols in both the simulation and the actual aircraft, the core algorithms for swarm formation control, task allocation, and obstacle avoidance in the simulation environment are repeatedly debugged to obtain control parameter combinations. Subsequently, this control parameter combination is migrated to the actual aircraft for practical testing. While verifying the algorithms on the actual aircraft, flight data is recorded to calculate model parameters. Based on the actual test results, it is determined whether the simulation model needs to be optimized and whether further simulation debugging is required. This iterative process continuously improves the consistency between the simulation model and the actual aircraft, as well as the reliability of the control parameters, until the swarm operation performance requirements are met.
[0137] Based on this, the steps of the agile testing method for UAV swarms based on bidirectional iteration with virtual and real origins will be described in detail below:
[0138] The cooperative control algorithm described in S100 is based on Model Predictive Control (MPC) to achieve cooperative flight between virtual and real UAV swarms. MPC is an advanced control method based on rolling optimization. It generates a control sequence and executes the control input at the current moment by solving a finite-time domain optimization problem in each control cycle, then updates the state and repeats the optimization process in the next cycle. Its core advantage lies in its ability to explicitly handle constraints (such as physical limitations and safety distances) and estimate future states through predictive models, thereby achieving forward-looking decision-making in dynamic environments. In swarm control, MPC can integrate cooperative constraints among multiple agents, achieving decentralized cooperative control through distributed optimization and avoiding the risk of single-point failures.
[0139] In this embodiment, prior to S100, the process of the simulated UAV swarm executing the cooperative control algorithm on the simulation end is as follows:
[0140] The simulation client loads the SDF file and configures initial parameters, including inertial, motor, and sensor parameters. The communication topology between the simulated UAVs can be configured using an undirected graph. To achieve this, where the vertex set The edge set corresponds to all UAV nodes in the cluster. For bidirectional communication links between UAVs, if UAVi and UAVj can directly exchange information, then the edge Furthermore, due to the bidirectional reachability of the communication link, it satisfies... To accurately describe the communication range of a single node, the concept of a neighborhood set is introduced: UAVi's neighborhood set. Defined as the set of all nodes that have a direct communication link with that node, i.e. .
[0141] Connectivity is a core property of communication topology, directly determining the collaborative capabilities of a cluster. In graph theory, if for any two distinct vertices... Both have edge sequences of finite length. Then it is called a diagram. This is a connected graph. For agile UAV swarms, connectivity ensures that critical information from any UAV can be transmitted to all nodes in the swarm via direct or indirect links. In this embodiment, a 5-node ring topology is used. This multi-path characteristic also enhances the swarm's anti-interference capability—when a link is interrupted due to obstruction or interference, information can be transmitted via an alternative path.
[0142] The state of each virtual drone and the actual drone (hereinafter collectively referred to as drone) can be represented as follows:
[0143]
[0144] , These represent the three-dimensional position and velocity of the UAV at time k. .
[0145] The neighbor state is obtained based on the 5-node ring topology. That is, the neighbor state of each drone is the state of the two drones connected to it. It can be understood that for a single virtual drone, its neighbor state is the state of the two other virtual drones connected to it, and for a single real drone, its neighbor state is the state of the two other real drones connected to it.
[0146] The virtual drone's own state and the states of its neighbors are input into a preset objective function, which is then combined with the desired trajectory from a pre-defined trajectory file. and and the expected relative position of the formation The constrained minimization problem described above is solved using numerical optimization algorithms (such as interior-point methods and sequential quadratic programming) to obtain the control sequence in the prediction time domain. Only retain the control quantity at the current moment. Used for execution.
[0147] in , This represents the total pull (total thrust) of the i-th UAV in the simulation at the current moment. Let x, y, and z represent the rolling control torque of the i-th UAV on the simulation terminal around the x-axis, the rolling control torque of the i-th UAV on the simulation terminal around the y-axis, and the rolling control torque of the i-th UAV on the simulation terminal around the z-axis at the current moment, respectively. x, y, and z are all based on the coordinate system of the simulation terminal.
[0148] Will After inputting the corresponding virtual drone, the virtual drone is based on run.
[0149] The preset objective function in this embodiment is achieved through the following steps:
[0150] Configure the trajectory tracking cost function, expressed as:
[0151]
[0152] , This is the weight matrix. , The desired position and velocity are given. The control smoothness cost is achieved by summing the squared differences in the control variables between adjacent time steps to suppress high-frequency jitter in the control variables.
[0153] The configuration control smoothness cost function is expressed as:
[0154]
[0155] This is the weight matrix. To control the input, it is expressed as total tension and triaxial torque. .
[0156] The obstacle avoidance cost function and the neighbor collision avoidance cost function are respectively expressed as follows:
[0157]
[0158] , These are indexes for obstacles and neighboring drones, respectively. , , These represent the current virtual or actual drone position, the i-th obstacle position, and the positions of neighboring virtual or actual drones, respectively. This is the weight matrix. The set collision safety distance;
[0159] Configure a formation-maintaining cost function. This cost constrains the relative positions of drones within the cluster, ensuring they maintain a preset formation. By quantifying the deviation between the actual relative positions of drones and their neighbors and the desired formation offset, the error is accumulated over the entire prediction time domain as a quadratic cost. This forces the optimizer to adjust the control inputs, ensuring that the drones always maintain the set relative distribution relationship. Therefore, the formation cost function is expressed as:
[0160]
[0161] This represents the expected formation distance between adjacent virtual drones, or adjacent real drones. The weight matrix for the formation preservation terms;
[0162] The total cost function is configured as follows:
[0163]
[0164] Where J is the total cost function;
[0165] This represents the trajectory tracking cost function;
[0166] This represents the cost function for controlling smoothness;
[0167] This represents the obstacle avoidance cost function;
[0168] This represents the formation preservation cost function;
[0169] Represent the neighbor collision avoidance cost function;
[0170] Based on the total cost function, controller optimization constraints are added. The control input must match the physical capabilities of the actuator to avoid exceeding the hardware output range. Constraints are placed on the thrust and the UAV's related state range.
[0171]
[0172] For quadcopter thrust, , , For roll angle, pitch angle, and drone speed.
[0173] Input all the first self-state and first neighbor state, as well as all the second self-state and second neighbor state, into the total cost function, and after solving, obtain the first control quantity and the second control quantity.
[0174] Through the above design, the MPC controller can achieve high-precision trajectory tracking and dynamic environment adaptation while meeting the constraints of cluster collaboration and obstacle avoidance.
[0175] Therefore, prior to S100, it is necessary to calculate and store the first trajectory deviation and the second trajectory deviation. Based on the above scheme, the method for calculating the first trajectory deviation and the second trajectory deviation is as follows:
[0176] Configure undirected graph This is used to describe the communication topology of a virtual drone swarm and a real drone swarm; based on the undirected graph, a first self-state and a first neighbor state of each virtual drone are obtained, and a second self-state and a second neighbor state of each real drone are obtained; all the first self-states and first neighbor states are input into a preset objective function of the cooperative control algorithm to obtain a current first control variable for each virtual drone, and all the second self-states and second neighbor states are input into a preset objective function of the cooperative control algorithm to obtain a current second control variable for each real drone; the current first control variable is input into the corresponding virtual drone, causing the virtual drone to operate based on the current first control variable, and the current second control variable is input into the corresponding real drone, causing the real drone to fly based on the current second control variable, thereby realizing the steps of obtaining the first trajectory deviation of the virtual drone swarm and the second trajectory deviation of the real drone swarm.
[0177] Therefore, in this embodiment, after the simulation terminal executes the current first control variable, it reads the desired position at the corresponding time from the preset trajectory file. The actual terminal obtains the actual position from the sensor fusion data (GPS+IMU) of the UAV flight controller (such as PX4); and reads the desired position at the corresponding time from the mission instructions issued by the ground station.
[0178] Finally, based on the difference between the expected and actual positions of the simulated drone and the actual drone, and by calculating the root mean square of all differences, the first trajectory deviation and the second trajectory deviation are obtained and stored.
[0179] Therefore, in S100, based on the aforementioned electronic device, the first trajectory deviation and the second trajectory deviation in the storage module are obtained.
[0180] In S200, the first trajectory deviation and the second trajectory deviation are compared, that is, the difference between the first trajectory deviation and the second trajectory deviation is calculated. When the difference is greater than the difference threshold, it indicates that the matching degree between the simulation model and the actual machine is insufficient, and the "virtual-real deviation" exceeds the acceptable range. The core parameters of the simulation model (such as sensor noise, inertial parameters, and motor parameters) need to be corrected.
[0181] In this embodiment, the setting of the difference threshold is related to the specific scenario of actual drone swarm application. For example, swarm warfare requires high accuracy, so the difference threshold is set relatively small; power maintenance and inspection require lower accuracy, so the difference threshold is set relatively large. At the same time, the difference threshold must be greater than the system's own random fluctuation error (i.e., the natural fluctuation range of the deviation when there are no parameter / algorithm changes), otherwise random fluctuations will be misjudged as valid differences.
[0182] When the difference between the first trajectory deviation and the second trajectory deviation is greater than the difference threshold, the simulation parameters of the virtual drone need to be corrected based on the actual flight parameters of the drone swarm.
[0183] In this embodiment, the flight parameters include the motor thrust and throttle values of each actual drone. The inertial parameters of the corresponding virtual drone are corrected based on the motor thrust and throttle values. The correction method is as follows:
[0184] Based on the angular velocity of the machine body and the motor tension, the current inertial parameters are calculated; the current inertial parameters are then replaced with the previous inertial parameters to correct the simulation parameters.
[0185] In this embodiment, before the difference is less than the difference threshold, the simulation parameters are corrected for multiple cycles. The correction method for each cycle is described in S100-S300. Simultaneously, in each cycle, the virtual UAV swarm and the actual UAV swarm obtain the first control quantity and the second control quantity respectively based on the same cooperative control algorithm, and operate based on the first and second control quantities. Therefore, "current" and "previous" here refer to the current cycle and the previous cycle.
[0186] In the S300, simulation parameters are corrected using actual flight parameters. Essentially, this aligns the actual UAV with the virtual UAV. Specifically, it uses real noise data from the actual UAV's sensors (such as measured noise from gyroscopes and accelerometers) to correct the simulation's sensor parameters—ensuring the simulation's "perception error" matches the actual UAV, avoiding trajectory discrepancies caused by perception bias. It also uses real force and torque data from the actual UAV's motors (such as measured force coefficient kT and damping b) to correct the simulation's motor parameters, ensuring the simulation's power output response matches the actual UAV. Finally, it uses real angular velocity and angular acceleration data from the actual UAV (such as measured moment of inertia) to correct the simulation's inertia, ensuring the simulation's "attitude adjustment speed" matches the actual UAV, thereby reducing the difference.
[0187] The inertial parameters are calculated as follows:
[0188]
[0189] in, For the body's angular velocity, For the fuselage lever arm, It is the inverse torque constant. This corresponds to the tension on motor i. The tension value can be obtained from the motor's data reference book regarding the relationship between throttle and tension. The current throttle value and the machine's angular velocity are output via the Mavros topic.
[0190] In the above formula, , These represent the pulling force output by the four motors of the actual drone, and their specific distribution is as follows: Figure 2 As shown, where Figure 3 The pulling force output by motor No. 1 is expressed as The pulling force output by motor No. 2 is expressed as The pulling force output by motor No. 3 is expressed as The pulling force output by motor No. 4 is expressed as .
[0191] Therefore, once the current inertial parameters are calculated, the current inertial parameters are replaced with the previous inertial parameters in the SDF file. The first inertial parameter is calculated based on the set value.
[0192] The motor parameters in this embodiment include motor joint damping, thrust coefficient, and reverse torque constant. The flight parameters also include motor thrust, reverse torque, and motor rotational angular velocity. Therefore, the correction of motor parameters includes the following steps:
[0193] Based on the motor tension, counter-torque, and motor rotational angular velocity, the current motor parameters are calculated according to the first preset model; the current motor parameters are then replaced with the previous motor parameters to correct the simulation parameters.
[0194] The first preset model is:
[0195]
[0196] in, Provide power voltage to the motor. , , These are the motor tension, counter-torque, and motor rotational angular velocity, respectively. b represents the change in the motor's supply voltage, and 'b' represents the motor's speed coefficient. Indicates the tensile strength coefficient. This represents the anti-torque coefficient.
[0197] The simulation parameters in this embodiment also include sensor parameters, and the flight parameters also include motor rotational angular velocity and air pressure. Therefore, correcting the simulation parameters also includes the following steps:
[0198] Based on the motor rotational angular velocity and air pressure, the current sensor parameters are calculated according to the second preset model; the current sensor parameters are replaced with the previous sensor parameters to correct the simulation parameters, wherein the first sensor parameter is calculated based on a set value.
[0199] The sensor parameters in this embodiment include gyroscope noise, accelerometer noise, and barometer noise; therefore, the second preset model is:
[0200]
[0201] in, It is the acceleration due to gravity. This is the average value from the barometer. Indicates gyroscope noise. Indicates accelerometer noise. This represents the noise level of the barometer. N1, N2, and N3 represent the number of data points collected by the gyroscope sensor, the accelerometer sensor, and the barometer sensor, respectively, where i1 = 1, 2…N1, i2 = 1, 2…N2, and i3 = 1, 2…N3. This represents the data of the angular velocity of the i1th machine body. This represents the data for the i2th acceleration. This represents the data for the i3rd air pressure. It's understandable that the gyroscope sensor collects the actual angular velocities of the drone's X, Y, and Z axes, while the motor's angular velocity is calculated based on these three axes using existing technology, which will not be elaborated here.
[0202] In S300, while correcting the simulation parameters based on the actual UAV flight parameters—that is, after the actual UAV swarm is operating based on the current second control variable—it is also necessary to adjust the relevant parameters of the cooperative control algorithm based on the following steps:
[0203] 1. Obtain the distance d1 between each actual drone and its neighbors, and the distance d2 between each actual drone and the obstacle. If either d1 or d2 is less than the corresponding safe distance threshold, increase the value of the obstacle avoidance term weight matrix Q. Specifically, increase the diagonal element value of Q, for example, change Q=diag(5,5,5) to diag(10,10,10).
[0204] 2. If the control command is jittery (u), that is, the difference between the first control quantity of the previous cycle and the first control quantity of the current cycle is too large (greater than the preset difference threshold), it is considered to be jittery, and the weight matrix value of the control smoothness term R is increased.
[0205] 3. If the actual position of the drone deviates significantly from the expected position, it is considered that the formation is scattered, and the formation maintenance factor is increased. Weight matrix values.
[0206] 4. When the trajectory tracking error is too large (greater than the preset trajectory tracking error threshold), the weight matrix of the trajectory tracking items should be appropriately increased. , The value.
[0207] Repeat steps S100-S300 in S400, and adjust the relevant parameters of the cooperative control algorithm until the difference between the first trajectory deviation and the second trajectory deviation is less than or equal to the difference threshold. At this point, it indicates that the simulation model and the actual aircraft have been matched, and the simulation terminal can be used to perform the test of the UAV.
[0208] like Figure 3 As shown, the flow of the method proposed in this embodiment is as follows:
[0209] 1. Let the simulated drone swarm and the actual drone swarm be based on the same cooperative control algorithm, output the first control variable and the second control variable respectively, and execute them;
[0210] 2. The electronic device acquires the first trajectory deviation and the second trajectory deviation;
[0211] 3. When the difference between the first trajectory deviation and the second trajectory deviation is greater than the difference threshold, obtain the flight parameters of each actual UAV;
[0212] 4. Based on the flight parameters, correct the inertial parameters, motor parameters, and sensor parameters of the corresponding simulated UAV;
[0213] 5. Repeat steps 1-4 until the difference between the first trajectory deviation and the second trajectory deviation is less than or equal to the difference threshold.
[0214] In the simulation test, five virtual and real prototype models of quadcopter drones were built in the Gazebo simulation environment, such as... Figure 4 As shown; in actual operation, a swarm of 5 drones was built for agile flight, as shown. Figure 5 As shown, the communication topology of the cluster is the ring topology described above. Cluster cooperative control and bidirectional iterative experiments were set up, and the system software framework and algorithms were built using the ROS robot operating system. The cooperative control experiment tested the cluster cooperative control effect and obstacle avoidance of MPC control, while the bidirectional iterative experiment, based on cooperative control, tested the optimization effect of the bidirectional iterative mechanism on trajectory tracking.
[0215] Path planning and MPC cluster collaborative control algorithms were deployed in simulation and actual testing. The experimental results of cluster trajectory tracking, formation maintenance, and group obstacle avoidance were observed to verify the feasibility of the algorithms and the feasibility of the constructed hardware platform. Actual test results on the actual machine are as follows: Figure 6 , Figure 7 and Figure 8 The green and purple cylinders represent static and dynamic obstacles, respectively. The drones perform coordinated swarm flight while simultaneously avoiding obstacles as a group. Figure 6 It can be seen that drone swarms have the ability to maintain formation. Figure 8 The experiment showed that each drone in the drone swarm was at a greater than safe distance from the obstacle when traversing the obstacle environment, demonstrating the ability of the swarm to avoid obstacles. The overall experiment demonstrated the feasibility of the drone swarm hardware system.
[0216] A swarm cooperative control experiment was conducted on a UAV swarm, tracking its 3D position trajectory. Multiple experiments were performed in both simulation and real-world scenarios to verify the parameter transfer and model optimization effects of the bidirectional iterative mechanism. After adjusting the control parameters through multiple simulation experiments, the tracking error of the UAV swarm on the 3D position trajectory was as follows: Figure 9 As shown, the parameters are optimal, with position tracking errors in the X, Y, and Z directions all within 0.1m. This set of control parameters was then transferred to a real UAV swarm, and a live-fire test was conducted on the actual platform. The tracking performance of the three-dimensional position trajectory by the actual aircraft is as follows: Figure 10As shown, the position tracking error in the Z direction is within 0.2m, and the position tracking errors in the X and Y directions are within 0.6m, with a relatively large overall average error. In this experiment, by constructing a virtual-real homogeneous model, the control parameters debugged in the simulation can be quickly transferred to the actual aircraft for cluster flight tests. However, the actual flight performance needs further optimization, and the simulation model needs further refinement to improve model accuracy and ensure consistency between the actual and simulated flight performance.
[0217] Based on real-world flight test data, the simulation model was optimized by reverse engineering. The parameters of the UAV simulation model were modified, and further simulation experiments were conducted to adjust the control parameters for optimal control performance. After adjusting the control parameters, the tracking error of the UAV swarm for its three-dimensional position trajectory was as follows: Figure 11 As shown, the parameters are optimal, with position tracking errors in the X, Y, and Z directions within 0.1m. This set of control parameters was then transferred to a live drone swarm for a live test. The live drone's tracking performance on the 3D position trajectory is as follows... Figure 12 As shown, the position tracking errors in the X and Y directions are both within 0.2m, and the position tracking error in the Z direction is within 0.1m, with a relatively small overall mean error. The simulation model has been optimized, and its accuracy has been improved. This model can be used to conduct full-scenario, high-frequency UAV swarm algorithm experiments and can be quickly migrated and deployed to real aircraft for real-world swarm algorithm verification.
[0218] In this embodiment, the processing module can be an integrated circuit chip with signal processing capabilities. The processing module can be a general-purpose processor. For example, the processor can be a Central Processing Unit (CPU), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0219] The storage module can be, but is not limited to, random access memory, read-only memory, programmable read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, etc. In this embodiment, the storage module can be used to store preset numbers, etc. Of course, the storage module can also be used to store programs, which the processing module executes after receiving an execution instruction.
[0220] Understandable, Figure 1The electronic device structure shown is only a schematic diagram; the electronic device may also include more advanced components. Figure 1 More components are shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0221] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the electronic device described above can be referred to the corresponding steps in the aforementioned method, and will not be elaborated further here.
[0222] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to execute the virtual-real source bidirectional iterative agile testing method for UAV swarms as described in the above embodiments.
[0223] Based on the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, electronic device, or network device, etc.) to execute the methods described in the various implementation scenarios of this application.
[0224] In the embodiments provided in this application, it should be understood that the disclosed apparatus, systems, and methods can also be implemented in other ways. The apparatus, systems, and methods embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which includes one or more executable instructions for implementing a specified logical function. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0225] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for agile testing of UAV swarms based on bidirectional iteration with both virtual and real origins, characterized in that, The method includes: S100: Obtain the first trajectory deviation of the virtual drone swarm and the second trajectory deviation of the actual drone swarm, wherein the virtual drone swarm is a virtual model of the actual drone swarm in a virtual scene, and both the virtual drone swarm and the actual drone swarm run the same cooperative control algorithm; S200: Compare the first trajectory deviation and the second trajectory deviation. When the difference between the first trajectory deviation and the second trajectory deviation is greater than the difference threshold, obtain the flight parameters of the UAV cluster. S300: Based on the flight parameters, correct the simulation parameters of the virtual drone swarm so that the difference is reduced after the virtual drone swarm runs based on the corrected simulation parameters; S400: Repeat S100-S300 until the difference between the first trajectory deviation and the second trajectory deviation is less than or equal to the difference threshold.
2. The method according to claim 1, characterized in that, The flight parameters include motor thrust and throttle value, and the simulation parameters include inertial parameters; The step of correcting the simulation parameters of the virtual drone swarm based on the flight parameters includes: Based on the angular velocity of the machine body and the motor tension, the current inertial parameters are calculated; The current inertial parameter is replaced with the previous inertial parameter to correct the simulation parameters.
3. The method according to claim 1, characterized in that, The flight parameters include motor thrust, counter-torque, and motor rotational angular velocity; the simulation parameters include motor parameters. The step of correcting the simulation parameters of the virtual drone swarm based on the flight parameters includes: Based on the motor tension, counter-torque, and motor rotational angular velocity, the current motor parameters are calculated according to the first preset model. The current motor parameter is replaced with the previous motor parameter to correct the simulation parameters.
4. The method according to claim 3, characterized in that, The motor parameters include motor joint damping, tension coefficient, and reverse torque constant; The first preset model is: ; in, Provide power voltage to the motor. , , These are the motor tension, counter-torque, and motor rotational angular velocity, respectively. b represents the change in the motor's supply voltage, and 'b' represents the motor's speed coefficient. Indicates the tensile strength coefficient. This represents the anti-torque coefficient.
5. The method according to claim 1, characterized in that, The flight parameters include the motor rotational angular velocity and air pressure, and the simulation parameters include sensor parameters; The step of correcting the simulation parameters of the virtual drone swarm based on the flight parameters includes: Based on the motor rotational angular velocity and air pressure, the current sensor parameters are calculated according to the second preset model; The current sensor parameter is replaced with the previous sensor parameter to correct the simulation parameters.
6. The method according to claim 5, characterized in that, The sensor parameters include gyroscope noise, accelerometer noise, and barometer noise. The second preset model is: ; in, It is the acceleration due to gravity. This is the average value from the barometer. Indicates gyroscope noise. Indicates accelerometer noise. This represents the noise level of the barometer. N1, N2, and N3 represent the number of data points collected by the gyroscope sensor, the accelerometer sensor, and the barometer sensor, respectively, where i1 = 1, 2…N1, i2 = 1, 2…N2, and i3 = 1, 2…N3. This represents the data of the angular velocity of the i1th machine body. This represents the data for the i2th acceleration. This represents the data for the i3rd air pressure.
7. The method according to claim 1, characterized in that, The virtual drone swarm includes multiple virtual drones, and the actual drone swarm includes multiple actual drones; Prior to S100, the method further includes: Configure undirected graph This is used to describe the communication topology of virtual and real drone swarms, where the vertex set... The edge set corresponds to the nodes of all virtual drones in the virtual drone swarm and the nodes of all actual drones in the actual drone swarm. This corresponds to the two-way communication link between virtual drones and the two-way communication link between actual drones; Based on the undirected graph, obtain the first self-state and the first neighbor state of each virtual drone, and obtain the second self-state and the second neighbor state of each actual drone. Based on all the first self-state and first neighbor state inputs, the current first control variable of each virtual drone is obtained, and based on all the second self-state and second neighbor states, the current second control variable of each actual drone is obtained. The current first control value is input into the corresponding virtual drone, and the current second control value is input into the corresponding actual drone, so that the virtual drone operates according to the current first control value, and the actual drone operates according to the current second control value, and then the steps of obtaining the first trajectory deviation of the virtual drone group and the second trajectory deviation of the actual drone group are executed.
8. The method according to claim 7, characterized in that, Based on all the first self-state and first neighbor state inputs, the current first control variable of each virtual drone is obtained, and based on all the second self-state and second neighbor states, the current second control variable of each actual drone is obtained, including: Configure the trajectory tracking cost function, expressed as: ; , These are the position deviation weight matrix and the velocity deviation weight matrix, respectively. , For the desired position and velocity, Let the virtual drone and the actual drone be in three-dimensional position at time k. Let the virtual drone and the actual drone have their velocities at time k. ; The configuration control smoothness cost function is expressed as: ; The weight matrix is used to control the smoothness of the input. To control the input, it is expressed as total tension and triaxial torque. ; The obstacle avoidance cost function and the neighbor collision avoidance cost function are respectively expressed as follows: ; , These are indexes for obstacles and neighboring drones, respectively. , , These represent the current virtual or actual drone position, the i-th obstacle position, and the positions of neighboring virtual or actual drones, respectively. This is the weight matrix. The set collision safety distance; The configuration formation preservation cost function is expressed as: ; This represents the expected formation distance between adjacent virtual drones, or adjacent real drones. To maintain the term weight matrix for formation; The total cost function is configured as follows: ; Where J is the total cost function; This represents the trajectory tracking cost function; This represents the cost function for controlling smoothness; This represents the obstacle avoidance cost function; This represents the formation preservation cost function; Represent the neighbor collision avoidance cost function; All first self-states and first neighbor states, as well as all second self-states and second neighbor states, are input into the total cost function so that, after solving, the current first control variable of each virtual UAV and the current second control variable of each actual UAV are obtained.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory coupled together, the memory storing a computer program that, when executed by the processor, causes the electronic device to perform the method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1-8.