Real-time Safety Index Adaptation for Parameter-varying Systems
via Determinant Gradient Ascend
Abstract
Safety Index Synthesis (SIS) is critical for deriving safe control laws. Recent works propose to synthesize a safety index (SI) via nonlinear programming and derive a safe control law such that the system 1) achieves forward invariant (FI) with some safe set and 2) guarantees finite time convergence (FTC) to that safe set. However, real-world system dynamics can vary during run-time, making the control law infeasible and invalidating the initial SI. Since the full SIS nonlinear programming is computationally expensive, it is infeasible to re-synthesize the SI each time the dynamics are perturbed. To address that, this paper proposes an efficient approach to adapting the SI to varying system dynamics and maintaining the feasibility of the safe control law. The proposed method leverages determinant gradient ascend and derives a closed-form update to safety index parameters, enabling real-time adaptation performance. A numerical study validates the effectiveness of our approach.
I Introduction
Autonomous systems are entering many application domains, e.g., autonomous vehicles [1], human-robot collaboration [2, 3], etc. As autonomous systems are deployed to more dynamic environments, safety becomes increasingly critical. It is important to ensure that the system would not harm the agents sharing the environment (i.e., humans and the workspace).
Safe control has been widely studied to guarantee the safety of autonomous systems. In particular, energy functions [4] are widely used in the safe control field to quantify system safety and derive control laws to ensure safety, such as the safe set algorithm (SSA) [5] and control barrier functions (CBF) [6]. To achieve provable safety, the safe control law needs to satisfy two critical properties: 1) forward-invariance (FI), meaning that the system should stay in a safe region once entering it, and (b) finite-time convergence (FTC), meaning that the system should land in the safe region in finite time even starting in an unsafe state. To achieve such a provably safe control law, a safety index (SI) needs to be carefully synthesized so that the constraints yield from the SI is always feasible. Namely, in every state of interest, there must exist a control in the control space (either bounded or unbounded), that satisfies the safety constraints. Therefore, Safety Index Synthesis (SIS) is critical [7, 8].

