Next Article in Journal
Anti-Interference Compensation of Grating Moiré Fringe Signals via Parameter Adaptive Optimized VMD Based on MSPSO
Previous Article in Journal
A Trust-Oriented Blockchain Architecture for Compliant and Secure Cross-Border Data Flows
error_outline You can access the new MDPI.com website here. Explore and share your feedback with us.
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

DPAF-SA: A Formation Control Algorithm for Dynamic Allocation and Fusion of Potential Fields for UAV Swarms

School of Equipment Engineering, Shenyang Ligong University, Shenyang 110159, China
*
Author to whom correspondence should be addressed.
Electronics 2026, 15(2), 257; https://doi.org/10.3390/electronics15020257
Submission received: 10 December 2025 / Revised: 4 January 2026 / Accepted: 5 January 2026 / Published: 6 January 2026

Abstract

To address the challenges of inefficient convergence in UAV swarms under complex environments due to static position allocation (SPA), as well as the tendency of traditional artificial potential field (APF) obstacle avoidance to get stuck in local optima, this paper proposes a formation control method (DPAF-SA) based on dynamic position allocation (DPA) and APF-SA fusion, grounded in the principle of consensus and the simulated annealing (SA) algorithm. First, the formation position allocation is formulated as an online combinatorial optimization problem. Based on this framework, a dynamic position allocation and dynamic virtual center mechanism is designed to solve the optimal “UAV-position point” mapping in real time, minimizing the total convergence cost of the swarm. Second, to address the local optimum trap and decoupling issues in APF, the global search capability and probabilistic jump mechanism of SA are integrated into APF. This enables optimization of the consistency control input, ensuring tight coupling between efficient obstacle avoidance and formation maintenance. Finally, a high-fidelity HIL simulation platform based on Unity3D 2022.3.2. was established to validate the engineering feasibility and real-time robustness of the proposed algorithm. Simulation results demonstrate that, compared with the representative baseline model, the proposed method achieves improvements of approximately 46.1%, 24.5%, and 39.6% in formation accuracy, convergence performance, and safety margin, respectively, validating its effectiveness.

1. Introduction

With the significant enhancement of unmanned aerial vehicles’ (UAVs) autonomous flight and environmental perception capabilities, they have assumed critical roles in military, industrial, agricultural, and rescue operations. The application of unmanned combat systems is evolving from standalone unit deployment toward multi-system coordination, progressing from intra-domain collaboration to cross-domain collaboration [1]. The collaborative combat model centered on unmanned combat units has become a hot topic of research worldwide. Simultaneously, due to the significant advantages offered by multi-UAV swarms in mission coverage, operational endurance, and system scalability, multi-UAV formation control has emerged as a highly attractive and critical research challenge in the field of intelligent unmanned systems [2].
Within formation control systems, common architectures include centralized, decentralized, and distributed types. Consensus algorithms based on distributed structures are particularly favored by researchers due to their low communication overhead, minimal computational demands, and robust performance [3]. Meanwhile, to meet practical requirements such as obstacle avoidance, formation reconfiguration, and rapid convergence, numerous studies have combined consensus algorithms with other methods, such as artificial potential fields, optimization algorithms, and machine learning approaches, to enhance system performance. This paper focuses on distributed consensus algorithms, aiming to address formation control, obstacle avoidance, and formation optimization challenges in complex environments [4].

1.1. Related Works

1.1.1. Consensus-Based Formation Control

To address the formation control problem for consensus algorithms in UAV swarms, He et al. [5] proposed a formation control algorithm that implicitly integrates a leader UAV into the swarm, enabling formation correction via navigation feedback during high-speed flight. Xue et al. [6] combined fuzzy sliding mode control with consensus algorithms to address formation convergence issues in heterogeneous multi-agent systems comprising drones and unmanned vehicles. Zhen et al. [7] proposed a formation-flying method based on multivariable adaptive control to address control challenges arising from parameter uncertainty and unknown external disturbances. Liu et al. [8] proposed a position-cooperative control algorithm based on an improved consistency theory and a potential energy function to address collision avoidance and communication maintenance issues, enabling stable formation flight with strong anti-interference capabilities.
The limitation of this approach lies in its rigid, predefined position allocation strategy, which disregards the initial spatial distribution of UAVs. When the initial formation deviates significantly from the target configuration, it results in suboptimal convergence paths and prolonged convergence times. This makes it difficult to achieve rapid reconfiguration and dynamic allocation when mission objectives change frequently or when environmental disturbances are significant, thereby restricting the system’s responsiveness and adaptability in complex operational scenarios.

1.1.2. Obstacle Avoidance for Formations

Integrating formation control technology with other algorithms enables inter-aircraft and external obstacle collision avoidance. Current obstacle avoidance theories primarily fall into three categories: optimization-based algorithms (e.g., ant colony optimization, A* algorithm); potential field-based theories (e.g., artificial potential field, velocity obstacle method); and machine learning-based approaches. Among these, the artificial potential field (APF) method, with its simple structure, rapid response, and strong adaptability, is frequently employed in UAV motion control.
Some researchers have combined APF with consistency algorithms to address obstacle avoidance. BO et al. proposed a hybrid DSA-AAPF obstacle avoidance algorithm based on an improved simulated annealing mechanism and an adaptive artificial potential field, enabling smooth formation reconfiguration and complex obstacle avoidance [9]. To address local minima and unreachable objectives, Li et al. introduced a logarithmic obstacle function to establish hazard expansion zones on both sides of the road, guiding the robot’s movement by adjusting the repulsive force [10]. Yu et al. proposed a cooperative obstacle avoidance algorithm based on an improved artificial potential field method and a consistency protocol to address local minima issues and control conflicts, enabling formation-state convergence during local obstacle avoidance [11]. Additionally, Liang et al. proposed a control strategy based on an event-triggering mechanism, incorporating an artificial potential field function to address obstacle avoidance in formation flight for communication-constrained discrete-time multi-UAV systems [12]. Wang et al. improved the position and velocity variables in the consistency protocol by integrating them with the APF to achieve rapid recovery of the desired formation after obstacle avoidance [13].
Under the Leader-Follower architecture, numerous studies have focused on integrating advanced control theories with potential field methods to enhance formation performance. For instance, researchers have proposed employing fractional-order sliding mode control (FSMC) as an inner-loop controller to improve individual aircraft disturbance rejection capabilities. This approach is combined with an outer-loop potential field function to enable stable tracking of the leader by the follower and inter-aircraft obstacle avoidance [14]. Additionally, studies have explored the integration of linear quadratic regulators (LQR) with potential field methods, or precisely defining the reference trajectory of the follower through formation geometry equations to achieve linearized stable control within complex operational spaces [15].
These methods achieve motion control by combining attractive and repulsive forces, often integrated with consensus algorithms to enhance obstacle avoidance safety. Primarily addressing obstacle avoidance and collision prevention, their objective is collision-free flight rather than rapid formation establishment. They lack in-depth consideration of formation configurations and thus do not focus on optimizing positional allocation within the formation.

