Safety Embedded Control of Nonlinear Systems via Barrier States*
Abstract
In many safety-critical control systems, possibly opposing safety restrictions and control performance objectives arise. To confront such a conflict, this letter proposes a novel methodology that embeds safety into stability of control systems. The development enforces safety by means of barrier functions used in optimization through the construction of barrier states (BaS) which are embedded in the control system’s model. As a result, as long as the equilibrium point of interest of the closed loop system is asymptotically stable, the generated trajectories are guaranteed to be safe. Consequently, a conflict between control objectives and safety constraints is substantially avoided. To show the efficacy of the proposed technique, we employ barrier states with the simple pole placement method to design safe linear controls. Nonlinear optimal control is subsequently employed to fulfill safety, stability and performance objectives by solving the associated Hamilton-Jacobi-Bellman (HJB) which minimizes a cost functional that can involve the BaS. Following this further, we exploit optimal control with barrier states on an unstable, constrained second dimensional pendulum on a cart model that is desired to avoid low velocities regions where the system may exhibit some controllability loss and on two mobile robots to safely arrive to opposite targets with an obstacle on the way.
I Introduction
Control theory has been a central element in today’s fast growing, interdisciplinary technologies from simple decision making problems to terrifically complex autonomous systems. Undoubtedly, advancements in technologies are faced with unprecedented challenges. One vital challenge is safety. Nonetheless, conflicting safety restrictions and control objectives potentially appear in safety-critical control systems. The main goal of this letter is to develop a control design methodology that satisfies safety constraints and evades the possible conflict between safety constraints and control objectives. The objective is achieved by embedding the safety constraints in the system’s model through barrier states (BaS) which are provided to the control law used to attain performance objectives.
For a dynamical system, safety is classically verified by invariance of the set of permitted states. The set of permitted states is (forward) invariant if at some point in time it contains the system’s state then it contains the state for all (future) times [1]. To formally prove invariance and verify safety, barrier certificates were introduced in the control literature [2] (for a brief historical overview, see [3]). Extending the idea to control dynamical systems, a set is said to be controlled invariant, also called viable, if for any initial condition in the set, the associated trajectory is forced to be in the set for all future times using a proper control. Influenced by barrier certificates and control Lyapunov functions (CLFs), control barrier functions (CBFs) were introduced in [4], which were further developed in [5, 6, 7, 8]. CBFs can be looked at as state-dependent hard input constraints which are commonly used in quadratic programming (QP) fashion to produce a safe controller [6, 8, 8]. CBFs are becoming increasingly popular in multi-objective control due to their ability of rendering sets invariant and flexible unification with CLFs. Nonetheless, to avoid conflicts in the CLF-CBF QP, one of the conditions needs to be relaxed. For a complete review on CBFs, the reader may refer to [3].
In this letter, inspired by adopting barrier functions to establish inequality constraints forming CBFs, we utilize barrier functions to construct barrier states. Those barrier states (BaS) create barriers in the state space forcing the search of a stabilizing feedback control law to the set of safe controls. Specifically, the barrier states are appended to the model of the safety-critical dynamical system to generate a system that is safe if the equilibrium point of interest is asymptotically stable. Therefore, since safety and stability have been unified, designing a stabilizing controller for the new model means a stabilizing safe control for the original dynamical system. In other words, the safety property is embedded in the stability of the system as the feedback controller is a function of the system’s states and the barrier states, hence the name safety embedded control. The proposed method is general enough to be used with any valid barrier function. For standard barrier functions, such as Log or inverse, we show that it is possible to generate smooth or even analytic state equations for barrier states if desired. Unlike control barrier functions, no explicit knowledge of the relative degree of the system with respect to the output describing the safe region is required.
The letter is organized as follows. Section II presents the problem statement. In Section III, utilizing barrier functions, we develop barrier states used to embed safety in the stabilization problem. Subsequently, we implement the developed concept to design simple safe linear controls in Section IV. In Section V, we employ barrier states in the context of constrained optimal control to meet safety and performance objectives through minimizing an infinite horizon cost functional. In Section VI, we show the effectiveness of the proposed technique through safely stabilizing an unstable pendulum on a cart model where it is desired to avoid low velocity regions near the angle. Moreover, a multi-robot example is used where two simple mobile robots are to go to specific locations safely, i.e. without colliding while avoiding obstacles on the way. Lastly, conclusion remarks are driven in Section VII.
II Problem Statement
Consider the nonlinear control-affine dynamical system
(1) |
where , , and are continuously differentiable and , without loss of generality. We wish to formulate a continuous stabilizing feedback controller that renders the nonempty open subset of defined as controlled invariant, where is a continuously differentiable scalar valued function that represents the safe set. The set represents the domain of operation which will be further prescribed later in the letter. The set , referred to as the safe set, is said to be forward invariant with respect to the closed-loop system if implies , .
Definition 1.
The continuous feedback controller is said to be safe if is forward invariant with respect to the resulting closed-loop system . That is,
(2) |
We refer to this as the safety condition.
Enforcement of the safety constraint may be facilitated by means of a smooth scalar valued function known as a barrier function (BF) in the optimization literature. Popular barrier functions include the inverse barrier function (a.k.a. Carroll barrier) and the logarithmic barrier function . The main properties of those types of barrier functions are that they blow up at the boundaries of the complement of , i.e. , and . Another choice that has the advantage of being analytic with a known power series expansion is . The composite BF corresponding to that defines is defined to be . Note that if and only if . The following Proposition follows from Definition 1 and the choice of BFs:
III Barrier States for Safety Embedded Stabilization
As possibly conflicting safety constraints and control performance objectives need to be avoided in safety-critical control, current multi-objective frameworks, e.g. CBF-CLF safe stabilization framework, avoid possible conflicts by relaxing one of the constraints to ensure feasibility of the solution. This may result in an undesirable performance. To untangle such a problem, we propose a provable safe control technique that satisfies the safety constraints and the performance objectives simultaneously with no relaxation.
For a barrier function where defines the safe set , the idea is to augment the open loop system with a new state variable that is related to the recentered barrier function [9], to ensure that is an equilibrium state. If we simply set to , the resulting state equation would be
where and is the inverse of the BF. To safely stabilize the origin of (1), however, we need to ensure stabilizability of the origin of the augmented system. The main issue with augmenting as the state equation is that becomes a redundant state and the resulting augmented system may not be stabilizable in some cases. Fortunately, this issue can be resolved by perturbing the barrier state equation through an auxiliary function that ensures stabilizability of the origin of the augmented system without affecting the safety guarantees. More specifically, we modify the state equation for according to
(3) |
where , , and is an analytic function of two variables satisfying
It can be seen that for all three BFs mentioned earlier, the function is analytic with no singularities. Moreover, it is worth noting that both and are formulated independently of the system’s model based on the barrier function and . For instance, if , then . Furthermore, letting satisfies the first condition along and since and the second condition . Table I provides the explicit expressions for and possible for most commonly used barrier functions. It should be noted that the positive scalar is a design parameter that adjusts the rate at which returns to if it deviates from it at any instant of time. As a consequence, has some influence on the design of the safe feedback control gains as we will demonstrate in the simulation examples.
=B() | ||
---|---|---|
The following proposition shows that if is defined properly, then and , , implying that boundedness of guarantees satisfaction of the safety constraint.
Proposition 2.
Proof.
We prove the Proposition by establishing that
(4) |
Subtracting from both sides of (3), we have where and . The preceding differential equation has an equilibrium point at since and . Thus , or equivalently , , provided that as assumed by the hypothesis. ∎
If desired, multiple constraints can be combined to form one BF, as done in the optimization literature, to create a single BaS. Creating a single BaS is favorable in many applications and helps avoiding adding many nonlinear state equations to the safety embedded model which may increase the complexity of the controller. A single BaS that represents different constraints, however, may be highly nonlinear and may be more difficult to use to design a safety embedded control. Additionally, some flexibility on choosing design parameters for each constraint, such as penalization of the barrier states in the case of optimal control, will be lost since we will have only one barrier state. It is important to mention that in some applications, one could represent multiple constraints with one function defining the safety set and then use a single BaS.
For constraints, let . Then,
and therefore the BaS can be found to be
(5) |
In the simulation examples, we use a single BaS to represent multiple constraints for one problem and we use multiple ones in the other to validate the proposed technique.
Now, we are in a position to create the safety embedded model. By defining , if more than one BaS is used, and augmenting it to the system (1), we get
(6) |
where and are defined according to (3) or (5). By the definition of and the restrictions imposed on , it follows that both and are analytic if , , and are analytic, and the subsystem is stabilizable at the origin. Hence, the combined system, which can be more compactly described as
(7) |
where with and , preserves the continuous differentiability and stabilizability of the original control system (1). Therefore, the safety constraint is embedded in the closed-loop system’s dynamics and stabilizing the safety embedded system (LABEL:new_system,_safety_augmented) implies enforcing safety for the safety-critical system (1), i.e. forward invariance of the safe set with respect to (1).
Theorem 3.
Suppose there exists a continuous feedback controller such that the origin of the safety embedded closed-loop system, , is asymptotically stable. Then, there exists an open neighborhood of the origin such that is safe with respect to the safety region .
Proof.
Let us assume that the origin of the embedded closed-loop system is asymptotically stable with a domain of attraction . Then, there exist open neighborhoods and of the origin with bounded such that . Letting , by the continuity of on , the inverse image of by is an open neighborhood of the origin. Thus is also an open neighborhood of the origin. For any initial condition , it can be seen that and . Thus the trajectories , , are bounded and converge to zero implying that is bounded as well. By Propositions 1 and 2, is also bounded guaranteeing the safety of . ∎
The remainder of the letter is devoted to synthesizing safe feedback controllers that simultaneously stabilize (1) and satisfy the required safety constraint (2) by stabilizing the dynamical system (LABEL:new_system,_safety_augmented) which unifies the two requirements. In the next sections, we apply the proposed methodology to constrained linear control systems to generate safe linear controls using pole placement and then to constrained optimal control problems to synthesize optimal safe controllers.
IV Safety Embedded Linear Control
Consider the linear time-invariant system subject to some safety constraint defined by a smooth function . Defining the associated barrier state, augmenting it and linearizing the safety embedded model (LABEL:new_system,_safety_augmented) around the origin yields the linearized safety embedded system where
It should be noted that this system may not be controllable. This should not pose any problem, however, as guarantees stabilizability which should be enough for us to design a safe stabilizing controller. Although we may not be able to change the location of the barrier state’s pole, it is sufficient to use the states and the barrier state to construct a safe stabilizing control. Next, we show an example where we form a barrier state to design a safe stabilizing control while the linearized system is stabilizable but not controllable.
IV-A Constrained Linear System Numerical Example
Consider the open loop unstable linear system given by
Assume that it is desired to stay in the safe set and that the closed-loop system’s poles are and . Using the inverse barrier function, the linearized safety embedded system that we will use to design the linear control will be
where . We use this augmented linear system to design a safe linear controller using the pole placement method to place the poles of the closed-loop controllable subsystem at and , achieving the desired performance. When , the safe stabilizing linear control is found to be . Note that although the controller is linear with respect to the safety embedded system, it is a nonlinear function of the original state provided . Fig. 1 shows that indeed the designed linear controller is able to safely stabilize the system.