SIS has been widely studied. Previous works [9, 10] address SIS for dynamic systems with unbounded control. [7, 11, 8] address SIS for systems with known bounded control. Recent work [12] further addresses the SIS problem for dynamic systems with varying (i.e., state-dependant) control bounds, which is more practical in reality. Although existing approaches are promising, most of them consider invariant dynamic systems. In practice, the dynamics of real-world systems are usually varying. For example, when a drone is used for package delivery, its dynamics change every time a package is added or removed (see Figure 1); when a robot arm is used for pick-and-place, its dynamics can change due to the object being manipulated. Under perturbed dynamics, the safe control law derived from the previous safety index might no longer be feasible, and can no longer guarantee safety. A naive fix is to re-synthesize the SI whenever the dynamics change. However, a full SIS generally requires non-trivial efforts and is infeasible for real-time adaptation. For instance, it can take more than 10 minutes to synthesize a single SI for a simplistic unicycle model with state-dependant control bounds [12].
This paper studies efficient safety index adaptation (SIA) for parameter-varying systems. Our intuition is that when the system dynamics change, it should be sufficient to fine-tune the safety index instead of generating a new one from scratch. To achieve that, we first observe that the full SIS problem is in fact solved via a semidefinite program with a positive-semidefiniteness (PSD) constraint that depends on the system dynamics. That constraint is normally violated when the dynamics change, invalidating the previous safety index. A reasonable solution is to fine-tune the SI parameters such that the PSD constraint is satisfied again. Leveraging Sylvester’s criterion [13], we are able to derive closed-form updates to the SI parameters that are computationally efficient enough for real-time adaptation.
In short, our major contribution is introducing determinant gradient ascent (DGA), a closed-form safety index adaptation algorithm that guarantees user-defined safety for parameter-varying dynamic systems. For the rest of the paper, we review the literature in Section II. In Section III, we introduce the goal of safe control and the full SIS problem before formulating the problem of safety index adaptation. In Section IV, we derive our efficient SIA approach which is then validated via a numerical study in Section V. We finally provide future directions and conclude with Section VI.
II Related Work
Previous works [9, 10] address SIS for known dynamics. SIS is similar to CBF synthesis for enforcing constraints [6], but different in that the desired safety index refers to a specific class of energy functions usually for collision avoidance with the safe set algorithm (SSA) [5, 14].
Real-world system dynamics are usually imperfectly known (i.e., uncertainty exists). To address those, [15] introduces adaptive CBF (aCBF) to ensure the safety of dynamic systems with estimated parametric model uncertainty. [16] introduces robust aCBF (RaCBF), which results in a less conservative safe control behavior than aCBF. [17] applies adaptive control to CBF for safe control of systems with parametric uncertainty by adjusting the adaptation gain online. [18, 19, 20] assume bounded dynamics noise and use learning-based approaches to synthesize the CBF of the mismatched system dynamics. [21] focuses on high relative degree safety constraints for systems with dynamics uncertainty. It leverages concurrent learning to estimate the system uncertainty parameters online and synthesizes CBF. [22] addresses high-order CBF for time-varying system dynamics and state constraints. However, these works do not consider control bounds, which are important in real-world systems and could violate safety guarantees.
[7, 8, 11] address SIS for known systems with invariant bounded control. [23] introduces time-varying penalty functions to construct adaptive CBF when addressing systems with noisy dynamics and time-varying control bounds. Recent work [12] addresses the SIS problem for dynamic systems with varying (i.e., state-dependant) control bounds. Despite the rapid advancement in the field, existing works do not consider systems with both varying dynamics and varying control bounds, which will be addressed in this paper.
III Preliminaries and Problem Formulation
III-A Dynamic System
We follow [12] and consider a dynamic system with state-dependent control limits. Let be the system state and be the control input. The state space is bounded by a set of inequalities . The control space is bounded element-wise, i.e., . The dynamics is given by
(1) |
where and are both locally Lipschitz continuous.
III-B Preliminary: Safe Control
Safety Specification: For safety, we require the state to stay within a closed subset (i.e., safe set) of the state space . is assumed to be the zero sublevel set of some piecewise smooth function , i.e., . Both and should be designed by users. For instance, can be if we were to keep the distance to some obstacle above .
Safe Control Objectives: Following [12], we focus on safe control with two objectives: (a) forward invariance (FI), meaning if the state is already within the safe set, it should never leave that set and (b) finite-time convergence (FTC), meaning if the state is outside the safe set, it should land in the safe set in finite time.
Safe Control Backbone: When the control does not appear in (e.g., does not depend on the acceleration input for a second-order system), we cannot derive constraints on to ensure safety. To solve that issue, the safe set algorithm (SSA) [5] provides a systematic approach to design an alternative safety quantification to handle general relative degrees () between and the control. SSA introduces a continuous, piece-wise smooth energy function (a.k.a. the safety index). The general form of an () order safety index is given as where is the differentiation operator. is alternatively expanded to
(2) |
where is the time derivative of . The safe control law of SSA can be written as the following optimization:
(3) |
where the objective is arbitrary. By [5, 12], if (a) the roots of the characteristic equation are all negative real, (b) has relative degree one to the control input, and (c) the problem (3) is always feasible, both FI and FTC are guaranteed. Note that (3) only considers constraint satisfaction which is compatible with arbitrary control objectives. For instance, for reference tracking, we can set to find that is minimally invasive to the nominal control , presumably generated by a given tracking controller with asymptotical stability.
III-C Preliminary: Safe Index Synthesis
To achieve safety guarantees by implementing (3), we need to construct to make the optimization feasible. Such an objective is referred to as Safety Index Synthesis (SIS), mathematically described as 1.
Problem 1 (Safety Index Synthesis).
Find safety index as with parameter , such that
(4) |
is the order safety index parameterized by and is used interchangeably with hereafter for clarity. Note that 1 depends on the dynamics (1) (i.e., and ) since in (4). 1 is also difficult for having infinitely many constraints since (4) needs to hold for any state . To tackle that challenge, we follow [8, 12] and leverage Positivstellensatz [24] to transform 1 into a sum-of-square programming (SOSP) which is further converted to nonlinear programming (NP). In specific, a refute set is first established for (4), then proved empty by solving an SOSP. We refer readers to [12] for details on the construction of the refute set. The SOSP finds such that
(5) | ||||
where , are functions of and also depend on and . The SOS condition is enforced by finding the positive semi-definite (PSD) decomposition where . Assuming has degree , contains all monomials of with order no more than . denotes the auxiliary decision variable. The final NP is given by:
Problem 2 (Nonlinear Programming).
Find and where for and for , such that .
Remark 2.1.
The positive-semidefiniteness of the parametric coefficient matrix guarantees the positiveness of polynomial . Since is derived from and , it depends on the dynamics (1), i.e., , , and the control limits .
III-D Formulation of Safety Index Adaptation
As motivated in Section I, practical dynamic systems can contain varying parameters only known during runtime. We denote varying parameters as and extend (1) as
(6) |
Assume that prior to deployment, the initial value is known, and a feasible safety index has been solved via 1. As explained in Remark 2.1, depends on the system dynamics. With the extended dynamics (6), also depends on . As a result, when is updated during runtime, the previously solved might no longer satisfy the feasibility condition (4) and render the system unsafe. Hence, it is imperative that is updated accordingly, formulated as:
Problem 3 (Safety Index Adaptation (SIA)).
Remark 3.1.
A naive solution to 3 is to directly re-run the full synthesis given by 2. However, the solving time of the NP is significant even for simplistic systems, e.g., over minutes for a second-order unicycle model [12]. For safety-critical tasks, the safety guarantees of the safe control law should be recovered as soon as possible.
IV SIA via Determinant Gradient Ascend
Although re-running the full synthesis (2) is infeasible, we can leverage the NP formulation to design an adaptation strategy. Observe that solving 1 is ultimately achieved by making the parametric coefficient matrix , where the dependency on follows (6). Then, 3 naturally translates to:
(7) |
given , where the objective is a design parameter to guide the search for and . If does not change significantly from , i.e., is bounded (to be formalized later), we are essentially searching for a new point near the neighborhood of to maintain the positive-semidefiniteness of .
Note that the positive-semidefiniteness of can be tested by computing determinants using Sylvester’s criterion [13], which says that a Hermitian matrix is positive-semidefinite if and only if all the principal minors are nonnegative. Namely, we can re-write the constraint in (7) as
(8) |
where is the size of . denotes the submatrix of corresponding to the rows with indices and columns with indices . Since the principal minors are essentially explicit functions of and , (8) can be readily satisfied via gradient ascends on those parameters as where the gradient is given by
(9) |
refers to the current lowest principal minor with indices and the step size. Upon change of , is initialized to the previous feasible values , and updated according to (9) until all principal minors are nonnegative. We refer to such an approach as the determinant gradient ascend (DGA). After is fully updated for , (3) would be feasible and guarantee FI and FTC with respect to . Future work remains to study the system behaviors during DGA adaptation, when (3) might be infeasible.
Remark.
Since depends on and which are fixed functions of and , the form of gradient update (9) is also fixed. Hence, with a pre-computed symbolic expression of the update, one only has to evaluate (9) on different values during deployment, which is fast enough to support real-time adaptation. In summary, the determinant gradient ascend (DGA) method enables close-form solutions to safety index adaptation using previous indices for warm start.
V Numerical Study
To validate our SIA approach, we provide a numerical study on a parameter-varying system based on a 2-DOF (degree of freedom) planar robot arm. The robot arm has a second-order dynamics model with joint acceleration as the input. We first derive the baseline NP problem for SIS following Section III-C and then derive the update rule for SIA in the form of (9). The feasibility of the adaptive safety index is validated by sample based evaluations.
V-A Parameter-varying 2-DOF Robot Arm