1.1.3. Formation Configuration and Optimization

Researchers have focused on methods for optimizing formation configuration and reconfiguration to address optimal configuration, reconfiguration, or rapid formation problems. Specific approaches include: Xu et al. [16] employed a particle swarm optimization (PSO) algorithm to optimize formation parameters, investigating configuration issues in offensive-defensive adversarial environments. Zhang et al. [17] proposed a cooperative guidance control scheme based on the virtual leader-follower method, utilizing an inverse approach to rapidly achieve the desired formation. To further enhance performance, Zhang et al. [18] integrated discrete allocation decisions with continuous collision constraints into a mixed-integer optimization framework (MILP). Solutions were obtained using commercial solvers or sequential convex relaxation methods, achieving near-optimal results in terms of safety and trajectory smoothness. Additionally, other studies have addressed specific constraints; for instance, Zhao et al. [19] proposed zero-space-based joint trajectory planning for multiple UAVs, and Wang et al. [20] designed an optimal formation solution using a heading-feasibility-based evaluation function tailored to the constraints of fixed-wing UAVs.
In recent years, task-based formation methods have emerged, treating positions within a formation as “tasks” and drones as “executors.” These approaches utilize auction algorithms or the Hungarian algorithm to find optimal matches. While this methodology provides insights into optimal allocation, traditional centralized task-assignment algorithms face challenges when directly applied to distributed, dynamic drone swarm control. Additionally, when flying in complex industrial or outdoor environments, unmanned swarms must not only optimize formation configurations but also account for the mechanical health status of the platforms themselves. Just as certain studies utilize neural networks for classification monitoring of internal leakage faults in hydraulic actuators [21], future formation control frameworks should integrate such underlying health information to dynamically adjust position allocation strategies when actuator performance degrades.

1.2. Motivations and Contributions

Despite significant progress in formation maintenance, trajectory planning, and configuration optimization, existing methods still exhibit critical limitations in addressing formation convergence efficiency and dynamic adaptability. Most current approaches rely on a static position assignment paradigm, assuming that the desired relative positions of each UAV within the formation are pre-assigned (e.g., UAV i is assigned to slot i). When the initial drone position distribution deviates significantly from the desired formation geometry, this fixed-allocation strategy can easily lead to unnecessary trajectory crossings and detours, thereby prolonging formation convergence time and increasing the potential for collisions. Based on this, the present study identifies the following pressing issues that require urgent attention in current research:
  • Lack of Assignment Optimization for Convergence: Existing research generally lacks a dynamic position assignment mechanism. Specifically, it fails to dynamically optimize which UAV should fly to which formation position point during the formation convergence process based on the global position distribution—a combinatorial optimization problem. This deficiency leads to the aforementioned inefficiency in convergence.
  • Decoupling of Obstacle Avoidance and Formation Optimization: As demonstrated in [12,13], existing obstacle avoidance methods based on consensus algorithms and APF address safety concerns but generate repulsive fields that are often localized and reactive. These approaches lack tight coupling with higher-level formation-optimization objectives, making it difficult for UAVs to efficiently recover from or dynamically adjust to globally optimal formations after obstacle avoidance.
  • Insufficient Real-time Intra-Formation Optimization: As noted in [16,17,20], existing formation optimization methods predominantly rely on offline planning or focus on steady-state maintenance. In high-speed, dense obstacle-avoidance scenarios with strong disturbances, these approaches lack the capability to dynamically adjust positions within the formation in real time. Consequently, they struggle to rapidly reconfigure and restore optimal formations while ensuring safety.
To address these challenges, this paper formulates formation position allocation as an online, real-time, discrete combinatorial optimization problem and tightly couples it with underlying distributed consensus control. We propose a hierarchical framework integrating centralized optimization allocation with distributed collaborative control, based on Simulated Annealing (SA) optimization and artificial potential field fusion. The main contributions are as follows:
  • A DPAF-SA hybrid formation obstacle avoidance algorithm is proposed: integrating the global search capability of the simulated annealing algorithm (SA) into the artificial potential field (APF) to optimize the consensus control input. This addresses the issue of traditional APF algorithms easily getting stuck in local optima in complex obstacle environments, thereby significantly improving the formation’s obstacle-avoidance efficiency.
  • Designed a dynamic position allocation and virtual center framework: Employing a virtual center-follower architecture, an annealing simulation algorithm is introduced to solve online for the optimal drone position mapping under the current state. This enables each UAV to be dynamically assigned to the most advantageous position at any given moment (rather than through pre-fixed allocation). Concurrently, a dynamic virtual center—adjusted in real time based on the cluster’s current center of mass—is proposed. This provides a dynamic reference for position allocation, thereby achieving rapid formation convergence.
  • A Hardware-in-the-Loop (HIL) verification architecture was established: To address the limitations of traditional numerical simulation in practical application validation, a virtual combat platform was developed using the Unity3D engine. This architecture integrates real control loops with a virtual environment, enabling closed-loop testing of algorithms in simulated real-world scenarios and significantly enhancing the credibility of verification results.
The remainder of this paper is organized as follows: Section 2 introduces the system model and problem description. Section 3 elaborates on the proposed SA-APF fusion-based formation control algorithm. Section 4 validates the effectiveness of the proposed algorithm through simulation experiments. Section 5 concludes the paper.

