{'fraction_non_alphanumeric': 0.04189396748053599, 'fraction_numerical': 0.018960860123934112, 'mean_word_length': 3.9741833508956796, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Non-cascaded Control Barrier Functions for the Safe Control of Quadrotors

Researchers have developed various cascaded controllers and non-cascaded controllers for the navigation and control of quadrotors in recent years. It is vital to ensure the safety of a quadrotor both in normal state and in abnormal state if a controller tends to make the quadrotor unsafe. To this end, this paper proposes a non-cascaded Control Barrier Function (CBF) for a quadrotor controlled by either cascaded controllers or a non-cascaded controller. Incorporated with a Quadratic Programming (QP), the non-cascaded CBF can simultaneously regulate the magnitude of the total thrust and the torque of the quadrotor determined a controller, so as to ensure the safety of the quadrotor both in normal state and in abnormal state. The non-cascaded CBF establishes a non-conservative forward invariant safe region, in which the controller of a quadrotor is fully or partially effective in the navigation or the pose control of the quadrotor. The non-cascaded CBF is applied to a quadrotor performing trajectory tracking and a quadrotor performing aggressive roll maneuvers in simulations to evaluate the effectiveness of the non-cascaded CBF.


I. INTRODUCTION
Researchers have made great progress with the design, navigation, and control of quadrotors in recent years. Several challenging tasks (e.g., surveillance, delivery, and rescue [1], [2], [3]) have been addressed by quadrotors. However, a navigation strategy, a control strategy, or manual manipulations may lead a quadrotor into an unsafe state (e.g., collisions), especially when developing a new navigation strategy or a new control strategy [4]. It's crucial to ensure the safety of a quadrotor, even if a navigation strategy, a control strategy, or manual manipulations tend to make the quadrotor unsafe.
Control Barrier Functions (CBFs) [5] have been developed to ensure safety in several applications (e.g., adaptive cruise control [6], multi-robot systems [7], carrier landing [8]). CBFs have been applied to quadrotors by some researchers as well in recent years. In [4], a position level CBF was designed for assisting human operators to teleoperate quadrotors safely. However, this study is based on the assumption that the Euler angles of a quadrotor are small and cannot be applied to quadrotors performing aggressive maneuvers as a result. Wang et. al studied the trajectory planning of a team of quadrotors based on differential flatness and CBFs. CBFs were used to modify nominal trajectories for quadrotors to avoid collisions [7]. To address the collision safety constraints suffered by a planar quadrotor, time-varying control Lyapunov functions were used to guarantee stability of the quadrotor and timevarying CBFs were developed to guarantee safety of the 1  quadrotor in [9]. The method was extended to guarantee the safety of a three-dimensional quadrotor in [10]. Khan et al. proposed cascaded CBFs for a cascaded control architecture of quadrotors to enforce safety, allowing independent safety regulation in the altitude domain and in the lateral domain of a quadrotor [11]. However, [9], [10], [11] focused on quadrotors with cascaded controllers and developed cascaded CBFs for quadrotors. The cascaded CBFs cannot be applied to quadrotors with non-cascaded controllers (e.g., an end-to-end learning-based controller [12]). Moreover, the effectiveness of the cascaded CBFs in the case that quadrotors are in abnormal state (e.g., tumbling) has not been verified.
To the best knowledge of the authors, a CBF that can ensure the safety of quadrotors controlled by non-cascaded controllers and can address the safety issue of quadrotors in abnormal state is not available yet. To address the above-mentioned two issues, this paper proposes a novel non-cascaded CBF for quadrotors. The main contributions of this paper are as follows.
• This paper develops a non-cascaded CBF for quadrotors controlled by either cascaded controllers or noncascaded controllers. The non-cascaded CBF can maintain a quadrotor within a safe region in Cartesian space, even if the quadrotor attains an abnormal state. • Based on a physical engine, this paper verifies the effectiveness of the non-cascaded CBF for quadrotors not only in the case of trajectory tracking but also in the case of aggressive roll maneuvers. The rest of this paper is organized as follows. The preliminaries of this paper are presented in Section II. Section III illustrates a non-cascaded CBF for quadrotors. In Section IV, the non-cascaded CBF is applied to a quadrotor performing trajectory tracking and a quadrotor performing aggressive roll maneuvers based on a physical engine. Section V summarizes this paper.

II. PRELIMINARY
This section demonstrates the dynamics of a quadrotor, the problem formulation of the safety of a quadrotor, and exponential control barrier functions.

A. Dynamics of a Quadrotor
In this section the dynamics of a quadrotor is demonstrated based on a body frame F B fixed to the quadrotor and an inertial frame F I , as shown in Fig. 1. The body frame is defined by axes x B , y B , and z B , and the inertial frame is defined by axes x I , y I , and z I . Euler angles with a Z-Y-X sequence are used to define the roll φ , pitch θ , and yaw ψ angles between the body frame and the inertial frame. The dynamics of a quadrotor can be expressed as [13]  represents the translational velocity of the quadrotor in the inertial frame. G is the acceleration of gravity. m is the mass of the quadrotor. z z z I is a unit vector in the positive direction of the z I axis of the inertial frame. f T denotes the magnitude of the total thrust of the quadrotor. z z z B is a unit vector in the positive direction of the z B axis of the body frame. R R R is the rotation matrix from the body frame F B to the inertial frame F I defined in [13]. ω ω ω B = [p, q, r] T represents the angular velocity of the quadrotor in the body frame. Ω Ω Ω can be expressed as J J J = diag{J xx , J yy , J zz } is the inertia matrix of the quadrotor. τ τ τ = [τ x , τ y , τ z ] T is the torque generated by the rotors of the quadrotor in the body frame. τ τ τ g denotes a gyroscopic torque. r r r = [r x , r y , r z ] T is the position of the quadrotor in the inertial frame.
The state of a quadrotor can be represented by The rotor velocities of the quadrotor can be derived based on the control input according to [14]  where L represents the distance between a rotor and the center of the quadrotor. k F and k M are positive constants determined by air density and the shape of propellers.ω i (i = 1, 2, 3, 4) denotes the rotational velocity of the ith rotor of the quadrotor. For a quadrotor, one also has [14] where ω ω ω I = R R Rω ω ω B is the angular velocity of the quadrotor in the inertial frame. In practice, the rotor dynamics are relatively fast for the pose control of a quadrotor, so one can assume that the rotor thrusts as well as the control input of a quadrotor u u u = [ f T , τ x , τ y , τ z ] T are instantaneously achieved [14]. Since quadrotors are usually equipped with digital controllers in practice, given a certain control input, the quadrotor will achieve the control input instantaneously and maintain the control input for a period of time. Thus, one can assume that the derivative of the magnitude of the total thrustḟ T is zero. Then, (4) can be simplified as B. Problem Formulation This paper addresses the safety of a quadrotor in the form of maintaining the quadrotor within a safe region in Cartesian space. A safe region is defined as S = {r r r ∈ R 3 |r r r min r r r r r r max } where represents element-wise inequality. r r r min and r r r max are the lower bound and the upper bound of r r r, respectively. For a quadrotor with the initial position r r r(t 0 ) ∈ S and a nominal control input in terms of the total thrust and the torque generated by the rotors, one needs to ensure that the position of the quadrotor satisfies r r r(t) ∈ S where t ≥ t 0 , by regulating the nominal control input.

C. Exponential Control Barrier Function
Exponential Control Barrier Function (ECBF) is introduced to address the high relative degree safety constraints of a system [15]. The ECBF has been used to design cascaded CBFs for quadrotors in [11]. Without loss of generality, one can assume a nonlinear affine systeṁ where f and g are locally Lipschitz. x ∈ D ⊂ R n is the state and u ∈ U ⊂ R m is the control input of the system. The safety of the system can be guaranteed by enforcing the invariance of a safe set [5]. In particular, one can consider a set C defined as the superlevel of a continuously differentiable function h(x) : The set C is referred to as a safe set. (7) is safe with respect to the set C if the set C is forward invariant. Definition 2. [5] For system (7), given a set C ∈ D ∈ R n defined as the superlevel set of a r b -times continuously differentiable function h(x) : D ∈ R n → R, then h(x) is an ECBF if there exits a row vector and the matrix A A A b is dependent on the choice of K K K α . One can define a family of functions v i : D → R and corresponding superlevel sets C i (i = 0, · · · , r b ) as follows [5] v 0 = h(x), where p i is an adjustable parameter and one has p i > 0 (i = 1, 2, · · · , r b ).

III. SAFE CONTROL OF QUADROTORS BASED ON NON-CASCADED CONTROL BARRIER FUNCTIONS
To ensure the safety of a quadrotor controlled by cascaded controllers or a non-cascaded controller, this section proposes a non-cascaded CBF for the quadrotor.

A. Non-cascaded Control Barrier Functions
This paper regards a quadrotor as a system with a relative degree of four. Thus, ECBF [15] is used to design noncascaded CBFs for the quadrotor in this section. CBFs are designed for every single r x , r y , or r z component of the position of the quadrotor, and then the CBFs are integrated to achieve a CBF that can maintain the quadrotor within a given safe region.
According to the above-mentioned idea, this paper designs two control barrier function candidates for the r x component of the position of a quadrotor where r xmin and r xmax are the lower bound and upper bound of a safe r x , respectively. A safe set of the r x component of the position of a quadrotor is For h x (r x ), a family of functions can be achieved according to [5]  where p x i is an adjustable parameter and one has p x i > 0 (i = 1, 2, 3, 4). According to (5) and (13), v 2 , v 3 , and v 4 depend on the control input of a quadrotor u u u. If the control input of a quadrotor u u u can enforce the forward-invariance of C 2 , C 3 , and C 4 , the forward-invariance of C 0 defined by h x is guaranteed according to Theorem 1. One can ensure that r x is kept a safe distance from r xmax then. Based on (13) and (15), to enforce the forward-invariance of C 2 , C 3 , and C 4 , one has Γ Γ Γ x X X X Q Q Q x r xmax (16) where Similar to (16), to enforce the forward-invariance of a safe set defined by h x (r x ), one should make According to (14), (16), and (18), one can enforce the forwardinvariance of the safe set C x , if The safety of the r x component of the position of a quadrotor is ensured then. One can design CBFs that are similar to (13) for the r y and r z components of the position of a quadrotor, according to the approach demonstrated above. By integrating the CBFs for the r x , r y , and r z components of the position of the quadrotor, one can obtain a non-cascaded CBF that can maintain the quadrotor within a safe region. The non-cascaded CBF for the quadrotor can be expressed as h h h = r r r max − r r r h h h = r r r − r r r min (20) A safe set can be formulated as To enforce the forward-invariance of the safe set C and ensure the safety of the quadrotor, one should make Q Q Qr r r min Γ Γ ΓΛ Λ Λ Q Q Qr r r max P P P i P P P j P P P k ∑ 1≤i< j≤4 P P P i P P P j Λ Λ Λ = [r r r T ,ṙ r r T ,r r r T , ... r r r T , ....
wherer r r, ... r r r , .... r r r can be adjusted by the control input of the quadrotor according to (5).

B. Safe Control of a Quadrotor
According to [5], the safe control of a quadrotor can be achieved based on a Quadratic Program (QP) that incorporates CBFs. For a nominal control input u u u 0 in this paper, a safe control input can be determined by Q Q Qr r r min Γ Γ ΓΛ Λ Λ(ξ ξ ξ , u u u) Q Q Qr r r max u u u min u u u u u u max where u u u min and u u u max are the lower bound and upper bound of the control input u u u, respectively. In this paper, non-cascaded CBFs are designed for quadrotors with a nominal control input consisting of the magnitude of the total thrust and the torque generated by rotors. However, it should be pointed out that the non-cascaded CBFs can be applied to quadrotors with a nominal control input consisting of rotor thrusts or rotor velocities (e.g., [12]) based on (3).

IV. SIMULATIONS
To evaluate the effectiveness of the developed non-cascaded CBF in ensuring the safety of quadrotors, the non-cascaded CBF is applied to a quadrotor performing trajectory tracking and a quadrotor performing aggressive roll maneuvers in simulations. The simulations are conducted in a Gazebo simulator [16], a physical engine that has been applied to several studies of quadrotors [17], [18]. An IF750A quadrotor is used in simulations, as shown in Fig. 2. The parameters of the IF750A quadrotor are listed in Table I. f T max and f T min are the maximum and the minimum feasible magnitude of the total thrust of the quadrotor, respectively. τ xmax , τ xmin , τ ymax , τ ymin , τ zmax , and τ zmin denote the feasible range of the torque generated by rotors. To ensure the safety of the quadrotor in simulations, the parameters of a non-cascaded CBF shown in (23) are set to p x 1 = p y 1 = 1.000, p x 2 = p y 2 = 4.000, p x 3 = p y 3 = 5.000, p x 4 = p y 4 = 5.000, p z 1 = 1.000, p z 2 = 5.000, p z 3 = 10.000, p z 4 = 10.000.

A. Safe Control of a Quadrotor Performing Trajectory Tracking
In [9], [11], the effectiveness of cascaded CBFs for quadrotors was validated based on ensuring the safety of a quadrotor performing trajectory tracking. To evaluate the effectiveness of the developed non-cascaded CBFs, this paper starts by ensuring the safety of a quadrotor performing trajectory tracking as well. A safe region is defined as S = {r r r ∈ R 3 | [−1.000, − 1.000, 2.000] T r r r [1.000, 1.000, 6.000] T } (unit : m) (25) A target trajectory that tends to guide the quadrotor to move out of the safe region is defined as Cascaded Proportional-Derivative (PD)-based controllers [19] are used to control the quadrotor to track the target trajectory. The initial state of the quadrotor is ξ ξ ξ = [0.000, 0.000, 3.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000] T (units: m, rad, m/s, and rad/s).
The position of the quadrotor performing trajectory tracking is presented in Figs. 3 and 4. The quadrotor can perform trajectory tracking as long as the quadrotor is within the safe region. The trajectory tracking maneuvers of the quadrotor are relaxed when the quadrotor approaches the upper bound of the safe region. To further study the performance of the non-cascaded CBF, the nominal control input and the safe control input of the quadrotor performing trajectory tracking are analyzed. Fig.5 shows that the CBF regulates the nominal control input from about the 45th seconds. This phenomenon is consistent with the position of the quadrotor shown in Fig. 4. From about the 45th seconds, the nominal control input tends to increase the magnitude of the total thrust of the quadrotor to track the target trajectory, but the CBF regulates the nominal control input to ensure the safety of the quadrotor. This simulation demonstrates that the non-cascaded CBF is effective in ensuring the safety of a quadrotor performing trajectory tracking.

B. Safe Control of a Quadrotor Performing Aggressive Roll Maneuvers
A quadrotor may attain an abnormal state in practice, intentionally or unintentionally. To further evaluate the effectiveness of the non-cascaded CBFs in the case that quadrotors are in abnormal state, this paper applies the non-cascaded CBFs to a quadrotor that tends to perform "Barrel Roll", an aggressive roll maneuver that can move the quadrotor into abnormal state [20]. A safe region is defined as S = {r r r ∈ R 3 | [−4.000, − 4.000, 2.000] T r r r [4.000, 4.000, 13.000] T } (unit : m) (27) Assume that a controller gives a nominal control input u u u 0 = [19.670 N, 0.000 N · m, − 5.130 N · m, 0.000 N · m] T to make the quadrotor to perform the "Barrel Roll" by rolling aggressively. The initial state of the quadrotor is ξ ξ ξ = [0.000, 0.000, 9.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000] T (units: m, rad, m/s, and rad/s).
The position of the quadrotor performing aggressive roll maneuvers is presented in Fig. 6. The non-cascaded CBF can maintain the quadrotor within the safe region indeed, even if the quadrotor tends to roll aggressively. The orientation and the behaviors of the quadrotor performing aggressive roll maneuvers are shown in Fig. 7 and Fig. 8, respectively. In Fig. 8, yellow arrows mark the orientation of the z B axis of the body frame F B . According to 7 and Fig. 8, one can see that the quadrotor has rolled several times and attains an abnormal state several times. The non-cascaded CBF can maintain the quadrotor within the safe region, even if the quadrotor is in abnormal state. To further study the performance of the non-cascaded CBF, this paper investigates the nominal control input and the safe control input of the quadrotor performing aggressive roll maneuvers, as shown in Fig.9. The non-cascaded CBF regulates the nominal control input of the quadrotor during the whole simulation to maintain the quadrotor within the safe region. Although the non-cascaded CBF enforces the quadrotor to relax aggressive roll maneuvers to uphold safety, the quadrotor has finished the "Barrel Roll" according to Fig 8. This suggests that the non-cascaded CBF regulates rather than takes over the control input. Thus, the non-cascaded CBF enables the quadrotor to perform maneuvers and tasks, to some extent, while enforcing the safety of the quadrotor.

V. CONCLUSIONS
This paper developed a non-cascaded CBF for quadrotors that may attain abnormal states controlled by cascaded con- trollers or non-cascaded controllers. Based on the dynamics of a quadrotor, ECBF was used to design a non-cascaded CBF for quadrotors with a nominal control consisting of the magnitude of the total thrust and the torque generated by rotors. The noncascaded CBF has been applied to a quadrotor performing trajectory tracking and a quadrotor performing aggressive roll maneuvers to ensure the safety of the quadrotors in simulations. The results of the simulations verify the effectiveness of the non-cascaded CBF, even if a quadrotor is in abnormal state.