It is worth noting that this is a linear control design for an inherently nonlinear control problem and thus limitations and difficulties of linear controls to stabilize nonlinear systems apply. One could use any nonlinear control technique to design a safely stabilizing control. In the next section, we leverage the infinite horizon optimal control in the process of designing an efficacious optimal safe control as optimal control is a well suited paradigm for such a problem and it facilitates the design of nonlinear controllers.
V Safety Embedded Optimal Control
Consider the infinite horizon optimal control problem of minimizing some cost functional subject to the dynamics (1) and the safety condition (2). This has been a sought-after problem recently [10, 11, 12] where CBFs are used to solve constrained optimal control problems. In these efforts, it can be seen how difficult the problem is and thus various complex techniques have been developed to solve the problem. Using the proposed BaS, this problem can be solved directly using well-known unconstrained optimal control methods. A systematic approach toward solving this problem is to seek an optimal feedback controller that minimizes
(8) |
where is analytic and its Hessian is positive definite and , subject to (LABEL:new_system,_safety_augmented). By Theorem 3, if this optimal control problem is successfully solved, then both safety and stability requirements are met. For such an infinite horizon optimal control problem, a necessary and sufficient condition is that the well-known Hamilton-Jacobi-Belmman (HJB) equation is satisfied,
(9) |
with a boundary condition where is the optimal solution, a.k.a. the value function, and .
Theorem 4.
Consider the optimal control problem (LABEL:new_system,_safety_augmented)-(8) with analytic and and suppose that the pair is stabilizable, is analytic with positive definite Hessian and . Then, there exists a unique analytic value function satisfying the HJB equation (9), which yields an optimal safe feedback control
(10) |
Moreover, is a Lyapunov function and renders the origin of the closed loop system asymptotically stable. Therefore, the barrier state is bounded guaranteeing the generation of safe trajectories.
Proof.
As remarked earlier in the letter, the embedded system (LABEL:new_system,_safety_augmented) preserves the continuous differentiability and stabilizability properties of (1) and thus satisfies the analyticity and stabilizability assumptions in [13, 14, 15] hence guaranteeing the existence and uniqueness of the value function and the corresponding optimal controller described in (10). Furthermore, the origin of the resulting closed loop system is asymptotically stable by Lyapunov stability theory [14, 16] and by Theorem 3, is safe which completes the proof. ∎
Various techniques have been proposed in the literature to approximate the solution to the HJB equation or the associated optimal control [17, 15, 18, 19, 20, 13, 14]. In the next section, we utilize these efforts to produce a power series solution of the value function and its gradient to produce the optimal safe control (10) for the optimal control problem (8). Specifically, we mainly utilize the recursive analytic solution proposed in [14] and the nonlinear quadratic regulator (NLQR) in [13].
VI Numerical Implementation and Examples
To demonstrate the efficacy of the presented technique to produce a safe and stabilizing control, we use a single BaS to enforce safety for a model of an inverted pendulum on a cart, and multiple barrier states for a multi-mobile robot navigation task where two point-robots are asked to go to intersecting targets while avoiding collision and avoiding some unsafe region.
VI-A Second Order Inverted Pendulum on a Cart
This system is an unstable version with a state dependent input matrix of the mechanical system with unity parameters used in [7] to show the applicability of the Control Lyapunov–Barrier Function (CLBF) approach. The system is given by
It is desired to avoid low velocities when the angle is half way through to stabilize the pendulum at the upright position to steer clear of the angle where the system loses controllability due to the term in the input matrix . That is, there are two symmetrical decoupled unsafe sets and therefore the safe set can be represented by two functions and such that . We pick the Carroll BF with and use equation (5) with to generate a single BaS. To generate the optimal safe controller, it is chosen to minimize the functional (8), with . It is worth mentioning that this is an optimal control problem and thus different performances can be achieved using different cost functionals.
Fig. 2 shows numerical simulations for the closed-loop system under a order nonlinear quadratic regulator (NLQR) [13], i.e. the approximated value function for the optimal control problem is of order four. Clearly, the proposed technique is powerful enough to generate a safe and asymptotically stable closed loop system safety is embedded in the stability of the overall system. It can be seen that there is a small cusp when the trajectories cross the angle which is a result of the lose of controllability when . If low velocities were allowed at that specific region, that is if no barrier states are used, the closed loop system will go unstable.