2. Problem Description

To investigate rapid distributed convergence and cooperative obstacle avoidance for multi-UAV formations in three-dimensional space, the collaborative behavior of N UAVs is considered. The position and velocity of each UAV i are denoted as p i ( t ) , v i ( t ) R 3 ,respectively, while u i R 3 , represents the new control input. The system operates within a distributed control framework, requiring that the design of the control law u i rely solely on communication within a finite neighborhood. The nonlinear dynamics of each UAV are modeled as a second-order integrator (as shown in Equation (1)):
p ˙ i = v i v ˙ i = u i
This paper reformulates the rapid formation convergence problem as a dynamic, real-time UAV-to-Slot Optimal Assignment Problem. It proposes a cooperative control strategy based on online optimal assignment (as shown in Figure 1). To clearly delineate the core problem being addressed, Table 1 provides key symbol definitions, a formalized problem description, and constraint conditions.
Based on the above definitions, the Dynamic Assignment and Formation Control Problem can be described as follows: For a multi-agent system composed of N UAVs, the desired formation is jointly defined by a virtual center c ( t ) and a set of slot positions S. Accordingly, a distributed control framework is designed, comprising: a real-time updated discrete assignment map π ( t ) ; and a distributed control law u i . This framework aims to minimize convergence time, steady-state formation error, and formation fidelity while satisfying the following constraints: dynamic constraints ( v m a x , a m a x ), communication constraints A ( t ) , and safety constraints d m i n .
Safety Distance Constraint (Machine-to-Machine Collision Avoidance): p i ( t ) p j ( t ) d min , i j , t .
Obstacle Separation Constraint: dist ( p i ( t ) , δ ) d min .
Dynamic Constraint: v i ( t ) v max , v ˙ i ( t ) a max .
Communication Constraints: Information is only available within the neighborhood; allocation and control strategies must be implemented under local information conditions.

3. Methods

To address trajectory crossings, convergence delays, and potential collisions caused by misalignment at initial positions or complex obstacle environments in traditional fixed-slot allocation, this paper proposes a formation control method that integrates simulated annealing (SA) with an improved artificial potential field (APF) framework. This method employs the SA algorithm to optimize the “UAV-position” allocation scheme in real time, minimizing total flight cost and significantly reducing formation time. Additionally, to ensure flight safety in complex environments, an enhanced repulsive function is designed to overcome the limitations of traditional APF, which disregards UAV size and trajectory smoothness, thereby ensuring robust inter-UAV and external obstacle avoidance. Ultimately, by using the optimized SA results as a dynamic expected convergence point and integrating an enhanced repulsive APF term, a SA-APF fusion consistency control model was developed. This model dynamically adjusts formation configurations to ensure safe flight operations, addressing the challenges of multi-UAV coordination in high-speed, dynamic environments.

3.1. Formation Consistency Algorithm Design

First, consider a formation model with n unmanned aerial vehicles (UAVs) in space. Their kinematic equations are defined as Equation (1), where i 1 , 2 , . . . , n represents individual agent i, v i denotes the velocity parameter of agent i, p i denotes the position parameter of agent i, and u i R m is the control algorithm for agent i. For the system model, Ren [22] proposed the following second-order consistent control algorithm:
u i = j N i a i j [ ( p j p i ) + γ ( v j v i ) ]
here, γ > 0 represents the gain coefficient, and a i j > 0 denotes the communication weight of the (j, i) edge in the adjacency matrix. Drones perform weighted feedback based on position and velocity errors between neighbors, ensuring that all q i and p i converge to the same value over time.
In the consistency control of UAV formations, communication is divided into directed and undirected. Directed communication indicates that a UAV receives information from another UAV, while undirected communication signifies that UAVs influence each other. In graph theory, the communication topology graph G = V , E represents a fleet of unmanned aerial vehicles (UAVs), where V = 1 , 2 , . . . , n denotes each individual UAV and E = { ( i , j ) V × V i j } denotes the set of communication edges between UAVs. ( i , j ) E indicates that individual i can receive information from individual j, but individual j cannot receive information from individual i. If graph G is an undirected topological graph, then individuals i and j can exchange information. The Laplacian matrix is defined as L = D ( G ) A ( G ) , D ( G ) = diag ( d ( i ) ) represents the in-degree matrix, with d ( i ) denoting the number of individuals transmitting information to individual i. A ( G ) = [ a i j ] denotes the adjacency matrix, with a i j representing the weight of edge ( i , j ) .
a i j = 1 i and j are in communication 0 Others
This paper establishes the fixed-position UAV communication topology shown in Figure 2. The position of each UAV within the formation is dynamically calculated based on its current position. The pentagram in Figure 2a indicates the current position of the virtual navigation center. The desired formation is established based on this position. Figure 2b shows the communication relationships established among the UAVs according to their destination positions. The calculation method is as follows:
( x c , y c ) = 1 n i = 1 n ( p x i , p y i ) ( p x j , p y j ) = ( x c , y c ) + ( c x , c y ) J d = min i = 1 n j = 1 n d i j x i j
In the equation, ( p x i , p y i ) represents the current position of UAV i in the x y direction, ( c x , c y ) denotes the position of each formation position j relative to the formation center ( x c , y c ) , and ( p x j , p y j ) indicates the desired positions of the formation at the current time. J d is the fitness function for the desired formation of the UAVs. d i j represents the distance from UAV i to desired position j, where x i j 0 , 1 . For each i, j = 1 n x i j = 1 holds, and for each j, i = 1 n x i j = 1 holds. The smaller J d is, the faster the formation converges to the desired configuration. The correspondence between i and j in the minimized J d corresponds to each drone and its desired position.
The simulated annealing algorithm is an optimization technique based on the principle of metal annealing [23]. It combines probabilistic jump characteristics to randomly search for the global optimum of the objective function within the solution space. If a new solution outperforms the current one, it is accepted; otherwise, acceptance is determined based on the Metropolis criterion, with the acceptance probability defined as:
P = 1 , E t + 1 < E t e ( E t + 1 E t ) k T c , E t + 1 E t
In Equation (5), E t denotes the system energy, i.e., J d in Equation (4); T c represents the initial temperature; k ( 0 , 1 ) .
In optimization problems, functions with continuous solution spaces often yield optimal solutions more readily. In the fitness function J d established by Equation (4), the solution space for a UAV’s position within a formation is discrete, with the corresponding optimal solution comprising a set of discrete variables. In simulated annealing algorithms, new solutions emerge from old ones. Therefore, obtaining a set of new solutions is crucial for optimization. This paper employs the following three methods to generate new solutions (Figure 3). At each update, a new solution is generated with a certain probability using one of these methods:
The consistency formation optimization process based on the simulated annealing algorithm is as Figure 4:

3.2. Position Optimization and Obstacle Avoidance Mechanism Algorithm Design

To achieve inter-drone collision avoidance and external obstacle avoidance, this section designs a repulsive force field based on the concept of artificial potential fields. Drones treat each other as obstacles, defining a safety distance between drones and obstacles. When the distance between them falls below the safety threshold, a repulsive force is introduced; otherwise, the original flight state is maintained, as illustrated in the Figure 5:
In Figure 5, r o denotes the radius of the UAV, R o represents the safe obstacle avoidance distance for UAVs, and ρ o indicates the distance between drones or between a drone and an obstacle. In the traditional manual potential field, the repulsive force function is defined as follows:
U i = 1 2 k r 1 ρ o i 1 R o 2 , 0 < ρ o i R o 0 , Other
In the formula, k r is the repulsion coefficient, ρ o i is the distance between the UAV and the obstacle or between UAVs. In traditional methods, the repulsive function does not account for the drone’s radius and cannot be directly applied to inter-drone collision avoidance or external obstacle avoidance. To address this issue, the traditional potential field function is replaced with a tangent function that not only accounts for the UAV’s radius but also produces smoother obstacle-avoidance trajectories. The optimized repulsive function is given by Equation (7).
U A P e i = k cot π 2 · ρ o i 2 r o R 0 r o , 2 r < ρ o i R o + r o 0 , R o + r o < ρ o i
The improved repulsion function incorporates the drone’s radius and optimizes the potential field. Based on the artificial potential field concept and the consistency theory framework, a consistency control model has been developed that integrates inter-vehicle collision avoidance, external obstacle avoidance, and formation maintenance capabilities:
u c i = j = 1 n a i j k u 1 ( p i p j c i + c j ) a i 0 k u 1 ( p i p 0 c i ) k u 2 ( v i v 0 ) + k u 3 U A P e i
In the equation, q denotes the drone’s position, p represents its velocity, and c is the vector indicating each drone’s relative position to the virtual leader during stable flight. Assuming q i ’s expected position is the m-th position within the formation, the corresponding c i is the vector representing the m-th position relative to the virtual leader. Here, i = 0 represents the leader. k u 1 and k u 3 are gain coefficients, while U A p e i denotes the potential field force acting on the drone. For drone-to-drone collision avoidance and external obstacle avoidance, different R o values are assigned within U A p e i . k u 2 and k u 3 are gain coefficients. U A p e i represents the potential field force acting on the UAV. The value of R o within U A p e i varies depending on whether the collision avoidance is between UAVs or against external obstacles.

4. Simulation Verification

This paper proposes a formation-based swarm control algorithm for unmanned aerial vehicles (UAVs) and validates it through MATLAB 2022b simulations. However, MATLAB simulations remain confined to the data level and cannot demonstrate the algorithm’s practical application in real-world scenarios. Beyond simulation experiments, this chapter develops a virtual platform in Unity3D and designs a hardware-in-the-loop (HIL) experiment integrated with real-world scenarios to validate the feasibility of the proposed algorithm in practical applications.

4.1. Rapid Formation and Obstacle Avoidance Performance Verification

