In recent decades, unmanned aerial vehicles (UAVs) have played an increasingly vital role in both military and civilian applications. Traditional missions often rely on single or dispersed drones, but for complex tasks, a single drone may suffer from low efficiency and success rates. To overcome these limitations, multiple drones can cooperate to form specific configurations, known as drone formations, which expand operational coverage and enhance mission reliability. Drone formation flight refers to the ability of multiple drones to maintain a predefined spatial arrangement while flying, and to adapt this formation in response to environmental changes or task requirements. Common formations include the “V” shape, diamond, triangle, and others, each serving distinct purposes such as reconnaissance, interception, or area coverage. Due to these advantages, drone formations are employed in military reconnaissance for rapid wide-area scanning, as well as in civilian applications like forest firefighting and agricultural seeding. To achieve effective collaboration within a drone formation, advanced control methods are essential, making formation control a key research focus.
Various approaches to drone formation control have been developed, including leader-follower methods, behavior-based techniques, and virtual structure strategies. The leader-follower approach designates one drone as a leader with predefined states, while others follow by tracking the leader’s speed, heading, and altitude. Although simple, this method can suffer from poor robustness due to error propagation. Behavior-based methods determine drone responses based on sensor data, incorporating behaviors like collision avoidance, obstacle evasion, target attraction, and formation keeping. While robust and flexible, they may not ensure precise formation maintenance. Virtual structure methods treat the formation as a rigid virtual body, with each drone corresponding to a fixed point, requiring high communication quality and computational power. These methods can be unified under the framework of consensus theory, which offers a distributed algorithmic foundation for cooperative control. Consensus algorithms enable drones to reach agreement on states through local information exchange with neighbors, providing advantages like reliability, self-healing, and scalability. However, standard consensus algorithms often neglect practical constraints such as mobility limits, flight performance bounds, and collision avoidance, which are critical for real-world drone operations. This paper addresses these gaps by proposing an improved consensus-based algorithm for drone formation control, incorporating constraint handling and collision avoidance strategies to ensure feasibility and safety.