VI-B Multi Simple Mobile Robot Collision Avoidance
In this example, two simple mobile robots are asked to navigate their way toward prespecified targets. The robots are to avoid colliding as well as avoid an obstacle on their way. The robots dynamics are
To avoid collision, a BaS is featured through a barrier function that prevents the robots from getting too close to each other. We pick the maximum distance between the two robots to be . Therefore, the associated safe set is . Furthermore, we add an obstacle which is represented by a circle at with a radius of . This calls for a BaS for each agent. Hence, the overall safe set for each agent is given by . For this example, we select the Log BF, for , to construct three barrier states, where the first represents the distance constraint between the two robots and the second and third barrier states represent the barriers needed to avoid the obstacle for agent and agent respectively. Using Table I, the barrier states are given by
with for where , , and . The cost functional (8) is selected such that and . A order NLQR is used in this example. As shown in Fig. 3, using the proposed technique, we are effectively able to send the two robots safely to the targeted positions while avoiding the obstacle as well as colliding with each other. The robots get very close to each other at sometime but never get too close, i.e. the distance between them is never less than or equal to .


VII Conclusions and Future Works
A novel construction of safety embedded controls through the development of barrier states was presented. Through a proper conversion of barrier functions, barrier states were augmented to generate a nominal model which is safe if is asymptotically stable. Using barrier states, the constrained control problem was transformed to an unconstrained control problem, which makes the safety problem easier to be considered with various control techniques such as optimal control. Moreover, the BaS method is agnostic to the relative degree of the function describing the safe set with respect to the system unlike existing CBF based methods. Furthermore, there is no need to relax the stability requirement to guarantee safety as the two conditions are coupled and achieved simultaneously. The disadvantages of this approach include increasing the dimension of the model and adding nonlinearity to the model. The safety embedded model was used in constrained linear control and in the context of optimal control to generate safe stabilizing controllers. Simple linear controls and nonlinear quadratic controls were used to show the efficacy of the proposed method in various simulation examples.
Future work will include generalizations to nonlinear stochastic systems and applications to infinite and finite horizon stochastic optimal control as well as sampling-based model predictive control formulations. Another line of research includes generalizations of the proposed optimal control framework to min-max and optimal control problem formulations. Finally, incorporating uncertainty quantification methods into the augmented state space representation in (LABEL:new_system,_safety_augmented) is an active research.
References
- [1] Franco Blanchini “Set invariance in control” In Automatica 35.11 Elsevier, 1999, pp. 1747–1767
- [2] Stephen Prajna and Ali Jadbabaie “Safety verification of hybrid systems using barrier certificates” In International Workshop on Hybrid Systems: Computation and Control, 2004, pp. 477–492 Springer
- [3] Aaron D Ames et al. “Control barrier functions: Theory and applications” In 2019 18th European Control Conference (ECC), 2019, pp. 3420–3431 IEEE
- [4] Peter Wieland and Frank Allgöwer “Constructive safety using control barrier functions” In IFAC Proceedings Volumes 40.12 Elsevier, 2007, pp. 462–467
- [5] Muhammad Zakiyullah Romdlony and Bayu Jayawardhana “Uniting control Lyapunov and control barrier functions” In 53rd IEEE Conference on Decision and Control, 2014, pp. 2293–2298 IEEE
- [6] Aaron D Ames, Jessy W Grizzle and Paulo Tabuada “Control barrier function based quadratic programs with application to adaptive cruise control” In 53rd IEEE Conference on Decision and Control, 2014, pp. 6271–6278 IEEE
- [7] Muhammad Zakiyullah Romdlony and Bayu Jayawardhana “Stabilization with guaranteed safety using control Lyapunov–barrier function” In Automatica 66 Elsevier, 2016, pp. 39–47
- [8] Aaron D Ames, Xiangru Xu, Jessy W Grizzle and Paulo Tabuada “Control barrier function based quadratic programs for safety critical systems” In IEEE Transactions on Automatic Control 62.8 IEEE, 2016, pp. 3861–3876
- [9] Adrian G Wills and William P Heath “Barrier function based model predictive control” In Automatica 40.8 Elsevier, 2004, pp. 1415–1422
- [10] Yuxiao Chen, Mohamadreza Ahmadi and Aaron D Ames “Optimal safe controller synthesis: A density function approach” In 2020 American Control Conference (ACC), 2020, pp. 5407–5412 IEEE
- [11] Max H Cohen and Calin Belta “Approximate optimal control for safety-critical systems with control barrier functions” In 2020 59th IEEE Conference on Decision and Control (CDC), 2020, pp. 2062–2067 IEEE
- [12] Hassan Almubarak, Evangelos A Theodorou and Nader Sadegh “HJB Based Optimal Safe Control using Control Barrier Functions” In arXiv preprint arXiv:2106.15560, 2021
- [13] Hassan Almubarak, Nader Sadegh and David G. Taylor “Infinite horizon nonlinear quadratic cost regulator” In American Control Conference, 2019. Proceedings of the 2019, 2019 IEEE
- [14] Nader Sadegh and Hassan Almubarak “Recursive Analytic Solution of Nonlinear Optimal Regulators” In arXiv preprint arXiv:2006.15685, 2020
- [15] Dahlard L Lukes “Optimal regulation of nonlinear dynamical systems” In SIAM Journal on Control 7.1 SIAM, 1969, pp. 75–100
- [16] Hassan K Khalil “Nonlinear systems” Prentice Hall, 2002
- [17] EG Al’Brekht “On the optimal stabilization of nonlinear systems” In Journal of Applied Mathematics and Mechanics 25.5 Elsevier, 1961, pp. 1254–1266
- [18] Randal W Beard, George N Saridis and John T Wen “Approximate solutions to the time-invariant Hamilton–Jacobi–Bellman equation” In Journal of Optimization theory and Applications 96.3 Springer, 1998, pp. 589–626
- [19] Tayfun Cimen “State-dependent Riccati equation (SDRE) control: A survey” In IFAC Proceedings Volumes 41.2 Elsevier, 2008, pp. 3761–3775
- [20] Noboru Sakamoto and Arjan J Schaft “Analytical approximation methods for the stabilizing solution of the Hamilton–Jacobi equation” In IEEE Transactions on Automatic Control 53.10 IEEE, 2008, pp. 2335–2350