To validate the overall performance of the proposed DPAF-SA integrated formation obstacle avoidance algorithm, two representative state-of-the-art algorithms were selected as comparative baselines. Formation convergence tests were conducted under identical simulation environments. The simulation environment and key algorithm parameter settings are detailed in Table 2.
The first type is centralized mixed-integer linear programming (MILP) (e.g., the method in [18]), which represents the globally optimal centralized strategy. It will jointly model allocation with trajectory planning, employing an industrial solver to determine the optimal safety trajectory and allocation scheme within a single time domain. The second is the Hungarian algorithm, a classic and computationally efficient solution for one-to-one assignment in multi-UAV domains. For instance, Ref. [24] also employs the Hungarian method as a baseline in its target assignment module, representing a greedy optimal dynamic allocation strategy. During each redistribution cycle, it employs the Hungarian algorithm to determine the drone-slot pairing with the shortest Euclidean distance.
To ensure experimental fairness, all three methods employed identical initial UAV positions and target formations, with each group performing comparisons under the same initial topology. The inner-loop controller remains consistent across all three methods, with only the optimization module replaced for comparative isolation. To obtain statistically significant conclusions, it is recommended to conduct 30 Monte Carlo random trials for each scenario and record the mean and standard deviation.
0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0
In the simulation, assuming the trajectory of the virtual leader is known, the communication topology adjacency matrix is as per Formula (9). The position vectors relative to the virtual leader are: c 1 = [ 0 , 30 , 0 ] T , c 2 = [ 30 , 30 , 0 ] T , c 3 = [ 30 , 0 , 0 ] T , c 4 = [ 30 , 30 , 0 ] T , c 5 = [ 0 , 30 , 0 ] T , c 6 = [ 30 , 30 , 0 ] T , c 7 = [ 30 , 0 , 0 ] T , c 8 = [ 30 , 30 , 0 ] T . In the algorithm proposed in this paper, the communication topology adjacency matrix represents the communication relationships between each formation position. UAVs establish communication relationships among themselves based on their desired convergence positions. The position vector c denotes the position vector of each formation relative to the virtual leader. Each UAV adjusts its position relative to the virtual leader according to its desired convergence position.
Figure 6 compares the convergence performance of three formation allocation strategies in an obstacle-free environment. The initial positions of UAVs 1–8 in the environment are shown in Table 3. The virtual leader updates its position at velocities v x = 3 m/s, v y = 3 m/s, and v z = 0 m/s.
Columns (a), (b), and (c) in the Figure 6 correspond to the 3D flight trajectory, X-axis distance error, and Y-axis distance error, respectively. The visualization of the 3D trajectory (Figure 6a) clearly demonstrates significant performance differences among strategies when substantial misalignment exists between the initial position and the target slot. The MILP strategy (first row), due to its centralized, global-optimization nature, produces smooth yet overly conservative trajectories, resulting in an extremely slow formation establishment process. The (Hungarian-DP) strategy (second row) mathematically guarantees the minimum sum of Euclidean distances per frame. However, as a memoryless allocation algorithm, it lacks consideration for temporal consistency with previous allocation results. This causes the algorithm to disregard the continuity of the flight path during dynamic operations, triggering frequent shifts in the allocation scheme. Consequently, the drone exhibits noticeable path oscillations and detours during the convergence phase (e.g., near y = 50 m).
The DPAF-SA method (third row) in this paper achieves optimal dynamic position allocation via the SA algorithm’s heuristic search. UAVs can flexibly adjust and fly toward the formation slot with the lowest total cost at any given moment, effectively avoiding unnecessary inter-aircraft motion and trajectory intersections, resulting in the most direct and efficient paths. More precise quantitative comparison can be obtained from the distance error curves along the X-axis (Figure 6b) and Y-axis (Figure 6c). The step-like jumps in the error curve of the proposed method when t < 10 s visually represent the SA algorithm executing dynamic reassignments. These jumps indicate that the algorithm has identified a target slot with a momentarily lower total cost, reflecting an optimization at the decision level that does not violate the UAVs’ physical kinematic constraints.
In terms of convergence performance, the MILP error curve (first row) did not fully converge by t = 35 s, indicating the poorest performance. Hungarian-DP (second row), due to the aforementioned allocation discontinuity issue, displayed significant overshoot and oscillation in its error curve at t < 20 s, finally stabilizing only at t = 22.5 s. The proposed method (third row) exhibits the fastest and smoothest convergence characteristics, with both X-axis and Y-axis errors converging to a steady state by t = 17 s. The results in Figure 6 demonstrate that compared to the overly conservative MILP and the oscillating Hungarian-DP, the proposed algorithm reduces convergence time by approximately 5.5 s and improves convergence performance by about 24.5%, validating its superiority in rapid formation tasks.
To validate the robustness and formation stability of the proposed DPAF-SA fusion algorithm in complex environments, we selected the dynamic position assignment based on the Hungarian algorithm(Hungarian-DP) as a comparative baseline. Both methods employ the same improved APF obstacle avoidance module, with the core difference lying in the discrete allocation decision layer: the SA heuristic in this paper versus the Hungarian greedy optimal approach. The initial positions of the eight unmanned aerial vehicles (UAV1–8) in the obstacle-laden environment are shown in Table 4. The virtual leader updates its position at velocities v x = 3 m/s, v y = 3 m/s, and v z = 0 m/s.
Figure 7a illustrates the three-dimensional flight trajectories. Although both methods ultimately achieve obstacle avoidance and formation flying, they exhibit fundamental differences in the dynamic characteristics of their trajectories. The trajectory of the Hungarian-DP strategy (Figure 7a top row) exhibits significant disorder and substantial detours near obstacles. This occurs because the Hungarian algorithm is inherently a memoryless, instantaneous greedy strategy. It assigns labels based solely on the Euclidean distance of the current frame, disregarding the continuity of historical trajectories. Consequently, assignment outcomes frequently jump between adjacent frames. This temporal inconsistency leads to high-frequency conflicts between higher-level allocation commands (indicating obstacle crossing) and lower-level APF avoidance forces (indicating obstacle avoidance), resulting in severe path oscillations. In contrast, the method proposed in this paper (Figure 7a, bottom row) uses the solution from the previous time step as prior knowledge for the current optimization, ensuring smooth transitions in the allocation scheme over time. This approach generates more compact, smooth, and consistent cooperative avoidance trajectories.
Figure 7b,c shows the distance error curves between the X and Y axes. The figure shows that Hungarian-DP converges slightly faster (X-axis: 75.5 s; Y-axis: 85 s) than the proposed method (X-axis: 85 s; Y-axis: 88 s). The primary reason for this phenomenon lies in the differing core mechanisms: while Hungarian-DP prioritizes the fastest arrival of individual drones, our method dynamically adjusts the virtual leader’s position to maintain overall geometric consistency of the formation when disturbed by external obstacles. This cooperative strategy causes individual drones to subordinate their local maneuvers to the formation’s overall integrity. Consequently, a slight sacrifice in instantaneous convergence speed is traded for higher formation stability and reduced interference between members. This trade-off between stability and speed is clearly demonstrated by the shape of the error curves.Hungarian-DP (Figure 7b,c left graph) exhibits severe and persistent oscillations in the error curve during the 20–40 and 60–80 obstacle avoidance phases, indicating poor system stability. In contrast, the error curve of the proposed method (Figure 7b,c, right graph) demonstrates significantly smoother overall performance with smaller amplitude fluctuations. In summary, by coupling allocation decisions with virtual navigation, the proposed method achieves superior formation consistency and robustness while ensuring safety, reducing mutual interference, and minimizing long-term deviations among members.
Figure 8 presents the results of 30 Monte Carlo simulation trials, providing robust statistical validation of the performance comparison between the proposed DPAF-SA algorithm (denoted as APS in the figure) and the Hungarian-DP algorithm (denoted as HD in the figure). The results indicate that although HD exhibits a slight advantage in mean convergence time (THD-T_Conv = 37.78 s, APS-T_Con = 39.72 s), this marginal speed improvement comes at the expense of formation accuracy and safety margin. The final mean accuracy of DPAF-SA (APS-F_RMSE = 0.803) improved by approximately 46.1% compared to HD (1.490), with a more concentrated data distribution, indicating more precise and consistent formations after convergence. Regarding safety, the mean minimum safety distance for APS is APS-D_Min = 3.143, while HD achieves HD-D_Min = 2.251. APS increases the safety margin by approximately 39.6%, and HD shows more extreme values near the safety threshold in the sample, indicating a higher near-collision risk. In summary, DPAF-SA effectively couples allocation decisions with potential field control by introducing heuristic search and consensus mechanisms at the allocation layer, thereby achieving superior formation robustness, precision, and safety in obstacle-laden environments.
Table 5 presents the statistical results for each evaluation metric. Experimental data indicate that for the core metric of formation accuracy (F_RMSE), the APS algorithm achieved a mean value of 0.81 with a 95% confidence interval (CI) of [0.72, 0.90], significantly outperforming the confidence interval [1.31, 1.67] of the comparison algorithm (HD). Since the confidence intervals of the two methods are completely non-overlapping, this provides strong statistical evidence of the proposed method’s superior performance in enhancing formation accuracy. Furthermore, in terms of the minimum obstacle avoidance distance (D_Min) metric, APS also demonstrates higher safety redundancy and a smaller standard deviation (0.62), further confirming the algorithm’s reliability in complex dynamic environments.