We consider a 2-DOF robot arm with state , where are the joint positions as shown in Figure 2. are joint velocities. The two links have length and respectively. The control includes bounded joint acceleration input . The dynamics of the 2-DOF robot is given by where
(10) |
In real-world scenarios, system dynamics might change due to external factors. For instance, the total mass of a drone changes with different payloads, which in turn changes its dynamics; the torque limit of an arm motor might change due to insufficient power supply. In those cases, safety index adaptation is necessary to guarantee safety. Hence, to verify our SIA approach, we extend (10) to an affine parameter-varying system
(11) |
where , and . We assume and . The parameters are the system parameters, which can change during runtime and can be directly observed. The robot is allowed to move within the free space and should not collide with the obstacle which is a wall placed from the robot base.
V-B Safety Index Adaptation Rule
We first derive the full SIS solution which is required to derive DGA update rules. With , SIS produces a safety index such that the control law (3) always keeps the end-effector at most away horizontally from the base, not colliding with the wall. The SI parameter contains a single parameter . The immediate next step is to write out the feasibility condition (4) to be met by . We first handle the main condition . Plugging in , we have
Taking time derivative, we have
Note that , hence the minimum of is reached at if and otherwise. Since , the positiveness of depends on which interval it falls into, namely whether or . With indicators , those conditions can be written as
(12) |
Then, the main feasibility condition becomes
(13) |
where if and if for . Next, we add conditions to consider the state limits, i.e., , and :
(14) | ||||
(15) | ||||
(16) | ||||
(17) |
The last condition in (4) is , which is omitted here to enable decreasing safety index at all levels (i.e., ), instead of only the unsafe regions (i.e., ). Now, (4) translates to: for any state satisfying (12) to (17), (13) holds. To achieve that, we construct a refute set by collecting (13) to (17), with (13) negated, and prove that the refute set is empty222See [12] for the theoretical results of such an approach.. With , , and for , the refute set is given by:
(18) |
The refute set is represented by four versions of (18) with different sign values of . Following (5), for the assignment () of , we have
(19) |
and decompose as where , , and . Let denote the element of at row column , we have
(20) |
With that in hand, the gradient updates (9) can be obtained by taking derivatives of the principal minors of with respect to . Specifically, given new parameter to adapt to, we compute the gradients as:
(21) | ||||
With learning rate and , we apply the update rule
(22) |
until all principal minors of all ’s are non-negative.