We begin by establishing a kinematic model for drones in a formation. The drone formation configuration is described using a ground coordinate system, with the origin O arbitrarily chosen on the horizontal plane. The OX and OY axes lie in the horizontal plane, and the OZ axis points vertically upward. Each drone is treated as a point mass, and its position is defined by coordinates along these axes. The relative positions between drones in the formation are specified by matrices \(R_x\), \(R_y\), and \(R_z\), representing desired offsets along the OX, OY, and OZ directions, respectively. For a formation of n drones, these matrices are defined as:
$$R_x = \begin{bmatrix}
x_{11} & x_{12} & \cdots & x_{1n} \\
x_{21} & x_{22} & \cdots & x_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n1} & x_{n2} & \cdots & x_{nn}
\end{bmatrix}, \quad R_y = \begin{bmatrix}
y_{11} & y_{12} & \cdots & y_{1n} \\
y_{21} & y_{22} & \cdots & y_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
y_{n1} & y_{n2} & \cdots & y_{nn}
\end{bmatrix}, \quad R_z = \begin{bmatrix}
z_{11} & z_{12} & \cdots & z_{1n} \\
z_{21} & z_{22} & \cdots & z_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
z_{n1} & z_{n2} & \cdots & z_{nn}
\end{bmatrix}$$
where \(x_{ij}, y_{ij}, z_{ij}\) denote the desired relative positions between drone i and drone j, with \(x_{ii} = y_{ii} = z_{ii} = 0\). When the drone formation achieves stability, the following conditions must hold:
$$x_i – x_j \to x_{ij}, \quad y_i – y_j \to y_{ij}, \quad z_i – z_j \to z_{ij}, \quad V_i – V_j \to 0$$
where \(x_i, y_i, z_i\) are the coordinates of drone i, and \(V_i\) is its speed. To model drone dynamics, we use a decoupled autopilot model that separates longitudinal and lateral motions, resulting in a three-degree-of-freedom kinematic equation:
$$\begin{aligned}
\dot{x}_i &= v_{xi} \\
\dot{y}_i &= v_{yi} \\
\dot{z}_i &= v_{zi} \\
\dot{v}_{xi} &= \frac{1}{\tau_v} (v_{cxi} – v_{xi}) \\
\dot{v}_{yi} &= \frac{1}{\tau_v} (v_{cyi} – v_{yi}) \\
\ddot{z}_i &= -\frac{1}{\tau_{\dot{z}}} \dot{z}_i + \frac{1}{\tau_z} (z_{ci} – z_i)
\end{aligned}$$
Here, \(v_{xi}\) and \(v_{yi}\) are the velocities along the OX and OY axes, respectively; \(v_{zi} = \dot{z}_i\) is the climb rate along the OZ axis; \(v_{cxi}, v_{cyi}, z_{ci}\) are the command signals for velocity and altitude; and \(\tau_v, \tau_z, \tau_{\dot{z}}\) are time constants. The drone’s motion must satisfy constraints related to maneuverability and flight performance, given by:
$$v_i \in (v_{\text{min}}, v_{\text{max}}), \quad \dot{v}_i \in (a_{\text{min}}, a_{\text{max}}), \quad \dot{z}_i \in (\dot{z}_{\text{min}}, \dot{z}_{\text{max}}), \quad \ddot{z}_i \in (\ddot{z}_{\text{min}}, \ddot{z}_{\text{max}}), \quad \dot{\phi}_i \in (\omega_{\text{min}}, \omega_{\text{max}})$$
where \(v_i = \sqrt{v_{xi}^2 + v_{yi}^2}\) is the speed in the horizontal plane, \(\dot{v}_i\) is the acceleration in that plane, \(\dot{\phi}_i\) is the heading angular rate, and the subscripts “min” and “max” denote the minimum and maximum allowable values. These constraints ensure that the drone formation operates within safe and feasible limits during flight.
The foundation of our approach lies in consensus theory, which enables distributed agreement among multiple agents. For a system of n agents with dynamics described by \(\dot{x}_i = v_i\) and \(\dot{v}_i = u_i\), the basic consensus algorithm is:
$$u_i = -\sum_{j=1}^n a_{ij} \left[ (x_i – x_j) + \alpha (v_i – v_j) \right]$$
where \(a_{ij}\) are elements of the adjacency matrix representing the communication topology, and \(\alpha > 0\) is a gain parameter. For a drone formation, if the communication graph contains a directed spanning tree and \(\alpha\) exceeds a threshold, the states \(x_i\) and \(v_i\) converge to consensus, i.e., \(x_i(t) – x_j(t) \to 0\) and \(v_i(t) – v_j(t) \to 0\) as \(t \to \infty\). However, this basic algorithm does not account for formation shapes or constraints, necessitating improvements for practical drone formation control.
We propose an improved consensus-based algorithm that integrates formation configuration information and handles constraints. First, we design formation state control laws to drive the drones’ heading, speed, and altitude to desired consensus values. Using the decoupled model, the control laws for heading, speed, and altitude commands are derived from the consensus principle:
$$\begin{aligned}
\phi_{ci} &= \phi_i + \tau_\phi u_{\phi i}, \quad u_{\phi i} = -b_i (\phi_i – \phi^*) – \sum_{j=1}^n a_{ij} (\phi_i – \phi_j) \\
v_{ci} &= v_i + \tau_v u_{v i}, \quad u_{v i} = -c_i (v_i – v^*) – \sum_{j=1}^n a_{ij} (v_i – v_j) \\
z_{ci} &= z_i + \tau_z \tau_{\dot{z}} \dot{z}_i + \tau_z u_{z i}, \quad u_{z i} = -d_i (z_i – z^*) – k \dot{z}_i – \sum_{j=1}^n a_{ij} \left[ (z_i – z_j) + \gamma (\dot{z}_i – \dot{z}_j) \right]
\end{aligned}$$
where \(\phi^*, v^*, z^*\) are the desired heading, speed, and altitude for the drone formation; \(b_i, c_i, d_i, k, \gamma\) are positive control coefficients; and \(\tau_\phi, \tau_v, \tau_z\) are time constants. These laws ensure that the drones’ states converge to the target values, but they do not enforce specific formation shapes. To incorporate formation configurations, we transform the motion into components along the OX, OY, and OZ axes. The velocity components are related to heading and speed by \(v_{xi} = v_i \cos \phi_i\) and \(v_{yi} = v_i \sin \phi_i\). The formation control laws then become:
$$\begin{aligned}
v_{cxi} &= v_{xi} + \tau_v u_{xi}, \quad u_{xi} = -b_i (v_{xi} – v_x^*) – \sum_{j=1}^n \left[ a_{ij} (v_{xi} – v_{xj}) – k_{xi} (x_i – x_j – \bar{x}_{ij}) \right] \\
v_{cyi} &= v_{yi} + \tau_v u_{yi}, \quad u_{yi} = -c_i (v_{yi} – v_y^*) – \sum_{j=1}^n \left[ a_{ij} (v_{yi} – v_{yj}) – k_{yi} (y_i – y_j – \bar{y}_{ij}) \right] \\
z_{ci} &= z_i + \tau_z \tau_{\dot{z}} \dot{z}_i + \tau_z u_{z i}, \quad u_{z i} = -d_i (z_i – z^*) – k \dot{z}_i – \sum_{j=1}^n a_{ij} \left[ (z_i – z_j – \bar{z}_{ij}) + \gamma (\dot{z}_i – \dot{z}_j) \right]
\end{aligned}$$
Here, \(\bar{x}_{ij}, \bar{y}_{ij}, \bar{z}_{ij}\) are the desired relative positions from matrices \(R_x, R_y, R_z\); \(v_x^*, v_y^*\) are the desired velocity components; and \(k_{xi}, k_{yi}\) are adjustable parameters. These laws enable the drone formation to achieve both state consensus and maintain the specified formation shape, supporting tasks like formation assembly and reconfiguration.
However, the control signals generated by these laws may violate the maneuverability and flight performance constraints. To address this, we introduce a “minimum adjustment” strategy that modifies the control commands to satisfy constraints while minimizing changes. This strategy is applied separately in the horizontal plane and along the vertical axis due to their independence. In the horizontal plane, for each drone i at time t, the acceleration components \(u_{xi}(t)\) and \(u_{yi}(t)\) are adjusted based on constraints for acceleration \(\dot{v}_i\), speed \(v_i\), and heading angular rate \(\dot{\phi}_i\). Let the time step be \(\Delta t\). The acceleration magnitude is \(a_i(t) = \sqrt{u_{xi}(t)^2 + u_{yi}(t)^2}\), and the predicted speed at \(t+\Delta t\) is \(v_i(t+\Delta t) = v_i(t) + a_i(t) \Delta t\). If \(v_i(t+\Delta t)\) exceeds the bounds \([v_{\text{min}}, v_{\text{max}}]\), the acceleration bounds are updated to:
$$a’_{\text{min},i}(t) = \frac{v_{\text{min}} – v_i(t)}{\Delta t}, \quad a’_{\text{max},i}(t) = \frac{v_{\text{max}} – v_i(t)}{\Delta t}$$
Combining with the original acceleration constraints, the new bounds are:
$$a^{\text{new}}_{\text{min},i}(t) = \max(a_{\text{min}}, a’_{\text{min},i}(t)), \quad a^{\text{new}}_{\text{max},i}(t) = \min(a’_{\text{max},i}(t), a_{\text{max}})$$
If \(a_i(t)\) is outside these bounds, we scale \(u_{xi}(t)\) and \(u_{yi}(t)\) proportionally to bring \(a_i(t)\) to the nearest bound, yielding adjusted values \(u’_{xi}(t)\) and \(u’_{yi}(t)\). Next, to satisfy the heading angular rate constraint \(\dot{\phi}_i \in [\omega_{\text{min}}, \omega_{\text{max}}]\), we compute the predicted heading \(\phi_i(t+\Delta t) = \arctan\left( \frac{v_{yi}(t) + u’_{yi}(t) \Delta t}{v_{xi}(t) + u’_{xi}(t) \Delta t} \right)\). If \(\phi_i(t+\Delta t)\) is outside the allowable range \([\phi_{\text{min},i}(t+\Delta t), \phi_{\text{max},i}(t+\Delta t)]\) derived from \(\dot{\phi}_i\) constraints, we solve equations to adjust \(u’_{xi}(t)\) and \(u’_{yi}(t)\) while keeping the acceleration magnitude constant. The solution that minimizes the change in acceleration direction is selected, resulting in final adjusted values \(u”_{xi}(t)\) and \(u”_{yi}(t)\). Along the OZ axis, the climb acceleration \(u_{zi}(t)\) is adjusted based on constraints for climb rate \(\dot{z}_i\) and climb acceleration \(\ddot{z}_i\). The predicted climb rate is \(\dot{z}_i(t+\Delta t) = \dot{z}_i(t) + u_{zi}(t) \Delta t\). If it violates bounds, the climb acceleration bounds are updated similarly, and \(u_{zi}(t)\) is clipped to the new bounds, giving \(u’_{zi}(t)\). This ensures that all constraints are met with minimal adjustments to the control commands.
To prevent collisions within the drone formation, we further adjust the climb accelerations using a Particle Swarm Optimization (PSO) algorithm. After the constraint handling step, if the predicted distances between any two drones are less than a safety distance \(d_{\text{safe}}\), we optimize the climb accelerations \(u’_{zi}(t)\) to avoid collisions while minimizing changes. Let the vector of climb accelerations be \(\mathbf{u}”_z = [u”_{z1}(t), u”_{z2}(t), \ldots, u”_{zn}(t)]\), with each element constrained to \([\ddot{z}^{\text{new}}_{\text{min},i}(t), \ddot{z}^{\text{new}}_{\text{max},i}(t)]\). The PSO algorithm minimizes the objective function:
$$J = \sum_{i=1}^n |u”_{zi}(t) – u’_{zi}(t)|$$
subject to the constraint that the distance between any two drones is greater than \(d_{\text{safe}}\). The PSO update equations for particle e at iteration o are:
$$\begin{aligned}
\Delta \mathbf{u}”_{z e}(o) &= \bar{\omega} \Delta \mathbf{u}”_{z e}(o-1) + c_1 \text{rand}_1 \cdot (\mathbf{p}_{z e}(o) – \mathbf{u}”_{z e}(o)) + c_2 \text{rand}_2 \cdot (\mathbf{p}_{z w}(o) – \mathbf{u}”_{z e}(o)) \\
\mathbf{u}”_{z e}(o+1) &= \mathbf{u}”_{z e}(o) + \Delta \mathbf{u}”_{z e}(o)
\end{aligned}$$
where \(\bar{\omega}\) is the inertia weight, \(c_1\) and \(c_2\) are acceleration constants, \(\text{rand}_1\) and \(\text{rand}_2\) are random numbers in \([0,1]\), \(\mathbf{p}_{z e}(o)\) is the personal best, and \(\mathbf{p}_{z w}(o)\) is the global best. This optimization ensures collision-free drone formation flight with minimal adjustments to vertical control commands.
We provide a convergence proof for the improved consensus algorithm. The adjustments to control commands act as bounded perturbations to the linear consensus system. Consider the Lyapunov function candidate:
$$V = \frac{1}{2} \sum_{i=1}^n \sum_{j=1}^n n (x_i – x_j)^2 + \frac{1}{2} \sum_{i=1}^n \sum_{j=1}^n (v_i – v_j)^2$$
Its derivative along the system dynamics, with adjusted controls \(u_i – \Delta u_i\), can be bounded as:
$$\dot{V} \leq -\left( n\alpha – \frac{1}{2} \right) \sum_{i=1}^n \sum_{j=1}^n (v_i – v_j)^2 + \Delta U$$
where \(\Delta U = \frac{1}{2} \sum_{i=1}^n \sum_{j=1}^n (\Delta u_i – \Delta u_j)^2\). If \(n\alpha > \frac{1}{2}\), then \(\dot{V} \leq 0\) when \(\| \mathbf{v} \| \geq \sqrt{\frac{\Delta U}{n\alpha – 1/2}}\), where \(\mathbf{v}\) is the vector of velocity differences. Thus, the system converges to a small neighborhood of consensus, with bounded error due to adjustments, ensuring stability for the drone formation control.
To validate the proposed algorithm, we conduct simulation studies for a drone formation of eight drones. The desired formation is a diamond shape, with relative position matrices as specified. The initial states of the drones, constraint parameters, and algorithm settings are listed in the following tables:
| Drone ID | x(0) (m) | y(0) (m) | z(0) (m) | v(0) (m/s) | φ(0) (rad) | ż(0) (m/s) |
|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 74 | π/6 | 8 |
| 2 | 50 | 0 | 0 | 97 | 3π/7 | 5 |
| 3 | 100 | 0 | 0 | 102 | π/3 | 5 |
| 4 | 150 | 0 | 0 | 73 | π/4 | 9 |
| 5 | 200 | 0 | 0 | 51 | π/8 | 3 |
| 6 | 250 | 0 | 0 | 132 | π/5 | 4 |
| 7 | 300 | 0 | 0 | 81 | π/4 | 8 |
| 8 | 350 | 0 | 0 | 41 | 2π/7 | 6 |
| Parameter | Value | Parameter | Value |
|---|---|---|---|
| \(v_{\text{min}}\) | 10 m/s | \(v_{\text{max}}\) | 600 m/s |
| \(a_{\text{min}}\) | -5 g | \(a_{\text{max}}\) | 5 g |
| \(\dot{z}_{\text{min}}\) | -30 m/s | \(\dot{z}_{\text{max}}\) | 30 m/s |
| \(\ddot{z}_{\text{min}}\) | -5 m/s² | \(\ddot{z}_{\text{max}}\) | 5 m/s² |
| \(\omega_{\text{min}}\) | -π/4 rad/s | \(\omega_{\text{max}}\) | π/4 rad/s |
| \(\tau_v\) | 4 s⁻¹ | \(\tau_z\) | 0.05 s⁻¹ |
| \(\tau_{\dot{z}}\) | 1.184 s⁻¹ | \(d_{\text{safe}}\) | 15 m |
| PSO particles (\(N_p\)) | 20 | PSO iterations (\(N_{\text{iter}}\)) | 20 |
The desired formation states are set as \(\phi^* = \pi/4\) rad, \(v^* = 150\) m/s, and \(z^* = 100\) m. The communication topology is assumed to be a complete graph, meaning all drones exchange information with each other. We first simulate formation state control using the proposed constraint handling strategy. The results show that the drones’ speed, heading, and altitude converge to the desired values within the constraints. However, without formation shape information, the drones do not form any specific pattern, highlighting the need for integrated formation control. Next, we apply the full improved consensus algorithm for formation control. The drones successfully assemble into the diamond formation while satisfying all constraints. The minimum distance between drones remains above \(d_{\text{safe}} = 15\) m, with a lowest value of 17.77 m, confirming collision avoidance. For comparison, simulations without constraint handling show violations of acceleration, angular rate, and climb rate bounds, and the minimum distance drops to 14.05 m, indicating collision risk. Additionally, we compare with an artificial potential field method for collision avoidance, which yields a minimum distance of 14.88 m, still below the safety threshold, demonstrating the superiority of our PSO-based approach. Finally, we test formation reconfiguration by switching from a convex pentagon to the diamond formation at t = 30 s. The drones smoothly transition to the new shape while maintaining constraint satisfaction, with states converging quickly after the command. Throughout, the drone formation exhibits stable and coordinated behavior.
The simulation results are summarized in the following table, showing key performance metrics for the formation control scenarios:
| Scenario | Convergence Time (s) | Min Distance (m) | Constraint Violations | Formation Accuracy |
|---|---|---|---|---|
| State Control Only | ~20 | N/A | None | No formation |
| Formation Control with Constraints | ~25 | 17.77 | None | High (diamond achieved) |
| Formation Control without Constraints | ~25 | 14.05 | Yes (acceleration, angular rate) | High |
| Formation Reconfiguration | ~10 (after command) | 18.50 | None | High (pentagon to diamond) |
The improved consensus algorithm effectively handles the complexities of drone formation control. By integrating formation shape information into the consensus laws, we enable precise configuration maintenance. The “minimum adjustment” strategy ensures that control commands respect mobility and performance limits, which is crucial for real-world drone operations. The PSO-based collision avoidance further enhances safety by optimizing vertical motions. Our convergence analysis confirms that the system remains stable despite adjustments, with errors bounded by the magnitude of modifications. These contributions advance the practicality of consensus-based methods for drone formations, making them suitable for applications like surveillance, disaster response, and aerial displays. Future work may explore dynamic communication topologies, external disturbances, and scalability to larger drone swarms. In conclusion, the proposed algorithm provides a robust and feasible solution for drone formation control, balancing performance with real-world constraints to achieve reliable and safe cooperative flight.