4.2. HIL Experimental Validation

In addition to Software-in-the-Loop (SIL) simulation experiments, we designed Hardware-in-the-Loop (HIL) experiments to further validate the real-time performance and feasibility of the proposed SA-APF algorithm on embedded hardware. The overall layout and connections of the HIL experimental platform are shown in Figure 9.
The HIL platform consists of two core components: the Host Computer and the Companion Computer. The Host Computer is a workstation equipped with an Intel Core i7-13700K processor and 32 GB RAM. It runs the high-fidelity simulation environment developed using the Unity engine. This environment incorporates both the Scene & Environment module, which simulates terrain, obstacles, and environmental conditions, and the Drone Module. The Companion Computer serves as the core test hardware for this experiment, utilizing the RK3588 high-performance embedded platform. The proposed DPAF-SA algorithm, comprising high-level perception acquisition, a planner, and a high-level controller/state machine, has been ported and runs in real-time within the algorithm module of this onboard computer. The core interaction logic between the Companion Computer and the Unity3D simulation environment is illustrated in Figure 10.
The closed-loop control process for HIL experiments is as follows:
  • Unity Simulation Environment: Real-time simulation of drone status, generating high-frequency simulated sensor data such as IMU and GPS readings.
  • Sensor data is transmitted via UDP to the onboard RK3588 computer.
  • The DPAF-SA algorithm on the onboard computer (functioning as both planner and advanced controller) receives and processes this data, calculating control commands (Control: setpoint/command velocity) in real time.
  • Control commands are relayed back to the Unity host, driving updates to the drone’s state within the simulation environment, thereby forming a complete decision-perception-control closed-loop system.
The entire system’s communication exchange (Comm node) utilizes the MAVLink protocol, which transmits data via UDP. This protocol provides an efficient, low-latency standardized interface for communication between the UAV simulation system and the high-level controller.
Figure 11 demonstrates the flight trajectories and obstacle avoidance performance of the UAV swarm under the DPAF-SA algorithm (Figure 11a) and the Hungarian-DP method (Figure 11b) in the HIL simulation environment. Experimental results demonstrate that, despite computational constraints imposed by embedded hardware and inherent network communication delays, the proposed DPAF-SA algorithm operates stably and efficiently, guiding UAVs to accomplish tasks such as obstacle avoidance and formation reconfiguration. This fully demonstrates the algorithm’s effectiveness, robustness, and real-time feasibility in practical applications. Furthermore, to assess the reliability of experimental results, flight paths generated by MATLAB software are shown in Figure 11c). Despite the relatively simple test scenario, the HIL experiments confirmed the method’s robustness and effectiveness in a quasi-physical environment, indicating strong practical application value.

5. Conclusions

This paper addresses the real-time allocation and obstacle avoidance challenges faced by multi-UAV swarms during rapid grouping and formation assembly in 3D combat environments. It proposes a distributed consensus control framework that integrates Dynamic Position Allocation (DPA) with an enhanced Artificial Potential Field (APF), incorporating Simulated Annealing (SA) as a global search algorithm to achieve integrated optimization of grouping, formation assembly, and path planning. First, the paper models UAV-slot allocation as an online combinatorial optimization problem. Real-time mapping is achieved through a dynamic virtual navigation center and an SA-based heuristic redistribution mechanism, reducing unnecessary inter-UAV repositioning and trajectory intersections. Second, addressing the tendency of traditional APF to get stuck in local minima, the paper designs an improved repulsive function and incorporates SA probabilistic jumps into the coordination control input, thereby enhancing obstacle avoidance and formation recovery capabilities in complex obstacle environments; meanwhile, the proposed framework demonstrates significant advantages in multiple Monte Carlo simulations and HIL (Hardware-in-the-Loop) testing—reducing convergence time by approximately 5.5 s compared to the greedy baseline, improving convergence performance by about 24.5%, enhancing formation accuracy by roughly 46.1%, and increasing the minimum safe distance by approximately 39.6%. Finally, through closed-loop integration with classical path planning, the system achieves higher formation consistency and engineering reproducibility while maintaining a safety margin. Comprehensive simulation and real-world platform validation demonstrate that this method offers distinct advantages in performance, robustness, and real-time feasibility. It provides an actionable technical pathway and foundational basis for large-scale UAV cooperative scheduling and real-time formation control in complex combat environments.

Author Contributions

Conceptualization, M.L. and Y.H.; methodology, M.L.; software, M.L. and L.Y.; validation, M.L. and L.Y.; formal analysis, L.Y.; writing—original draft preparation, M.L.; writing—review and editing, Y.H. and L.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