V-C Experiment and Results
We initialize the robot arm with nominal parameters and run the full safety index synthesis (see 2) to acquire an initial safety index . The inputs are limited to . To validate our SIA approach, we simulate multiple disturbances to the system parameters . For each perturbed system with parameters , we invoke the SIA update rules (22) to acquire a new . Figure 3 shows an example of such adaptation where the parameters is perturbed after the arm end-effector reaches its goal. Without adaptation, the arm runs into a state where the safe control law (3) is infeasible and fails to ensure safety. With adaptation, the arm quickly updates the SI to and manages to find safe actions.
For quantitative evaluation, we apply each adapted by running the safe control law (3) on uniformly sampled states under the perturbed system and compare to the nominal safety index . If (3) is feasible, we mark the safety index as feasible at the corresponding state. Due to the uncertainty of nonlinear programming 2, we repeat the whole process for times and plot the feasibility rate of the safety index before and after adaptation, the adapted SI parameter and adaptation time. We also run the full SIS on each perturbed system and compare the computation time. See Figure 4 for the plots. We observe that the more deviates from (the smaller the ), the control law under the nominal safety index is less likely to be feasible while the adapted safety index achieves feasibility rate. The adaptation time is also consistently lower than that of solving full SIS, validating that our SIA approach is computationally efficient for real-time deployment. Although only are perturbed in our simulations, our approach directly accommodates other variations, for instance changing or more generally, changing , and in (11).
V-D Discussions
Tolerance against variations. It can be observed from Figure 4 that the adapted value of SI parameter shows a negative correlation with respect to the system parameters . In our experiments, we discovered that when are increased, the original is normally still feasible, and no adaptation is required. Intuitively, the larger is, the more sensitive the system is to inputs; the larger is, the more sensitive the control law is to unsafe regions. When increases, the system becomes more reactive, keeping the original feasible. When decreases, a more aggressive safe control law is needed to react to unsafe regions in advance, necessitating a larger . Note that the above only applies to our specific system, while the tolerance analysis for general systems is left for future work.
Scalability against system dimensions. The scalability of both full SIS and SI adaptation largely depends on the size of the refute set (18) as well as the coefficient matrix in (20). For an -DOF 2D robot arm, the size of the refute set is given by ; the size of is ; and there are such to prove PSD for full SIS. Despite the exponential scalability of SIS, our DGA approach allows one to pre-generate all gradient updates from in symbolic forms and only evaluates those expressions during online adaptation. That renders our approach highly efficient even for high-dimensional systems.
Gradient-based Optimization. When implementing our update rule (22), we normalize the gradients and , and set the learning rates . Empirically, one should always normalize the gradients and start experimenting with small learning rates to help DGA converge. Moreover, our DGA is presented in first-order gradient updates in (22). Second-order approaches such as Newton’s method can also be applied for better convergence rates when the change of is minimal and a feasible can be found within a near neighbor of the current .
VI Conclusion and Future Work
In this paper, we presented a safety index adaptation (SIA) approach to update safe control laws in response to varying system dynamics in real time. Our approach replaces full safety index synthesis, which is extremely slow, with fast closed-form updates to controller parameters. Through numerical studies, we verified that our approach allows the agent to quickly adapt to new system dynamics and achieve zero safety violations.
In practice, after the system dynamics change, the system is inevitably guarded by an outdated safety index during the adaptation computation time. Hence, as future work, it is worth studying the system’s behavior during such a transition period to draw critical insights, for instance, whether the adaptation can finish before the agent crashes into unsafe regions. If not, the agent should stop navigation and wait for the new safety index. Another promising direction is to handle continuously changing dynamics as opposed to step parameter changes, which will bring new questions on the tolerance of synthesized safety indices and the criterion of triggering SIA. Finally, we aim to provide theoretical results such as the proof of convergence to the new safety index as well as the convergence rate.
References
- [1] E. Yurtsever, J. Lambert, A. Carballo, and K. Takeda, “A survey of autonomous driving: Common practices and emerging technologies,” IEEE Access, vol. 8, pp. 58 443–58 469, 2020.
- [2] H. Christensen, N. Amato, H. Yanco, M. Mataric, H. Choset, A. Drobnis, K. Goldberg, J. Grizzle, G. Hager, J. Hollerbach, et al., “A roadmap for us robotics–from internet to robotics 2020 edition,” Foundations and Trends in Robotics, vol. 8, no. 4, pp. 307–424, 2021.
- [3] R. Liu, R. Chen, and C. Liu, “Safe interactive industrial robots using jerk-based safe set algorithm,” in International Symposium on Flexible Automation, 2022.
- [4] T. Wei and C. Liu, “Safe control algorithms using energy functions: A unified framework, benchmark, and new directions,” in Conference on Decision and Control, 2019.
- [5] C. Liu and M. Tomizuka, “Control in a safe set: Addressing safety in human-robot interactions,” in Dynamic Systems and Control Conference, 2014.
- [6] A. D. Ames, J. W. Grizzle, and P. Tabuada, “Control barrier function based quadratic programs with application to adaptive cruise control,” in Conference on Decision and Control, 2014.
- [7] W. Zhao, T. He, and C. Liu, “Model-free safe control for zero-violation reinforcement learning,” in Conference on Robot Learning, 2021.
- [8] W. Zhao, T. He, T. Wei, S. Liu, and C. Liu, “Safety index synthesis via sum-of-squares programming,” in American Control Conference, 2023.
- [9] H. Ma, C. Liu, S. E. Li, S. Zheng, and J. Chen, “Joint synthesis of safety certificate and safe control policy using constrained reinforcement learning,” in Annual Learning for Dynamics and Control Conference, 2022.
- [10] C. Dawson, Z. Qin, S. Gao, and C. Fan, “Safe nonlinear control using robust neural lyapunov-barrier functions,” in Conference on Robot Learning, 2022.
- [11] T. Wei and C. Liu, “Safe control with neural network dynamic models,” in Learning for Dynamics and Control Conference, 2022.
- [12] R. Chen, W. Zhao, and C. Liu, “Safety index synthesis with state-dependent control space,” in American Control Conference, 2024.
- [13] R. A. Horn and C. R. Johnson, Matrix analysis. Cambridge university press, 2012.
- [14] H.-C. Lin, C. Liu, Y. Fan, and M. Tomizuka, “Real-time collision avoidance algorithm on industrial manipulators,” in Conference on Control Technology and Applications, 2017.
- [15] A. J. Taylor and A. D. Ames, “Adaptive safety with control barrier functions,” in American Control Conference, 2020.
- [16] B. T. Lopez, J.-J. E. Slotine, and J. P. How, “Robust adaptive control barrier functions: An adaptive and data-driven approach to safety,” IEEE Control Systems Letters, vol. 5, no. 3, pp. 1031–1036, 2021.
- [17] B. T. Lopez and J.-J. E. Slotine, “Unmatched control barrier functions: Certainty equivalence adaptive safety,” in American Control Conference, 2023.
- [18] D. D. Fan, J. Nguyen, R. Thakker, N. Alatur, A.-a. Agha-mohammadi, and E. A. Theodorou, “Bayesian learning-based adaptive control for safety critical systems,” in International Conference on Robotics and Automation, 2020.
- [19] L. Brunke, S. Zhou, and A. P. Schoellig, “Barrier bayesian linear regression: Online learning of control barrier conditions for safety-critical control of uncertain systems,” in Annual Learning for Dynamics and Control Conference, 2022.
- [20] M. A. Khan, T. Ibuki, and A. Chatterjee, “Gaussian control barrier functions: Non-parametric paradigm to safety,” IEEE Access, vol. 10, pp. 99 823–99 836, 2022.
- [21] M. H. Cohen and C. Belta, “High order robust adaptive control barrier functions and exponentially stabilizing adaptive control lyapunov functions,” in American Control Conference, 2022.
- [22] H. Wang, J. Peng, J. Xu, F. Zhang, and Y. Wang, “High-order control barrier functions-based optimization control for time-varying nonlinear systems with full-state constraints: A dynamic sub-safe set approach,” International Journal of Robust and Nonlinear Control, vol. 33, no. 8, pp. 4490–4503, 2023.
- [23] W. Xiao, C. Belta, and C. G. Cassandras, “Adaptive control barrier functions,” IEEE Transactions on Automatic Control, vol. 67, no. 5, pp. 2267–2281, 2022.
- [24] P. A. Parrilo, “Semidefinite programming relaxations for semialgebraic problems,” Mathematical programming, vol. 96, pp. 293–320, 2003.