Formation Control for UAVs Considering Safety Constraints Based on Control Barrier Functions with Switched Trajectories and Switching Communication Topologies
Zerui Wei, Xiaoyu Zhang, Yang Song, Rong Guo

TL;DR
This paper presents a control method for UAVs to maintain formation and avoid collisions while switching between different flight paths and communication networks.
Contribution
A novel formation control protocol using control barrier functions and multiple Lyapunov functions for UAVs with switched trajectories and communication topologies.
Findings
The proposed protocol ensures accurate formation tracking under dual-switching scenarios.
Collision avoidance is achieved using control barrier functions during trajectory and topology transitions.
Simulations show effective coordination of formation, switching, and safety in dynamic environments.
Abstract
This paper investigates the formation control problem of multi-UAV systems in the presence of switched trajectories and time-varying communication topologies. A distributed formation control protocol is proposed to enable UAVs to track piecewise continuous trajectories while the underlying communication network switches among a finite set of directed graphs. Sufficient and necessary conditions for achieving accurate formation tracking under dual-switching scenarios are derived through stability analysis while the stability of the overall switched system is proven by using multiple Lyapunov functions. To ensure collision avoidance during both trajectory and topology transitions, control barrier functions (CBFs) are employed to construct safety sets, and a quadratic programming(QP)-based optimization framework is designed to modify control inputs in real time. Simulation results…
Click any figure to enlarge with its caption.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7- —National Natural Science Foundation of China
- —R&D Program of Beijing Municipal Education Commission
- —Young Scholar Research Capability Improvement Plan of BUCEA
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsDistributed Control Multi-Agent Systems · Robotic Path Planning Algorithms · UAV Applications and Optimization
1. Introduction
Unmanned aerial vehicle (UAV) systems have attracted significant attention in both civilian and military domains due to their versatile applications, including reconnaissance [1], target detection, search and positioning [2], and communication relay networks [3].
Existing approaches to formation control primarily encompass the leader–follower method [4], behaviour-based method [5], and virtual structure method [6]. Although the leader–follower strategy is relatively simple to deploy, it is prone to error propagation within its cascaded framework. This leads to the accumulation of tracking inaccuracies, which can ultimately affect the stability of follower UAVs [7]. Behavior-based techniques, while conceptually intuitive, present difficulties in terms of rigorous stability proof and accurate maintenance of the formation geometry [8]. Virtual structure methods are often inflexible and depend on complex mechanisms to synchronize information across multiple UAVs, reducing their applicability in rapidly changing scenarios [9].
In the last few years, distributed coordination in multi-agent systems (MASs) has attracted extensive research attention, particularly in the context of consensus problems. Based on this background, the application of consensus-based strategies to UAV formation control has become a topic of significant interest. Wei Ren, through his work in [10,11], laid important theoretical and practical foundations in this area. He conducted systematic investigations into consensus algorithms for trajectory tracking and formation coordination, and further validated their feasibility through experiments involving wheeled robots. With ongoing developments in consensus theory, formation control schemes built upon such principles have continued to evolve. For instance, reference [12] established sufficient conditions under which second-order clustered MASs can attain desired formation motions over undirected communication graphs. In [13], the problems of trajectory tracking and formation stabilization were studied for discrete-time MASs, leading to a constructive method for designing consensus-based controllers. Furthermore, the authors of ref. [14] addressed trajectory tracking and formation control in first-order integrator-type MASs operating under switching communication topologies, deriving necessary conditions for achieving stable formation configurations.
In the study of formation-related challenges using consensus methodologies, the team headed by Xiwang Dong has made notable contributions in recent years. The study in reference [15] examines time-varying formation design for high-order linear multi-agent systems (MASs) subject to directed switching communication topologies, adopting a consensus-based strategy. Following this, the authors of references [16,17] address formation control issues via output feedback and state feedback, respectively. In the domain of UAV control, references [18,19] developed consensus-based formation control schemes tailored to directed and undirected switching communication networks, respectively. The algorithms proposed in these works have been effectively tested on UAV platforms, confirming both the feasibility and practical applicability of the adopted approaches.
In recent years, reinforcement learning (RL), as a fundamental artificial intelligence technique, has garnered extensive attention from scholars for its applications in the control domain [20]. Currently, numerous researchers have attempted to apply RL algorithms to multi-agent systems (MASs), giving rise to multi-agent reinforcement learning (MARL) [21]. To address complex cooperative tasks characterized by vast policy spaces and convergence difficulties, hybrid approaches that integrate multiple paradigms have emerged as a prevailing trend, with representative works such as [22]. Reinforcement Learning from Human Feedback (RLHF) represents a critical pathway. In [23], prior knowledge or online assessments from human operators are introduced into the training loop as an additional signal, forming a human–machine collaborative closed loop. This method guides agents to learn safe and compliant policies more rapidly. Inspired by biological swarms in nature, research on emergent coordination mechanisms has also attracted increasing attention [24].
However, real-world deployment of such switching protocols must account for safety constraints. As the density of UAVs increases, ensuring inter-agent collision avoidance during these inherently risky transition phases becomes an important concern. Traditional methods may not adequately address these dual objectives of performance and safety in dynamic and uncertain environments. Safety constraints can effectively improve the efficiency of UAV system safety analysis, especially the control barrier functions (CBFs) proposed in recent years [25,26,27].
The Control Barrier Function (CBF) approach incorporates barrier functions to confine the system state within a safe region, establishing a direct relationship between control inputs and safety constraints. This ensures system stability while complying with all safety requirements [28,29]. Moreover, the method can collect environmental data and employ learning strategies to continuously adapt the safe region. CBF offers a versatile solution for addressing safety concerns in UAV systems. With relatively low computational complexity and strong constraint-handling capability, it is suitable for ensuring operational safety under various conditions, including both known and unknown environments, as well as uncertain system states [30]. It can also be integrated with more aggressive planning algorithms to improve mission efficiency [31]. In recent years, CBF has become an important method for safety control in UAV system research, and has been applied to scenarios such as fixed-area coverage [32], mobile coverage [33], communication maintenance [34], payload transport [35], and aircraft carrier landing [36]. The introduction of safety barrier certificates has further improved the scalability of UAV systems in complex multi-constraint environments [37], broadening the applicability of CBF in UAV operations.
However, there still exist challenges in actual deployment using the safety constraint methods:
-
Ensuring that UAVs form the expected formation, tracking the switched trajectories, while avoiding collisions during the switching process.
-
Considering the switching of trajectory and communication topology at the same time.
The main contributions of this paper are summarized as follows:
-
Unlike works that handle only a single type of switching or plan safety offline, this paper designs a distributed protocol capable of simultaneously handling online switching in both communication topology and reference trajectories, integrated with a real-time safety mechanism based on Control Barrier Functions (CBFs), forming a complete closed-loop solution.
-
By employing the multiple Lyapunov functions approach and deriving a dwell time constraint, this paper provides rigorous stability analysis for UAV swarm systems undergoing simultaneous trajectory and topology switching, proving exponential stability under the proposed conditions.
-
In contrast to many works that apply CBFs in static environments or under fixed topologies, this paper addresses the critical challenge of ensuring collision-free operation throughout the mission by the online construction of safety sets and real-time modification of control inputs via Quadratic Programming (QP) during the highly dynamic process where both trajectories and topology are switching.
The subsequent discussion is structured as follows. Preliminary knowledge and a mathematic model of UAVs are given in Section 2. The control protocol is presented in Section 3. The control barrier functions are proposed in Section 4. Section 5 reports the simulation verification results. Section 6 provides conclusions.
2. Problem Formulation
2.1. Preliminary Knowledge
Considering a system with N UAVs, the interaction topology of the system is characterised as a directed graph , consisting of a set of nodes , a set of edges and a weighted adjacency matrix . The edges of are denoted by . The set of neighbors of node consists of . The incidence of node is defined as . The incidence degree matrix of is defined as . The Laplacian matrix of is defined as . is the switching signal, and is a finite set of topological modes. The existence of a spanning tree for a directed graph is contingent upon the presence of at least one node that possesses directed paths to all other nodes.
Lemma 1 ([38]). It is posited that donates the Laplacian matrix of a directed graph G; then, (1) L has one zero eigenvalue at least, and is an associated eigenvector, i.e., .
(2) In the event that G possesses a spanning tree, it can be deduced that 0 is a simple eigenvalue of L and that all of the remaining eigenvalues possess positive real parts.
Lemma 2 ([39]). For a system where M is a 2 × 2 complex matrix and the characteristic polynomial is , the system is asymptotically stable if and only if and .
Lemma 3 ([40]). Suppose we have candidate Lyapunov functions , and vector fields as in with , for each . Also, is continuous. Let be the set of all switching sequences associated with the system. If for each , of all θ, is Lyapunov-like for and , and satisfies the sequence-nonincreasing condition for , then the system is stable in the Lyapunov sense.
2.2. Formation Problem
In the context of formation control, the UAV can be expressed as a point-mass system. The dynamics of the UAV system can be modelled as follows:
where denotes the position vector, denotes the velocity vector, and denotes the control input of the UAV.
In the following, for simplicity of description, it is assumed that , if not otherwise specified. However, it should be pointed out that similar analysis can also be performed for the higher-dimensional case by using Kronecker product, and all the results hereafter remain valid for .
The UAV system above can be rewritten as follows:
where , , .
Let ( and , indicate which variable will switch) be piecewise continuously differentiable vectors, where and represent the reference position and velocity components for each UAV, respectively, and , where
and is continuous in each time interval. Furthermore satisfies at the switching instant, where is the time for formation switching.
Definition 1.
It is asserted that a UAV system is said to realize the formation , provided is satisfied.
Based on the description above and considering the challenges identified in the Introduction, this paper aims to address the following problem: designing a control protocol for system (1) to complete switching formation control and ensure the safety of the formations during switching.
3. Control Protocol Design
The formation control protocol is designed as shown below:
where , and , , , are the constants.
The following discussion first addresses the case where the communication topology is fixed. At this point, formation control protocol is denoted as follows:
Let , , . Subsequently, under the condition of employing the formation control protocol (4), the UAV system can be expressed as follows:
Let and ; UAV system (5) can then be expressed in the following equation:
Due to the condition of , and , UAV system (6) can be rewritten as follows:
By defining the tracking error relative to the reference trajectory, the formation tracking problem can be equivalently transformed into a consensus problem of the error system. That is to say, cluster system (5) can achieve formation if and only if cluster system (7) achieves consensus.
Let be the eigenvalue of the Laplacian matrix L of the directed graph G, where is the eigenvalue corresponding to the eigenvector , is the eigenvalue corresponding to the eigenvector , is the eigenvalue corresponding to the eigenvector , and so on; . Let , where , J is the approximate standard form of L.
Theorem 1.
In the case of fixed communication topology and formation command, UAV system (1) is asymptotically stable under control protocol (4) if and only if the following conditions hold:
(a) For any , , we have
(b) For any , we have
-
,*
-
,*
- where
Proof. Through Lemma 1, let ; consists of approximate blocks corresponding to . Let , , ; then, system (7) can be transformed into the following:
It can be inferred from the previous sections that cluster system (5) can realize the formation in each time interval if and only if . Therefore, according to , the following equation can be obtained:
We first establish that if condition (a) holds, then the following equation holds:
If condition (a) holds, then so does the following:
Substituting into Equation (12) and left-multiplying both sides simultaneously by , we have the following:
Since G has a spanning tree, according to Lemma 1 and the structure of J, is nonsingular. Left-multiplying on both sides of (13), i.e., condition (a), creates a sufficient condition for (11).Let , where and , with being the last column vector of . Since rank , then from (11),
Since is an approximately transformed array, it can be demonstrated that the row vectors are mutually perpendicular, and since and , , and are chunked into the following chunked matrices, respectively:
Multiplying the two equations together, we have , i.e.,
Let ; then, the following can be obtained from Equations (14) and (15):
Left-multiplying on both sides of (13), we obtain the following:
It can be demonstrated from Equation (17) that condition (a) is satisfied. Therefore, condition (a) in Theorem 1 is equivalent to Equation (11).We can find that condition (a) differs from Equation (17) in form. For a detailed proof of equivalence between the two formulas, please refer to Appendix A.At this point, Equation (9) becomes the following:
Since ,
where
Therefore, the stability of system (18) is equivalent to the stability of the following subsystems:
where
The characteristic polynomial of the subsystem state matrix is given by the following expression: , where z is a complex variable, . As demonstrated in Lemma 2, system (9) is asymptotically stable under condition (b).Proof ends. □
Theorem 2.
In the case of fixed communication topology and switching formation command, if there exist positive definite symmetric matrices , such that
where , UAV system (1) can achieve stability in the Lyapunov sense under control protocol (4), that is, the UAV system can achieve formation .
Proof. Take the Lyapunov functions in each time interval as
Then, we have the following:
Due to satisfying at the switching instant and , the error state is continuous at the switching instant, i.e., .For each Lyapunov function of each subsystem, if we take , then
According to (23), (24) and Lemma 3, the UAV system is stable in the Lyapunov sense under the condition that the communication topology is fixed.The proof ends. □
Theorem 3.
In the case of switched communication topology and switching formation command, if there exist positive definite symmetric matrices , such that
where , the dwell time satisfies , where and Then, UAV system (1) can achieve exponential stability under control protocol (3), that is, the UAV system can achieve control objectives.
Proof. Considering system (7), since , take the Lyapunov functions for each topology h as follows:
For each subsystem under a given topology, we have the following:
Take , then
Let the switching moment be , then the following inequality holds:
Considering the time interval and , the system operates under topology h within this interval; therefore,
where .Remark 1. The physical meaning of α is the lower bound of the minimum convergence rate of the overall switched system across all possible communication topologies. It directly determines the minimum dwell time required to guarantee exponential stability: . A larger α indicates the stronger intrinsic stability and faster convergence capability of the system, thus allowing for more frequent switching. Conversely, a smaller α requires that switching cannot be too frequent, ensuring the system has sufficient time to converge between switches. At the switching moment ,
The following can be obtained by successive recursion:
where represents the number of switches within , and .Then,
When is satisfied, the system is exponentially stable.Proof ends. □
4. Safety Constraints
4.1. Control Barrier Functions
The Control Barrier Function (CBF) is a method employed to ensure that an agent performs collision-free motion. Constraining the time derivatives of the CBF within prescribed limits ensures the forward invariance of the desired set and guarantees the stability of the system.
Consider the following control system in affine form:
where and , f and g are Lipschitz-continuous, and assuming that there exists a set , we would like the states of all agents to remain invariant. Therefore, the objective is to design a controller u which can guarantee the forward invariance of , i.e., to make the state of the system (34) remain within , from the beginning to the end. Assume that the set denoted by can be defined as the level set of a particular function :
Definition 2 ([41]). For a continuously differentiable function and a given system, system (34), if there exists a local Lipschitz expansion of the class of functions α and a set such that for all ,
then the function h is defined as a Control Barrier Function, defined on .
Given a CBF h, the feasible set of control inputs is as follows:
4.2. Safety Constraints
As previously outlined, the dual integrator system for UAV can be modified as follows:
Define safety constraints and safety sets, respectively:
where is the defined safety distance, while , and .
To ensure the forward invariance of , the following must be satisfied:
where is the lower bound of the decay rate.
Remark 2. In the CBF, the decay rate is usually related to the derivative of the function and the function value itself. Specifically, if there exists a constant γ which makes hold, then it can be considered a lower bound on the decay rate of the CBF. The size of the lower bound on the decay rate γ affects the strength of the CBF’s “rejection” of the system state. When γ is large, the function h will have a weaker repulsion effect on the unsafe region, and the system state may approach the unsafe region more easily. If γ is small, the function h will have a stronger repulsion effect on the unsafe region, and the system state may approach the unsafe region with more difficulty.
Remark 3. (39) depends only on the local position information of agents while the definition and computation are independent of the global communication topology. Regardless of how communication links switch, as long as two agents are within sensing range of each other, the CBFs remain well-defined and can be computed. This provides an absolute safety boundary for the motion of the agents.
According to (37) and (39), the UAV safety constraints can be constructed as follows:
where
which means that the UAV system is guaranteed to be safe according to Definition 2.
Using QP allows us to achieve the goals of collision avoidance and minimization of changes to the original control inputs:
where is the original control input and is the input modified by CBFs.
This QP allows the system to operate with high-performance tracking most of the time, and only introduces safety intervention with minimal performance cost when necessary, thereby achieving an optimal balance between the safety and tracking accuracy during switching processes.
5. Simulation
This section will demonstrate the application of the above method in a simulation environment to prove the validity of the theory proven in Section 3 and Section 4. The communication topology of the UAV system is shown in Figure 1, with a weight of 1 in the communication topology, Figure 2 shows the period of communication topology switching.
5.1. Formation Setting
Since the simulation takes place in 3D space, according to the conditions in Theorem 1 and Remark 1, we take and the lower bound of the attenuation rate . Meanwhile, is designed as (39) and m.
The initial positions of each UAV are set to (0, 0, 2), (2, 2, 2), (−2, 2, 2), (4, 4, 2), and (−4, 4, 2), respectively, and the five UAVs are numbered in order as i (i = 1, 2, 3, 4, 5).
In the first stage, i.e., before 20 s, the trajectory of UAV is formulated as follows:
where are the components of the UAVs’ reference trajectory in the three coordinate axes. The UAV platform adopted in this simulation is a quadcopter aircraft.
In particular, let the formation trajectory 5 s later be designated , which is the formation centre after formation switching.
The trajectories of UAVs named are as follows:
where i = 2, 3, 4, 5, and the variables and represent the initial position deviations of the i-th UAV and the first UAV, respectively, in the x and y axis directions.
At 20 s, the formation is switched, and the subsequent trajectories of the five UAVs are illustrated in the subsequent equation:
where i = 1, 2, 3, 4, 5 and s = 3.
5.2. Simulation Results
Figure 3 shows the distances between each pair of UAVs under conditions with and without safety constraints, respectively. It can be seen that when there exist no safety constraints, collision between UAVs may happen. As shown in Figure 3a, the minimum inter-agent distance throughout the entire mission is 2.03 m, which unmistakenly exceeds the safety threshold m.
Figure 4 illustrates the formation trajectory under CBFs.
Figure 5 illustrates the error between the actual trajectory of the UAVs and the expected trajectory. As shown in Figure 5, the tracking error converges rapidly and remains within 0.15 m in a steady state.
Figure 6 illustrates the comparison between the actual trajectory and the reference trajectory of each UAV.
It can be seen that there is a certain degree of error between the actual trajectory and the reference trajectory after the formation switching. This result is due to CBFs adjusting the control input to ensure the safety of the formation.
6. Conclusions
By addressing communication topology switching and formation trajectory switching, the corresponding novel switching formation control protocol and safety control framework are proposed. Through this control protocol, UAVs can maintain a stable formation structure and perform switched trajectories. Additionally, a proof of the sufficient and necessary conditions for the switching formation control protocol is provided to ensure that each subsystem of the UAV system can be asymptotically stable. Moreover, through the method of multiple Lyapunov functions, it is proven that switching systems can allow us to achieve stability under the condition that each subsystem is asymptotically stable. Furthermore, the CBFs enable the monitoring of distances between UAVs, thereby ensuring safety during trajectory switching. The simulation results validate the effectiveness of the proposed method: all inter-agent distances remain above 2 m throughout the mission, guaranteeing collision-free operation. The tracking error converges to within 0.15 m after each switch, demonstrating high-accuracy formation tracking. Meanwhile, successful formation and topology switching corroborates the dwell time condition for switched-system stability. Future work will focus on extending the proposed method to more realistic dynamics and robust communication protocols, and providing experimental validation with physical UAV platforms.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Liu C. Liang G. Wang H. Li W. The Application of Ant Algorithm to Path Planning to Reconnaissance UAVJ. Fire Control Command Control 2005302224
- 2Pack D.J. De Lima P. Toussaint G.J. York G. Cooperative control of UA Vs for localization of intermittently emitting mobile targets IEEE Trans. Syst. Man Cybern. Part B (Cybern.)20093995997010.1109/TSMCB.2008.201086519473935 · doi ↗ · pubmed ↗
- 3Sivakumar A. Tan C.K.Y. UAV swarm coordination using cooperative control for establishing a wireless communications backbone Proceedings of the 9th International Conference on Autonomous Agents and Multiagent Systems ACM Richland, SC, USA 2010 Volume 311571164
- 4Wang X. Yadav V. Balakrishnan S. Cooperative UAV formation flying with obstacle/collision avoidance IEEE Trans. Control Syst. Technol.20071567267910.1109/TCST.2007.899191 · doi ↗
- 5Sharma R. Ghose D. Collision avoidance between UAV clusters using swarm intelligence techniques Int. J. Syst. Sci.20094052153810.1080/00207720902750003 · doi ↗
- 6Li N.H. Liu H.H. Formation UAV flight control using virtual structure and motion synchronization Proceedings of the 2008 American Control Conference, Seattle, WA, USA, 1–13 June 2008 IEEE New York, NY, USA 200817821787
- 7Xue Z. Zeng J. Circle formation control of large-scale intelligent swarm systems in a distributed fashion Proceedings of the International Symposium on Neural Networks, Wuhan, China, 26–29 May 2009 Springer Berlin/Heidelberg, Germany 200911051115
- 8Liu Y. Geng Z. Finite-time formation control for linear multi-agent systems: A motion planning approach Syst. Control Lett.201585546010.1016/j.sysconle.2015.08.009 · doi ↗