We sincerely thank the reviewers for taking the time to review this paper amidst their busy schedules.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Quero, C.O.; Martinez-Carranza, J. Unmanned aerial systems in search and rescue: A global perspective on current challenges and future applications. Int. J. Disaster Risk Reduct. 2025, 118, 105199. [Google Scholar] [CrossRef]
  2. Wang, Z.; Guo, Y.; Li, N.; Hu, S.; Wang, M. Autonomous collaborative combat strategy of unmanned system group in continuous dynamic environment based on PD-MADDPG. Comput. Commun. 2023, 200, 182–204. [Google Scholar] [CrossRef]
  3. Farooq, A.; Xiang, Z.; Chang, W.-J.; Aslam, M.S. Recent Advancement in Formation Control of Multi-Agent Systems A Review. Comput. Mater. Contin. 2025, 83, 3623–3674. [Google Scholar] [CrossRef]
  4. Liu, Q.; Huang, K.; Liu, H.; Wang, R.; Cheng, G. Multi-Domain Collaborative Task Allocation and Conflict Resolution in Unmanned Systems under Complex Constraints. Unmanned Syst. 2025, 13, 579–589. [Google Scholar] [CrossRef]
  5. He, L.; Bai, P.; Liang, X.; Zhang, J.; Wang, W. Feedback formation control of UAV swarm with multiple implicit leaders. Aerosp. Sci. Technol. 2018, 72, 327–334. [Google Scholar] [CrossRef]
  6. Xue, K.; Wu, T. Distributed Consensus of USVs under Heterogeneous UAV-USV Multi-Agent Systems Cooperative Control Scheme. J. Mar. Sci. Eng. 2021, 9, 1314. [Google Scholar] [CrossRef]
  7. Zhen, Z.; Tao, G.; Xu, Y.; Song, G. Multivariable adaptive control based consensus flight control system for UAVs formation. Aerosp. Sci. Technol. 2019, 93, 105336. [Google Scholar] [CrossRef]
  8. Liu, M.; Chi, H.; Jiang, G.P.; Wang, M.; Ren, Z. UAV Formation Cooperative Control Based on Consistency Theory. In Proceedings of the 2023 7th Chinese Conference on Swarm Intelligence and Cooperative Control, Nanjing, China, 24–27 November 2023; pp. 330–340. [Google Scholar]
  9. Ma, B.; Ji, Y.; Liyong, F. A Multi-UAV Formation Obstacle Avoidance Method Combined with Improved Simulated Annealing and an Adaptive Artificial Potential Field. Drones 2025, 9, 390. [Google Scholar] [CrossRef]
  10. Li, X.; Liu, X.; Wang, G.; Wu, S.; Li, W. Formation Obstacle Avoidance Control Method for Multi-Intelligent Firefighting Robots. Robotics 2024, 46, 81–93. [Google Scholar]
  11. Yu, H.; Ning, L. Coordinated Obstacle Avoidance of Multi-AUV Based on Improved Artificial Potential Field Method and Consistency Protocol. J. Mar. Sci. Eng. 2023, 11, 1157. [Google Scholar] [CrossRef]
  12. Han, L.; Wang, Y.; Yan, Z.; Li, X.; Ren, Z. Event-triggered formation control with obstacle avoidance for multi-agent systems applied to multi-UAV formation flying. Control Eng. Pract. 2024, 153, 106105. [Google Scholar] [CrossRef]
  13. Wang, N.; Dai, J.; Ying, J. UAV Formation Obstacle Avoidance Control Algorithm Based on Improved Artificial Potential Field and Consensus. Int. J. Aeronaut. Space Sci. 2021, 22, 1413–1427. [Google Scholar] [CrossRef]
  14. Alabsari, N.; Saif, A.W.A.; El-Ferik, S.; Duffuaa, S.; Derbel, N. Cooperative Flight Control of a Fleet of Quadrotors Using Fractional Sliding Mode With Potential Field Algorithms. IEEE Access 2024, 12, 24525–24543. [Google Scholar] [CrossRef]
  15. Saif, A.; Saif, A.-W.; Alabsari, N.; El Ferik, S.; Elshafei, M. Formation control of quadrotors via potential field and geometric techniques. Int. J. Adv. Appl. Sci. 2020, 7, 83–96. [Google Scholar] [CrossRef]
  16. Xu, X.; Wang, X.; Yao, L.; Ren, Z. Formation configuration and communication topology optimization for fixed-wing UAVs. Syst. Eng. Electron. 2022, 44, 2936–2946. [Google Scholar]
  17. Zhang, J.; Yan, J.; Zhang, P. Multi-UAV Formation Control Based on a Novel Back-Stepping Approach. IEEE Trans. Veh. Technol. 2020, 69, 2437–2448. [Google Scholar]
  18. Zhang, G.; Liu, X. UAV Collision Avoidance Using Mixed-Integer Second-Order Cone Programming. J. Guid. Control Dyn. 2022, 45, 1732–1738. [Google Scholar] [CrossRef]
  19. Zhao, J.; He, H.; Wang, S.; Nie, C.; Jiao, Y. Joint Trajectory Planning for Multiple UAVs Target Tracking and Obstacle Avoidance in a Complicated Environment. Acta Armamentarii 2023, 44, 2685–2696. [Google Scholar]
  20. Wang, Y.; Shan, M.; Wang, D. Motion Capability Analysis for Multiple Fixed-Wing UAV Formations With Speed and Heading Rate Constraints. IEEE Trans. Control Netw. Syst. 2020, 7, 977–989. [Google Scholar]
  21. Wrat, G.; Ranjan, P.; Mishra, S.K.; Jose, J.T.; Das, J. Neural network-enhanced internal leakage analysis for efficient fault detection in heavy machinery hydraulic actuator cylinders. Proc. Inst. Mech. Eng. Part C J. Mech. Eng. Sci. 2024, 239, 1021–1031. [Google Scholar] [CrossRef]
  22. Wei, R.; Beard, R.W. Distributed Consensus in Multi-Vehicle Cooperative Control; Springer: London, UK, 2008. [Google Scholar]
  23. Kong, X.; Zhou, Y.; Li, Z.; Wang, S. Multi-UAV simultaneous target assignment and path planning based on deep reinforcement learning in dynamic multiple obstacles environments. Front. Neurorobot. 2023, 17, 1302898. [Google Scholar] [CrossRef]
  24. He, Q.; Wu, Y.L.; Xu, T.W. Application of improved genetic simulated annealing algorithm in TSP optimization. Control Decis. 2018, 33, 7. [Google Scholar]
Figure 1. Schematic Diagram of Dynamic Allocation and Formation Control.
Figure 1. Schematic Diagram of Dynamic Allocation and Formation Control.
Electronics 15 00257 g001
Figure 2. UAV Communication Topology Diagram. (a) Communication Topology Between Positions. (b) Communication Topology and Desired Formation Distribution Between UAV Positions.
Figure 2. UAV Communication Topology Diagram. (a) Communication Topology Between Positions. (b) Communication Topology and Desired Formation Distribution Between UAV Positions.
Electronics 15 00257 g002
Figure 3. New solution generation diagram.
Figure 3. New solution generation diagram.
Electronics 15 00257 g003
Figure 4. Simulated annealing algorithm optimization process.
Figure 4. Simulated annealing algorithm optimization process.
Electronics 15 00257 g004
Figure 5. UAV Collision Avoidance Schematic Diagram.
Figure 5. UAV Collision Avoidance Schematic Diagram.
Electronics 15 00257 g005
Figure 6. UAV Flight Simulation Experiment in Obstacle-Free Environment. (a) Comparison of UAV flight trajectories. (b) Comparison of the X-axis distance error between UAVs and the leader. (c) Comparison of the X-axis distance error between UAVs and the leader.
Figure 6. UAV Flight Simulation Experiment in Obstacle-Free Environment. (a) Comparison of UAV flight trajectories. (b) Comparison of the X-axis distance error between UAVs and the leader. (c) Comparison of the X-axis distance error between UAVs and the leader.
Electronics 15 00257 g006
Figure 7. UAV Flight Simulation Experiment in Obstacle-Rich Environment. (a) Comparison of UAV flight trajectories. (b) Comparison of the x-direction distance error between UAVs and the leader. (c) Comparison of the y-direction distance error between UAVs and the leader.
Figure 7. UAV Flight Simulation Experiment in Obstacle-Rich Environment. (a) Comparison of UAV flight trajectories. (b) Comparison of the x-direction distance error between UAVs and the leader. (c) Comparison of the y-direction distance error between UAVs and the leader.
Electronics 15 00257 g007
Figure 8. Statistical Comparison Chart.
Figure 8. Statistical Comparison Chart.
Electronics 15 00257 g008
Figure 9. HIL Experimental Platform System.
Figure 9. HIL Experimental Platform System.
Electronics 15 00257 g009
Figure 10. HIL Experimental Platform Interaction Logic Diagram.
Figure 10. HIL Experimental Platform Interaction Logic Diagram.
Electronics 15 00257 g010
Figure 11. HIL simulation results. (a) Hungarian-DP Method (b) DPAF-SA Method (c) MATLAB flight path as shown in Figure.
Figure 11. HIL simulation results. (a) Hungarian-DP Method (b) DPAF-SA Method (c) MATLAB flight path as shown in Figure.
Electronics 15 00257 g011
Table 1. Symbol Definitions.
Table 1. Symbol Definitions.
SymbolDefinitions
NNumber of UAVs
p i ( t ) R 3 Position vector of the i-th UAV
v i ( t ) R 3 Velocity Vector for the i-th UAV
A ( t ) Communication Adjacency Matrix
d m i n Minimum Safe Distance
v m a x Maximum Velocity
a m a x Maximum Acceleration
u i ( t ) Control Input for UAV i
ϵ Upper Bound of Position Error
SExpected Formation Slot Grouping
π UAV-Slot Allocation Mapping
δ Obstacle Set
c ( t ) Virtual Pilot Center Position
R o Safe Distance for UAV Obstacle Avoidance
r o UAV radius
Table 2. Key Parameter Settings.
Table 2. Key Parameter Settings.
SymbolValueDescription
N8Number of UAVs
( v x , v y , v z ) (3, 3, 0) m/sNavigator Speed
d m i n 1 mMinimum Safe Distance
r o 0.06 mUAV radius
L i t e r 100Inner loop iteration count
T c 500Initial temperature
k0.95Annealing coefficient
Table 3. Initial Position of UAV in Barrier-Free Environment.
Table 3. Initial Position of UAV in Barrier-Free Environment.
Serial NumberStart Point (m)
UAV120, −50, 20
UAV270, −50, 40
UAV3−60, −10, 60
UAV4−60, −60, 20
UAV5−10, 70, 10
UAV6−60, 60, 50
UAV780, 25, 60
UAV830, 30, 70
Table 4. Initial Position of UAV in Obstacle-Laden Environment.
Table 4. Initial Position of UAV in Obstacle-Laden Environment.
Serial NumberStart Point (m)
UAV10, 30, 20
UAV2−30, 30, 40
UAV3−30, −0, 60
UAV4−30, 30, 20
UAV50, 30, 10
UAV630, −30, 50
UAV730, 0, 6
UAV830, 30, 70
Table 5. Evaluation Indicator Statistics Results.
Table 5. Evaluation Indicator Statistics Results.
MetricMethodSample MeanStandard Deviation95% Confidence Interval
F_RMSEDPAF-SA0.8120.243[0.721, 0.903]
F_RMSEHD1.4921.492[1.312, 1.672]
D_MinDPAF-SA3.1390.622[2.906, 3.372]
D_MinHD2.2680.852[1.949, 2.587]
T_ConvDPAF-SA39.7851.341[39.290, 40.290]
T_ConvHD37.7501.748[37.090, 38.410]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Li, M.; Hao, Y.; Yang, L. DPAF-SA: A Formation Control Algorithm for Dynamic Allocation and Fusion of Potential Fields for UAV Swarms. Electronics 2026, 15, 257. https://doi.org/10.3390/electronics15020257

AMA Style

Li M, Hao Y, Yang L. DPAF-SA: A Formation Control Algorithm for Dynamic Allocation and Fusion of Potential Fields for UAV Swarms. Electronics. 2026; 15(2):257. https://doi.org/10.3390/electronics15020257

Chicago/Turabian Style

Li, Meixuan, Yongping Hao, and Liyuan Yang. 2026. "DPAF-SA: A Formation Control Algorithm for Dynamic Allocation and Fusion of Potential Fields for UAV Swarms" Electronics 15, no. 2: 257. https://doi.org/10.3390/electronics15020257

APA Style

Li, M., Hao, Y., & Yang, L. (2026). DPAF-SA: A Formation Control Algorithm for Dynamic Allocation and Fusion of Potential Fields for UAV Swarms. Electronics, 15(2), 257. https://doi.org/10.3390/electronics15020257

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop