betaFeedback

WorksComputer Science

Neural Barriers: An Online Certifiable Learning-enhanced Adaptive High Order Safety Critical Control

Abstract

Control barrier functions are an effective model-based tool to formally certify the safety of a system. However, transferring their theoretical guarantees to real-world robotics systems requires high model fidelity. For example, payloads or wind disturbances can cause significant model perturbations to an aerial vehicle, leading to safety compromises. In this work, we propose a certifiable online learning-enhanced robust adaptive control barrier function, which adapts to disturbances using a Neural ODE and quantifies its adaptation uncertainty with conformal prediction. Our approach guarantees safety at all time under unknown time-varying model disturbances. It adopts a conservative strategy when the adaptation uncertainty is high; and efficiently adapts to reduce controller conservativeness as it receives more data. Our approach provides a provable safety guarantee with a probability bound under suitable Lipschitz smoothness assumptions on the underlying model and trajectory. These results demonstrate the potential of our method as a practical safety controller for robotics system operating under model perturbations.

Introduction

Modern robotics planning and control problems face increasing challenges, including efficient scalable planning for large robot teams [1], [2], vision- and language-grounded control [3], and high dimensionality and nonlinearity in complex mechanical systems [4]. As of today, data-driven approaches are broadly adopted in motion planning and control stacks; despite their advantages in efficiency, empirical solution quality, and multimodal reasoning, guaranteeing safety for these approaches remains a challenge. It is now a necessity to certify the safety of learning-based approaches. Control barrier functions (CBFs) have become a powerful model-based tool for safety-critical control, owing to their guarantees on set invariance without compromising performance [5], [6]. A real-world robotics model, however, can differ significantly from a nominal model, due to modeling errors or external disturbances, such as payloads, varying terrain, or wind. Model inaccuracies can compromise the safety guarantees of a CBF controller, highlighting the need to develop a CBF that extends its theoretical guarantees to tolerate certain model

This work was supported by NSF under Grant 2317145. (Corresponding author: Lishuo Pan.)

perturbations, while preserving certifiable safety in real-world applications.

A large body of work has addressed this problem through the lenses of adaptive control and residual learning. Yet, no existing work simultaneously satisfies the goals of flexible residual parameterization, provable safety guarantees with a probability bound, online adaptation, and real-time computational performance. In this work, we propose a method that achieves these goals.

We propose a certifiable learning-enhanced high-order robust adaptive control barrier function (HO-RaCBF), namely Neural Barriers. Our approach can be divided into three modules running concurrently, namely: (i) a high-frequency HO-RaCBF optimization-based controller with learning-enhanced constraints; (ii) hybrid online residual learning; and (iii) online conformal prediction to evaluate the estimate uncertainty in residual learning. Our approach learns a hybrid model, which consists of a known nominal model and a neural network residual model, from state-control data using Knowledge-based Neural ODEs (KNODE) [7]. Owing to the Neural ODEs formulation, our method can be trained on data sampled at irregular time intervals, making it well-suited for real-time systems. We combine weighted conformal prediction (WCP) with our Theorem 2 to derive an online confidence interval for the underlying true dynamics model. At each control step, the HO-RaCBF optimization queries the hybrid model, and the WCP bound to augment its constraints, thereby solving for optimal control at 100Hz, which guarantees safety with a specific confidence level. Our approach requires Lipschitz smoothness assumptions on the underlying dynamics model and trajectory. As a result, our online Neural Barriers provide a safety guarantee with probabilistic bounds and reduced conservativeness in the presence of complex unknown dynamics, without requiring any pre-training step.

The contributions of this work can be summarized as follows:

  • an online certifiable learning-enhanced CBF that adapts to time-varying model uncertainty;

  • a provable safety guarantee with a probability bound under Lipschitz smoothness assumptions on model dynamics and states;

  • a control schema that decouples adaptation from control loop, allowing adaptation on long-horizon data and high frequency control.

Our controller demonstrates superior adaptation and safety under unknown time-varying simulated model perturbations compared to Robust HOCBFs, and HO-RaCBFs controllers. We further validate our controller through physical experiments on a 38g nano quadrotor in the presence of a large-area wind disturbance, shown in Figure 1.

A 38g nano quadrotor tracks a figure-eight trajectory while keeping a safe distance from two obstacles

Figure 1. A 38g nano quadrotor tracks a figure-eight trajectory while keeping a safe distance from two obstacles, against an 7.6m/s wind. Our Neural Barrier provides a probabilistic safety guarantee while reducing the controller conservativeness online.

Dynamics and residual learning have gained popularity due to their success in adaptive control [8, 9, 10]. Neural-Fly [10] learns an adaptation term in its control law directly and achieves online adaptation to severe wind disturbances, but it requires a significant offline training phase of approximately 12-minute flight data under diverse wind conditions. In contrast, our method learns the model online and improves performance via a model-based controller, and it does not require offline training, while supporting it when desired. KNODE-MPC [9] improves MPC performance by learning a high-fidelity model, whereas our approach addresses adaptive control through the lens of the certifiable safety control problem. With a companion WCP module, we provide a provable safety guarantee with a probability bound under time-varying model perturbations.

Recent studies on adaptive CBFs (aCBFs) are effective in improving the safety of a CBF-certified controller [11, 12, 13]. However, none of them provides a provable safety guarantee under model perturbations, arguably the most critical property of any safe controller. Among them, [12], [13] require an offline pre-training step, leading to significant estimation error during deployment due to domain shift. Online adaptive CBFs [11], while addressing the domain shift problem with an efficient learning-enhanced approach, lack a provable safety guarantee and result in safety violations due to training delays. Our certifiable learning-enhanced safety controller provides a safety guarantee with a probabilistic bound and adapts a time-varying residual model, i.e., the gap between the true and nominal models, online. In addition, we employ a physics-informed approach, namely Neural ODEs, to estimate the residual model directly from observable state-control data, without relying on numerical differentiation for residual dynamics supervision.

A large body of robust adaptive CBFs (RaCBFs) aims to provide safety guarantees under model perturbations. A typical safety certificate is obtained by adding a robustifying term to the CBF constraints. Robust CBFs were first studied in [14], where the robustifying term is determined by an assumed-known bound on the model uncertainty. This approach, however, leads to an overly conservative controller. RaCBFs [15, 16, 17] mitigate over-conservativeness by estimating parametric uncertainty. In many practical dynamic systems, the relative degree of CBFs is larger than one; therefore, a high-order CBF (HOCBF) formulation is required. The authors in [18] extend the concurrent-learning RaCBFs in [19] to HO-RaCBFs. In these RaCBF works, a strong assumption is made that the residual is a linear model combining a known knowledge matrix and a learnable constant vector. Thus, this poses a challenge to feature engineering the knowledge matrix for deployment. The lack of a high-fidelity knowledge matrix breaks their safety guarantees. Careful tuning is also required for the concurrent-learning approach to work. Besides, concurrent-learning approaches compute the integral along samples in a history window in each control step, and quickly throttle the control frequency as the window grows. This prohibits them from capturing long-term patterns. In our approach, rather than assuming a specific form for the residual term, we use Neural ODEs as universal estimators of the underlying vector field, thereby capturing nonlinear residual dynamics. In addition, we decouple the adaptation and control loop, allowing long-horizon pattern recognition without throttling the control frequency.

Probabilistic CBF formulations also address uncertainty through stochastic models. Chance-constrained CBFs are formulated in [20] for autonomous vehicle merging by modeling motion uncertainty as Gaussian noise with known mean and covariance. SHIELD [21] learns a stochastic residual model from physical trajectories and integrates it into a stochastic discrete-time CBF for humanoid navigation.

Preliminaries

High-order Control Barrier Functions (HOCBFs)

Consider a nonlinear control affine system in the form

x˙=f(x)+g(x)u,(1)\dot{x}=f(x)+g(x)u, \tag*{(1)}

where f:Rp→Rpf:\mathbb{R}^{p}\to\mathbb{R}^{p} and g:Rp→Rp×qg:\mathbb{R}^{p}\to\mathbb{R}^{p\times q} are Lipschitz continuous functions, and u∈U⊆Rqu\in U\subseteq\mathbb{R}^{q} is the control input. A closed set C⊆RpC\subseteq\mathbb{R}^{p} is forward invariant for the closed-loop system x˙\dot{x} if x(0)∈C⇒x(t)∈C,∀tx(0)\in C\Rightarrow x(t)\in C,\forall t. In this paper, the forward invariance property is used to formally define the notion of “safety”. It is assumed that any safe set can be expressed as a zero-superlevel set of a continuously differentiable function h(x):Rp→Rh(x):\mathbb{R}^{p}\to\mathbb{R}, written as

C={x∈Rp∣h(x)≥0}.(2)C=\{x\in\mathbb{R}^{p}\mid h(x)\geq0\}. \tag*{(2)}

A control barrier function is a popular tool to produce controls that render the set (2) forward invariant for (1). Classical (first order) CBF formulations, however, are conditioned on the assumption that hh has relative degree one with respect to (1).

Definition 1 (Relative degree [22]). A sufficiently smooth function hh is said to have relative degree r∈Nr\in\mathbb{N} with respect to (1) on the set Rp\mathbb{R}^{p} if (i) LgLfi−1h(x)=0L_{g}L_{f}^{i-1}h(x)=0, for all 1≤i≤r−11\leq i\leq r-1, and (ii) LgLfr−1h(x)≠0L_{g}L_{f}^{r-1}h(x)\neq0 for all x∈Rpx\in\mathbb{R}^{p}. For most mechanical systems and their safety requirements, the function hh has a relative degree greater than one. High-order control barrier functions provide safety for such systems.

Definition 2 (HOCBFs [23], [24]). Consider a system as in (1). Let {Ci}i=1r\{C_i\}_{i=1}^{r} be a collection of sets of the form Ci={x∈Rp∣ψi−1≥0}C_i = \{\mathbf{x} \in\mathbb{R}^p \mid\psi_{i-1} \ge0\} satisfying

ψr(x)=ψ˙r−1(x)+αr(ψr−1(x))(3)\psi_r(\mathbf{x}) = \dot{\psi}_{r-1}(\mathbf{x}) + \alpha_r(\psi_{r-1}(\mathbf{x})) \tag*{(3)}
ψ0(x)=h(x),(4)\psi_0(\mathbf{x}) = h(\mathbf{x}), \tag*{(4)}

where {αi}i=1r\{\alpha_i\}_{i=1}^{r} is a set of differentiable extended class K\mathcal{K} functions. A function hh is said to be a HOCBF of order rr for (1) on an open set D⊃⋂i=1rCiD \supset\bigcap_{i=1}^{r} C_i if hh has relative degree rr on some nonempty R⊆D\mathcal{R} \subseteq D and there exists a suitable choice of {αi}i=1r\{\alpha_i\}_{i=1}^{r}, such that for all x∈D\mathbf{x} \in D

sup⁡u∈U[Lfψr−1(x)+Lgψr−1(x)u+αr(ψr−1(x))]⏟ψr(x,u)≥0.(5)\sup_{\mathbf{u} \in U} \underbrace{\left[L_f\psi_{r-1}(\mathbf{x}) + L_g\psi_{r-1}(\mathbf{x})\mathbf{u} + \alpha_r(\psi_{r-1}(\mathbf{x}))\right]}_{\psi_r(\mathbf{x},\mathbf{u})} \ge0. \tag*{(5)}

Theorem 1 ([24]). Let hh be a HOCBF for (1) on D⊂RpD \subset\mathbb{R}^p as in Def. 2. Any locally Lipschitz controller u∈U\mathbf{u} \in U that satisfies ψr(x,u)≥0\psi_r(\mathbf{x},\mathbf{u}) \ge0, renders ⋂i=1rCi\bigcap_{i=1}^{r} C_i forward invariant for the closed-loop system as in (1).

Knowledge-based Neural ODEs (KNODE)

KNODE [7] is a data-driven approach that approximates a dynamical system relying on state-control pairs, i.e., z:=[x;u]\mathbf{z} := [\mathbf{x};\mathbf{u}]. Its efficiency comes from combining a nominal model with a neural network, learning merely the residual dynamics. The hybrid model is given by

x˙=f~(z)+f^θ(z)=fh(z,f^θ(z)),(6)\dot{\mathbf{x}} = \tilde{f}(\mathbf{z}) + \hat{f}_{\theta}(\mathbf{z}) = f_h(\mathbf{z},\hat{f}_{\theta}(\mathbf{z})), \tag*{(6)}

where f~\tilde{f} denotes a nominal model and f^θ\hat{f}_{\theta} denotes the residual model estimated by a neural network parameterized with θ\theta. The neural ODE-based approach learns the model of a dynamical system. Instead of learning in the state space, it learns its dynamical model directly and predicts the state using ODE solvers, thus allowing observations sampled with different time intervals (typical in a physical real-time system). An efficient learning approach preserves the physics of a dynamic model, making it well-suited for our online HO-aCBF controller.

Weighted Conformal Prediction (WCP)

Conformal prediction (CP) is an uncertainty quantifier that produces provably valid estimation intervals for any given regression model. The validity of such intervals requires training and calibration data sets to be exchangeable [25]. This assumption, however, is too strong for the time series we study, due to two factors: (i) data correlation over time; (ii) domain shift resulting from time-varying residual dynamics. To alleviate such limitations, we employ a state-of-the-art variant of CP, namely weighted conformal prediction (WCP) [26].

Suppose we have a data set of nn samples {(xi,di)}i=1n\{(\mathbf{x}_i,\mathbf{d}_i)\}_{i=1}^{n}, where xi∈Rp\mathbf{x}_i \in\mathbb{R}^p is the state, di∈Rp\mathbf{d}_i \in\mathbb{R}^p is the true residual dynamics at state xi\mathbf{x}_i, i.e., d(xi)d(\mathbf{x}_i), where d(x)d(\mathbf{x}) denotes the underlying residual dynamics. The objective of CP is that given a test point xn+1\mathbf{x}_{n+1}, its label dn+1\mathbf{d}_{n+1} lies within a set C(xn+1)C(\mathbf{x}_{n+1}) with a pre-defined probability. We split the dataset into a training set {(xi,di):i∈I1}\{(\mathbf{x}_i,\mathbf{d}_i):i \in\mathcal{I}_1\} and a calibration set {(xi,di):i∈I2}\{(\mathbf{x}_i,\mathbf{d}_i):i \in\mathcal{I}_2\}. Given our residual model d^(x)\hat{d}(\mathbf{x}) fit to the training set I1\mathcal{I}_1, we compute a set of nonconformity scores S(x,d)S(\mathbf{x},\mathbf{d}) in the calibration set I2\mathcal{I}_2, with element

si(x,d)=∥d^(xi)−di∥∞, ∀i∈I2,(7)s_i(\mathbf{x},\mathbf{d}) = \left\|\hat{d}(\mathbf{x}_i)-\mathbf{d}_i\right\|_{\infty},\ \forall i \in\mathcal{I}_2, \tag*{(7)}

where ∥⋅∥∞\|\cdot\|_{\infty} denotes the infinity norm. For a given confidence level (1−α)(1-\alpha), we then compute the weighted quantile of the empirical distribution of the set S(x,d)S(\mathbf{x},\mathbf{d}),

Q1−α(S(x,d))=Q1−α(∑i=1nw~iδsi+w~n+1δ+∞)(8)Q_{1-\alpha}(S(\mathbf{x},\mathbf{d})) = Q_{1-\alpha}\left(\sum_{i=1}^{n}\tilde{w}_i\delta_{s_i}+\tilde{w}_{n+1}\delta_{+\infty}\right) \tag*{(8)}
w~i=wiw1+⋯+wn+1,wi=ρn+1−i,(9)\tilde{w}_i = \frac{w_i}{w_1+\cdots+w_n+1},\quad w_i=\rho^{n+1-i}, \tag*{(9)}

where Qτ(⋅)Q_{\tau}(\cdot) denotes the τ\tau quantile of its argument, δa\delta_a denotes the point mass at aa, and ρ∈(0,1)\rho\in(0,1) is the decay rate. For more details on the design of the weights wiw_i for calibration data, the reader is referred to [26]. The confidence interval of d(xn+1)d(\mathbf{x}_{n+1}) is given by

C(xn+1)={d:s(xn+1,d)≤Q1−α(S(x,d))}=d^(x)±Q1−α(S(x,d))1p×1.(10)\begin{aligned} C(\mathbf{x}_{n+1}) = \{\mathbf{d}:s(\mathbf{x}_{n+1},\mathbf{d}) \le Q_{1-\alpha}(S(\mathbf{x},\mathbf{d}))\} \\ &= \hat{d}(\mathbf{x}) \pm Q_{1-\alpha}(S(\mathbf{x},\mathbf{d}))\mathbf{1}_{p\times1}. \tag*{(10)} \end{aligned}

The interval satisfies

P{dn+1∈C(xn+1)}≥1−α.(11)\mathbb{P}\{\mathbf{d}_{n+1} \in C(\mathbf{x}_{n+1})\} \ge1-\alpha. \tag*{(11)}

Problem Formulation

Consider a robot that follows a reference trajectory with a desired control udes\mathbf{u}_{\mathrm{des}} and a CBF certifies the desired control to avoid colliding with obstacles. However, the safety guarantee of CBF can be compromised under unknown model perturbations. We consider the adaptive CBF formulation in [15], where the true model can be written as,

x˙=f(x)+g(x)u+d(x),(12)\dot{\mathbf{x}} = f(\mathbf{x}) + g(\mathbf{x})\mathbf{u} + d(\mathbf{x}), \tag*{(12)}

where f(x)+g(x)uf(\mathbf{x}) + g(\mathbf{x})\mathbf{u} forms a nominal model and d(x)d(\mathbf{x}) represents the unknown residuals and is allowed to change over time. In this work, we present a provable safety guarantee with the probabilistic bound for a CBF controller under model perturbations, by estimating the true residual model d(x)d(\mathbf{x}) and evaluating its confidence interval using online state-control data.

Our certifiable learning-enhanced high-order RaCBF controller uses KNODE to predict the unknown nonlinear, time-varying residual dynamics dd using a neural network d^θ\hat{d}_{\theta}, parameterized with θ\theta, while concurrently evaluating its confidence interval via WCP. In each control step, our optimization-based RaCBF controller queries d^θ\hat{d}_{\theta} and the confidence interval to solve the optimal safety-critical control. Our data-driven approach requires online state-control data, i.e., z:=[x;u]\mathbf{z}:=[\mathbf{x};\mathbf{u}]. Furthermore, we generalize the proposed certifiable learning-enhanced higher-order RaCBFs to handle a broader category of systems.

In Sec. V-A, we introduce our formulation of HO-RaCBFs with probabilistic safety guarantee. In Sec. V-B, we introduce our hybrid approach to online residual learning using KNODE. In Sec. VI-A, we introduce our main theorem result, which derives the model confidence given the observable state confidence interval. In Sec. VI-B, we evaluate our model prediction uncertainty online using WCP. In Sec. VII, we present the simulation results of applying our Neural Barriers on a double integrator for collision avoidance tasks. Finally, in Sec. VIII, we validate our Neural Barrier on a nano-quadcopter platform in an indoor environment with real-world wind turbulence.

System overview of our Neural Barrier controller

Figure 2. System overview of our Neural Barrier controller. The safety control solves the NODE-HO-RaCBF QP (at 100Hz), using the most recently trained residual model (updated at 2Hz) and conformal prediction bounds (updated at 10Hz), to certify the desired control.

Neural Barriers

In principle, for an adaptive CBF to provide a safety guarantees under model perturbations, it must predict accurate residual dynamics at all times, as prediction errors may lead to safety violations. We formulate a RaCBF in this section and define the safety guarantee with the probabilistic bound. We introduce our online learning scheme, which estimates time-varying, nonlinear residuals often seen in real-world applications. In addition, our physics-informed learning approach allows training data to be sampled at irregular time intervals (typical for a real-time system) and further improves learning efficiency.

HO-RaCBFs with Probabilistic Safety Guarantee

Beyond adapting time-varying residual dynamics, we provide a safety guarantee with a pre-defined confidence level for the learning-enhanced CBF controller at all times, regardless of adaptation error. Suppose the residual prediction error is bounded by a scalar DD in the infinite norm with probability at least (1−α)(1-\alpha), i.e.,

P{C(x,θ):=∥d^θ(x)−d(x)∥∞≤D}≥1−α.(13)\mathbb{P}\left\{\mathcal{C}(\mathbf{x},\theta):=\left\|\hat{d}_{\theta}(\mathbf{x})-d(\mathbf{x})\right\|_{\infty}\le D\right\}\ge1-\alpha. \tag*{(13)}

Equivalently, the true residual satisfies the bounds

P{d^θ(x)−D1p×1⪯d(x)⪯d^θ(x)+D1p×1}≥1−α,(14)\mathbb{P}\left\{\hat{d}_{\theta}(\mathbf{x})-D\mathbf{1}_{p\times1}\preceq d(\mathbf{x})\preceq\hat{d}_{\theta}(\mathbf{x})+D\mathbf{1}_{p\times1}\right\}\ge1-\alpha, \tag*{(14)}

where 1p×1\mathbf{1}_{p\times1} denotes the pp-dimensional vector of ones. For simplicity of discussion, we omit the explicit mention of the confidence level. All safety guarantees presented below hold with at least (1−α)(1-\alpha) probability.

Remark 1. By using the infinity norm in the definition of (13), we make a conservative choice: we bound the residuals in all dimensions using the same threshold DD. This results in confidence regions that may be overly conservative in some directions. Alternatively, one can define separate confidence intervals for each dimension, yielding individual bounds DiD_i, for i=1,…,pi=1,\ldots,p, that can be less conservative overall. In this case, however, the joint confidence level becomes the product of the individual probabilities–since the events are assumed independent. In contrast, the infinity norm approach guarantees a uniform confidence level across all dimensions by inflating some bounds. This effectively compensates for the reduction in probability due to assuming the worst-case joint event. We adopt this choice for simplicity of formulation.

We assume the true dynamics as in (12), where we consider a time-varying residual term d(x)d(\mathbf{x}), which depends on the robot state and is allowed to change over time. We formulate our hybrid model, combining the known nominal dynamics with a neural ODE approximated residual dynamics, as follows,

fh(z,d^θ(x))=f(x)+g(x)u+d^θ(x),(15)f_h(\mathbf{z},\hat{d}_{\theta}(\mathbf{x}))=f(\mathbf{x})+g(\mathbf{x})\mathbf{u}+\hat{d}_{\theta}(\mathbf{x}), \tag*{(15)}

where d^θ\hat{d}_{\theta} denotes the residual dynamics estimated by a neural network parameterized with θ\theta.

Adaptive CBFs with residual modeling error are studied in RaCBFs [17]. The safety of such a controller is guaranteed by considering the worst-case scenario, specifically, the CBF constraint is satisfied even with the infimum of the left-hand side in (5), with respect to the residual model d(x)d(\mathbf{x}). We define a safety-critical controller by solving the following Quadratic Programming (QP) problem:

arg min⁡u∥u−udes∥(16)\underset{\mathbf{u}}{\operatorname{arg\,min}}\quad\left\|\mathbf{u}-\mathbf{u}_{\mathrm{des}}\right\| \tag*{(16)}
s.t.inf⁡d(x)∈C(x,θ){sup⁡u∈U[Lfψr−1(x)+Lgψr−1(x)u+Ldψr−1(x)+αr(ψr−1(x))]}≥0,(17)\begin{aligned} \mathrm{s.t.}\quad &\inf_{d(\mathbf{x})\in\mathcal{C}(\mathbf{x},\theta)} \{\sup_{\mathbf{u}\in\mathcal{U}}[L_f\psi_{r-1}(\mathbf{x})+L_g\psi_{r-1}(\mathbf{x})\mathbf{u}\\ &\qquad+L_d\psi_{r-1}(\mathbf{x})+\alpha_r(\psi_{r-1}(\mathbf{x}))]\}\ge0, \tag*{(17)} \end{aligned}

where,

ψr=ψ˙r−1+αr(ψr−1)(18)\psi_r=\dot{\psi}_{r-1}+\alpha_r(\psi_{r-1}) \tag*{(18)}
=(∂ψr−1∂x)T(f+gu+d^θ)+αr(ψr−1)(19)=\left(\frac{\partial\psi_{r-1}}{\partial\mathbf{x}}\right)^{\mathsf{T}}\left(f+g\mathbf{u}+\hat{d}_{\theta}\right)+\alpha_r(\psi_{r-1}) \tag*{(19)}
ψ0=h(x),(20)\psi_0=h(\mathbf{x}), \tag*{(20)}

where udes\mathbf{u}_{\mathrm{des}} is the desired control. To compute ψr\psi_r, the algorithm requires taking the (r−1)(r-1)-th derivative of the residual dynamics d^θ\hat{d}_{\theta} estimated by the neural network w.r.t. the state, i.e. ∇xr−1d^θ\nabla_{\mathbf{x}}^{r-1}\hat{d}_{\theta}, which can be computed by automatic differentiation from machine learning frameworks or numerical methods.

Algorithm 1: Online Dynamic Learning

  1. Initialize the current time, total duration, training data as tit_i, tTt_T, Qtrain\mathcal{Q}_{\mathrm{train}}, and the hybrid model in (15)

  2. while ti<tTt_i < t_T do

  3. &nbsp;&nbsp;&nbsp;&nbsp;if Qtrain≠∅\mathcal{Q}_{\mathrm{train}} \ne\varnothing then

  4. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Train the hybrid model by optimizing (22) using Qtrain\mathcal{Q}_{\mathrm{train}}

  5. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Save the new model

  6. &nbsp;&nbsp;&nbsp;&nbsp;ti←t_i \leftarrow current time

Note that, we find the infimum of left-hand side in (17) w.r.t. d(x)d(\mathbf{x}) in the (1−α)(1-\alpha) confidence interval C(x)C(\mathbf{x}). As the true residual d(x)d(\mathbf{x}) lies within C(x)C(\mathbf{x}) with probability at least (1−α)(1-\alpha), the resulting safety-critical control provides safety guarantees with this probability bound.

KNODE Online Learning

An unknown nonstationary residual, as prior models quickly become obsolete, requires continuous online adaptation to identify the current true dynamics. We employ a queue Qtrain\mathcal{Q}_{\mathrm{train}} to store state-control pairs in a first-in, first-out (FIFO) manner, ensuring that the hybrid model fhf_h is trained online with the most recent data. The neural ODE learns the dynamical system directly. Consider a cost function L\mathcal{L} defined as

L(θ)=1m−1∑i=1m−1∫titi+1δ(ts−τ)∥x^τ−xτ∥22dτ+λ∥θ∥22(21)\mathcal{L}(\theta)=\frac{1}{m-1}\sum_{i=1}^{m-1}\int_{t_i}^{t_{i+1}}\delta(t_s-\tau)\left\|\widehat{\mathbf{x}}_\tau-\mathbf{x}_\tau\right\|_2^2\mathrm{d}\tau+\lambda\left\|\theta\right\|_2^2 \tag*{(21)}

that penalizes the error between observations and predictions generated according to a learning-based ODE. Here, mm is the number of samples in Qtrain\mathcal{Q}_{\mathrm{train}}, δ(⋅)\delta(\cdot) is the Dirac delta function, tst_s is any sampling time in Qtrain\mathcal{Q}_{\mathrm{train}}, xτ\mathbf{x}_\tau is a shorthand for x(τ)\mathbf{x}(\tau). For the learned model to generalize, we use the L2 regularization with a weight λ\lambda [27]. The prediction is computed as follows,

x^τ=xti+∫tiτfh(zw,d^θ(xw))dw.(22)\widehat{\mathbf{x}}_\tau=\mathbf{x}_{t_i}+\int_{t_i}^{\tau}f_h(\mathbf{z}_w,\widehat{d}_\theta(\mathbf{x}_w))\mathrm{d}w. \tag*{(22)}

The parameters θ\theta are obtained by solving the optimization:

arg min⁡θ L(θ)(23)\underset{\theta}{\operatorname{arg\,min}}\ \mathcal{L}(\theta) \tag*{(23)}
s.t. x˙=fh(z,d^θ(x)).(24)\text{s.t. }\dot{\mathbf{x}}=f_h(\mathbf{z},\widehat{d}_\theta(\mathbf{x})). \tag*{(24)}

In practice, a gradient-based optimization tool, such as PyTorch, can be employed to solve the above optimization. Note that the online learning is decoupled from the controller. This design allows learning from long-horizon data without throttling the control frequency.

Our algorithm can also be used in offline mode. In offline mode, we collect state-control data by operating the vehicle using the baseline HOCBF controller for a certain duration in the presence of unknown dynamics. We pre-train the neural network to approximate the residual dynamics using all the data collected and deploy the Neural Barrier controller with the learned d^θ(x)\widehat{d}_\theta(\mathbf{x}).

Probabilistic Safety Guarantee

A neural network is a universal approximator to any unknown residual dynamics. In an online learning setting, however, its prediction accuracy is limited by insufficient online data, the number of training epochs within the computational budget, and domain shift. To ensure safety at all times, such prediction errors cannot be tolerated. Instead, we evaluate a confidence interval for the true model online as a response to the training delay and domain shift. To be concrete, we employ weighted conformal prediction, using an online queue Qcalib\mathcal{Q}_{\mathrm{calib}} as the calibration set, to produce an up-to-date confidence interval for the true residual dd. Therefore, our controller accounts for residual estimation error in real-time and guarantees safety with a pre-defined confidence level.

Probabilistic Safety Guarantee

In Sec. III-C, we introduced the definition of conformal prediction and its weighted version to alleviate the strong assumptions. Computation of nonconformity scores sis_i in (7) requires access to the ground truth dynamics d(x)d(\mathbf{x}), which are unavailable. In this section, we propose (i) one approximate interval based on finite difference; and (ii) one true interval based on the state-control trajectory data, under the assumption of Lipschitz smoothness of the dynamics and trajectories. The second approach does not rely on approximation; however, it produces wider bounds and leads to a more conservative controller.

Consider a data set of nn samples D:={(zi,yi)}i=1n\mathcal{D}:=\{(\mathbf{z}_i,\mathbf{y}_i)\}_{i=1}^{n}, where zi=[xi;ui]\mathbf{z}_i=[\mathbf{x}_i;\mathbf{u}_i] is the state-control pair at time tit_i, yi\mathbf{y}_i is the state at time ti+1t_{i+1}. Since d(x)d(\mathbf{x}) is inaccessible, we approximate the nonconformity score in (7) by using a finite difference estimator d~(z,y)\widetilde{d}(\mathbf{z},\mathbf{y}) as the label of the true residual

d~i=d~(zi,yi)=yi−xiti+1−ti−(f(xi)+g(xi)ui),(25)\widetilde{\mathbf{d}}_i=\widetilde{d}(\mathbf{z}_i,\mathbf{y}_i)=\frac{\mathbf{y}_i-\mathbf{x}_i}{t_{i+1}-t_i}-(f(\mathbf{x}_i)+g(\mathbf{x}_i)\mathbf{u}_i), \tag*{(25)}

and derive a residual prediction interval as follows,

P{∥d^(xn+1)−d(xn+1)∥∞≤Q1−α(S(x,d~))}≥1−α,(26)\mathbb{P}\left\{\left\|\widehat{d}(\mathbf{x}_{n+1})-d(\mathbf{x}_{n+1})\right\|_\infty\le Q_{1-\alpha}(S(\mathbf{x},\widetilde{d}))\right\}\ge1-\alpha, \tag*{(26)}

where S(x,d~)S(\mathbf{x},\widetilde{d}) is computed similarly to (7) with di\mathbf{d}_i replaced by d~i\widetilde{\mathbf{d}}_i. The validity of this interval, however, depends on the quality of the estimator d~(x)\widetilde{d}(\mathbf{x}).

In the following, we introduce a prediction interval computed based on the state-control trajectory without approximation. We define a norm-2 nonconformity score s(zi,yi)s(\mathbf{z}_i,\mathbf{y}_i),

si(zi,yi)=∥y^i−yi∥2, ∀i∈I2,(27)s_i(\mathbf{z}_i,\mathbf{y}_i)=\left\|\widehat{\mathbf{y}}_i-\mathbf{y}_i\right\|_2,\ \forall i\in\mathcal{I}_2, \tag*{(27)}

where the predicted state y^i\widehat{\mathbf{y}}_i is obtained from (22). Given a CP prediction interval satisfying

P{∥y^n+1−yn+1∥2≤Q1−α/2(S(z,y))}≥1−α2,(28)\mathbb{P}\left\{\left\|\widehat{\mathbf{y}}_{n+1}-\mathbf{y}_{n+1}\right\|_2\le Q_{1-\alpha/2}(S(\mathbf{z},\mathbf{y}))\right\}\ge1-\frac{\alpha}{2}, \tag*{(28)}

we derive a residual prediction interval as follows

P{∥d^(xn+1)−d(xn+1)∥∞≤12(Lhh+Ltl)+(Lh+2)Q1−α/2(S(z,y))}≥1−α.(29)\mathbb{P}\left\{\left\|\widehat{d}(\mathbf{x}_{n+1})-d(\mathbf{x}_{n+1})\right\|_\infty\le\frac{1}{2}(L_hh+L_tl)+(L_h+2)Q_{1-\alpha/2}(S(\mathbf{z},\mathbf{y}))\right\}\ge1-\alpha. \tag*{(29)}

Theorem 2. Let the true residual d(x)d(\mathbf{x}), the estimated residual d^(x)\hat{d}(\mathbf{x}), the trajectory xt\mathbf{x}_t, and the predicted trajectory x^t\hat{\mathbf{x}}_t be Lipschitz continuous functions with Lipschitz constants LtL_t, LhL_h, ltl_t and lhl_h respectively. Given the prediction interval

P{∥x^t−xt∥2≤q}≥1−α2,(30)\mathbb{P}\left\{\left\|\hat{\mathbf{x}}_t-\mathbf{x}_t\right\|_2\leq q\right\}\geq1-\frac{\alpha}{2}, \tag*{(30)}

the prediction interval for the residual d(x)d(\mathbf{x}) satisfies

P{∥d^(xt)−d(xt)∥2≤Ltlt+Lhlh2+(Lh+2)q}≥1−α.\mathbb{P}\left\{\left\|\hat{d}(\mathbf{x}_t)-d(\mathbf{x}_t)\right\|_2\leq\frac{L_tl_t+L_hl_h}{2}+(L_h+2)q\right\}\geq1-\alpha.

Proof. Let g(t)=d^(x^t)−d(xt)g(t)=\hat{d}(\hat{\mathbf{x}}_t)-d(\mathbf{x}_t). We first prove that g(t)g(t) is a LL-Lipschitz continuous function, where L=Ltlt+LhlhL=L_tl_t+L_hl_h,

∥g(t)−g(s)∥=∥d^(x^t)−d^(x^s)+d(xs)−d(xt)∥≤Lh∥x^t−x^s∥+Lt∥xs−xt∥≤(Ltlt+Lhlh)∣t−s∣.\begin{aligned} \left\|g(t)-g(s)\right\|=\left\|\hat{d}(\hat{\mathbf{x}}_t)-\hat{d}(\hat{\mathbf{x}}_s)+d(\mathbf{x}_s)-d(\mathbf{x}_t)\right\| \\ &\leq L_h\left\|\hat{\mathbf{x}}_t-\hat{\mathbf{x}}_s\right\|+L_t\left\|\mathbf{x}_s-\mathbf{x}_t\right\|\leq(L_tl_t+L_hl_h)|t-s|. \end{aligned}

Now we prove ∥g(t)∥≤2q+L2\|g(t)\|\leq2q+\frac{L}{2}. Since x^0=x0\hat{\mathbf{x}}_0=\mathbf{x}_0, we have ∥x^t−xt∥=∥∫0tg(s)ds∥\|\hat{\mathbf{x}}_t-\mathbf{x}_t\|=\left\|\int_0^t g(s)ds\right\|. Then

∥∫t1t2g(s)ds∥=∥∫0t1g(s)ds−∫0t2g(s)ds∥≤∥∫0t1g(s)ds∥+∥∫0t2g(s)ds∥, ∀t1,t2=∥x^t1−xt1∥2+∥x^t2−xt2∥2, ∀t1,t2.\begin{aligned} \left\|\int_{t_1}^{t_2}g(s)ds\right\|=\left\|\int_0^{t_1}g(s)ds-\int_0^{t_2}g(s)ds\right\| \\ &\leq\left\|\int_0^{t_1}g(s)ds\right\|+\left\|\int_0^{t_2}g(s)ds\right\|,\ \forall t_1,t_2 \\ &=\|\hat{\mathbf{x}}_{t_1}-\mathbf{x}_{t_1}\|_2+\|\hat{\mathbf{x}}_{t_2}-\mathbf{x}_{t_2}\|_2,\ \forall t_1,t_2. \end{aligned}

By the prediction interval (30), we have for any t1,t2t_1,t_2,

P{∥∫t1t2g(s)ds∥≤2q}=1−P{∥∫t1t2g(s)ds∥>2q}≥P{∥x^t1−xt1∥2≤q and ∥x^t2−xt2∥2≤q}=1−P{∥x^t1−xt1∥2>q or ∥x^t2−xt2∥2>q}\begin{aligned} \mathbb{P}\left\{\left\|\int_{t_1}^{t_2}g(s)ds\right\|\leq2q\right\}=1-\mathbb{P}\left\{\left\|\int_{t_1}^{t_2}g(s)ds\right\|>2q\right\} \\ &\geq\mathbb{P}\{\|\hat{\mathbf{x}}_{t_1}-\mathbf{x}_{t_1}\|_2\leq q\ \text{and}\ \|\hat{\mathbf{x}}_{t_2}-\mathbf{x}_{t_2}\|_2\leq q\} \\ &=1-\mathbb{P}\{\|\hat{\mathbf{x}}_{t_1}-\mathbf{x}_{t_1}\|_2>q\ \text{or}\ \|\hat{\mathbf{x}}_{t_2}-\mathbf{x}_{t_2}\|_2>q\} \end{aligned}
≥1−P{∥x^t1−xt1∥2>q}−P{∥x^t2−xt2∥2>q}\geq1-\mathbb{P}\{\|\hat{\mathbf{x}}_{t_1}-\mathbf{x}_{t_1}\|_2>q\}-\mathbb{P}\{\|\hat{\mathbf{x}}_{t_2}-\mathbf{x}_{t_2}\|_2>q\}
≥1−α.\geq1-\alpha.

Assume ∥g(t)∥>2q+L2\|g(t)\|>2q+\frac{L}{2} for a given tt. Define the unit vector pointing in the direction of g(t)g(t) as

v=g(t)∥g(t)∥.\mathbf{v}=\frac{g(t)}{\|g(t)\|}.

For every s∈[t,t+1]s\in[t,t+1], we have ∣s−t∣≤1|s-t|\leq1. Using the Lipschitz continuity of gg, we have

vTg(s)=vTg(t)+vT(g(s)−g(t))≥∥g(t)∥−∥g(s)−g(t)∥≥∥g(t)∥−L∣s−t∣>2q+L(12−∣s−t∣).\begin{aligned} \mathbf{v}^{\mathsf{T}}g(s)=\mathbf{v}^{\mathsf{T}}g(t)+\mathbf{v}^{\mathsf{T}}(g(s)-g(t)) \\ &\geq\|g(t)\|-\|g(s)-g(t)\| \\ &\geq\|g(t)\|-L|s-t| \\ &>2q+L\left(\frac{1}{2}-|s-t|\right). \end{aligned}

Therefore,

∥∫tt+1g(s)ds∥≥vT∫tt+1g(s)ds=∫tt+1vTg(s)ds>∫tt+1[2q+L(12−∣s−t∣)]ds=2q+L∫01(12−u)du=2q.\begin{aligned} \left\|\int_t^{t+1}g(s)ds\right\|\geq\mathbf{v}^{\mathsf{T}}\int_t^{t+1}g(s)ds=\int_t^{t+1}\mathbf{v}^{\mathsf{T}}g(s)ds \\ &>\int_t^{t+1}\left[2q+L\left(\frac{1}{2}-|s-t|\right)\right]ds \\ &=2q+L\int_0^1\left(\frac{1}{2}-u\right)du=2q. \end{aligned}

Hence, if ∥∫tt+1g(s)ds∥≤2q\left\|\int_t^{t+1}g(s)ds\right\|\leq2q, we must have ∥g(t)∥≤2q+L2\|g(t)\|\leq2q+\frac{L}{2}. Thus assuming ∥x^t−xt∥2≤q\|\hat{\mathbf{x}}_t-\mathbf{x}_t\|_2\leq q and ∥x^t+1−xt+1∥2≤q\|\hat{\mathbf{x}}_{t+1}-\mathbf{x}_{t+1}\|_2\leq q, we have ∥∫tt+1g(s)ds∥≤2q\left\|\int_t^{t+1}g(s)ds\right\|\leq2q and ∥g(t)∥≤2q+L2\|g(t)\|\leq2q+\frac{L}{2}. Therefore,

∥d^(xt)−d(xt)∥=∥d^(xt)−d^(x^t)+d^(x^t)−d(xt)∥≤∥d^(xt)−d^(x^t)∥+∥d^(x^t)−d(xt)∥≤Lh∥x^t−xt∥+∥g(t)∥≤Lhq+2q+L2.\begin{aligned} \|\hat{d}(\mathbf{x}_t)-d(\mathbf{x}_t)\|=\|\hat{d}(\mathbf{x}_t)-\hat{d}(\hat{\mathbf{x}}_t)+\hat{d}(\hat{\mathbf{x}}_t)-d(\mathbf{x}_t)\| \\ &\leq\|\hat{d}(\mathbf{x}_t)-\hat{d}(\hat{\mathbf{x}}_t)\|+\|\hat{d}(\hat{\mathbf{x}}_t)-d(\mathbf{x}_t)\| \\ &\leq L_h\|\hat{\mathbf{x}}_t-\mathbf{x}_t\|+\|g(t)\|\leq L_hq+2q+\frac{L}{2}. \end{aligned}

Since

P{∥x^t1−xt1∥2≤q and ∥x^t2−xt2∥2≤q}≥1−α,\mathbb{P}\{\|\hat{\mathbf{x}}_{t_1}-\mathbf{x}_{t_1}\|_2\leq q\ \text{and}\ \|\hat{\mathbf{x}}_{t_2}-\mathbf{x}_{t_2}\|_2\leq q\}\geq1-\alpha,

we conclude that

P{∥d^(xt)−d(xt)∥≤L2+(Lh+2)q}≥1−α.\mathbb{P}\left\{\|\hat{d}(\mathbf{x}_t)-d(\mathbf{x}_t)\|\leq\frac{L}{2}+(L_h+2)q\right\}\geq1-\alpha.

Based on Thm. 2 and the inequality ∥⋅∥∞≤∥⋅∥2\|\cdot\|_\infty\leq\|\cdot\|_2, we complete the derivation of (29) from (28).

Online Weighted Conformal Prediction

As we discussed earlier, an adaptive CBF cannot afford the safety violations caused by prediction errors due to online learning delays and domain shift under time-varying model perturbations. Our online learning is decoupled from the controller. While it allows learning from long-horizon data without throttling the control frequency, it introduces adaptation delays because the controller queries a previously trained model, and the new model is always in training. Domain shift is another factor that leads to prediction error.

For these reasons, we propose an online WCP, as shown in Algo. 2, that evaluates a prediction interval in real time that accounts for prediction error, while training the new model. We design a separate queue Qcalib\mathcal{Q}_{\mathrm{calib}} as the CP calibration set and clear it after each model update, to receive the new data that is not used during training. After the kk-th model update, the (k+1)(k+1)-th model starts training with data Qtrain\mathcal{Q}_{\mathrm{train}} newly collected from previous time windows, and the kk-th CP starts to produce prediction intervals for the current (k(k-th) model (see Figure 3). Note that the calibration data is not obtained by splitting from the training data, instead obtained from the data stream after model update. The benefits are twofold: (i) we decouple the CP from training. A separate Qcalib\mathcal{Q}_{\mathrm{calib}} always fetches fresh data and keeps the prediction interval up-to-date, and (ii) we utilize all the recent data for training without splitting for CP, the learned model maximizes its statistical efficiency.

Figure 3. Once the kk-th model is trained, QcalibQ_{\mathrm{calib}} is cleared and the kk-th CP starts to quantify its estimation quality. The data collected during its training and prior data in the queue are used for the training of the (k+1)(k+1)-th model.

Simulations

To demonstrate the efficacy of our controller, we design a simulation using a double integrator with different residuals.

Algorithm 2: Online Weighted Conformal Prediction

  1. Initialize the current time, total duration, calibration data as tit_i, tTt_T, QcalibQ_{\mathrm{calib}}, and the margin of error as a vector of zeros.

  2. while ti<tTt_i < t_T do

  3. &nbsp;&nbsp;if New model is available then

  4. &nbsp;&nbsp;&nbsp;&nbsp;Update the model used in CP and clear QcalibQ_{\mathrm{calib}}

  5. &nbsp;&nbsp;Append the newly completed state-control pairs and their sampling times to QcalibQ_{\mathrm{calib}}

  6. &nbsp;&nbsp;if Qcalib≠∅Q_{\mathrm{calib}} \ne\emptyset then

  7. &nbsp;&nbsp;&nbsp;&nbsp;Assign weights to the calibration samples in QcalibQ_{\mathrm{calib}} using (9)

  8. &nbsp;&nbsp;&nbsp;&nbsp;if using the finite-difference construction then

  9. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute residual error scores S(x,d~)S(x,\tilde d) in (7), with residual labels estimated by (25)

  10. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute DD as in (26)

  11. &nbsp;&nbsp;&nbsp;&nbsp;else

  12. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute state prediction error scores S(z,y)S(z,y) in (27)

  13. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute DD as in (29)

  14. &nbsp;&nbsp;&nbsp;&nbsp;Update the controller’s residual uncertainty margin to D1p×1D_{1_{p \times1}}

  15. &nbsp;&nbsp;ti←t_i \leftarrow current time

Neural Barrier for Double Integrator

A robot is required to follow a reference trajectory in a workspace containing obstacles O1,…,ONobsO_1,\ldots,O_{N_{\mathrm{obs}}}, from which the robot is required to keep a minimum safety distance DsD_s. The state x=[r;r˙]∈R6\mathbf{x}=[\mathbf{r};\dot{\mathbf{r}}]\in\mathbb{R}^{6} contains position and velocity. The control u∈R3\mathbf{u}\in\mathbb{R}^{3} is the acceleration. We consider a double integrator nominal model, and the hybrid model follows

x˙:=fh(z,d^θ(x))=Ax+Bu+d^θ(x),(31)\dot{\mathbf{x}} := f_h(\mathbf{z},\hat d_\theta(\mathbf{x})) = A\mathbf{x}+B\mathbf{u}+\hat d_\theta(\mathbf{x}), \tag*{(31)}

where A=[0,I;0,0]∈R6×6A=[0,I;0,0]\in\mathbb{R}^{6\times6}, B=[0;I]∈R6×3B=[0;I]\in\mathbb{R}^{6\times3}. Here 0∈R3×30\in\mathbb{R}^{3\times3}, I∈R3×3I\in\mathbb{R}^{3\times3} are the zero and identity matrices, respectively. We utilize this simplified model to demonstrate how the residual learning term d^θ(x)\hat d_\theta(\mathbf{x}) effectively captures unmodeled nonlinearities and disturbances, guaranteeing safety even with inaccurate nominal dynamics. At each step, we obtain the desired position, velocity, and acceleration, i.e., [rdes;vdes;ades][\mathbf{r}_{\mathrm{des}};\mathbf{v}_{\mathrm{des}};\mathbf{a}_{\mathrm{des}}] from the reference. The desired control udes\mathbf{u}_{\mathrm{des}} is generated using PID. We investigate the CBF that ensures safety by maintaining a minimum distance from obstacles. Specifically, we define a CBF for the ii-th obstacle as

hi(x)=∥r−robs,i∥22−Ds2, ∀i∈{1,…,Nobs},(32)h_i(\mathbf{x})=\lVert\mathbf{r}-\mathbf{r}_{\mathrm{obs},i}\rVert_2^2-D_s^2,\ \forall i\in\{1,\ldots,N_{\mathrm{obs}}\}, \tag*{(32)}

where robs,i\mathbf{r}_{\mathrm{obs},i} denotes the position of ii-th obstacle, and DsD_s is the minimal safety distance between the robot and obstacles. The relative degree of hih_i is two with respect to the model in (31). We consider the extended class K\mathcal{K} functions as αi(h)=γih\alpha_i(h)=\gamma_i h. The optimal control is found by solving the following QP:

arg⁡min⁡u ∥u−udes∥(33)\underset{\mathbf{u}}{\arg\min}\ \lVert\mathbf{u}-\mathbf{u}_{\mathrm{des}}\rVert \tag*{(33)}
s.t.inf⁡d(x)∈C(x,θ){sup⁡d[Lf2h(x)+[LgLfh(x)]u+(γ1+γ2)Lfh(x)+γ1γ2h(x)]}≥0,(34)\text{s.t.}\quad\inf_{\mathbf{d}(\mathbf{x})\in\mathcal{C}(\mathbf{x},\theta)}\left\{\sup_{\mathbf{d}}\left[L_f^2h(\mathbf{x})+ [L_gL_fh(\mathbf{x})]\mathbf{u} +(\gamma_1+\gamma_2)L_fh(\mathbf{x})+\gamma_1\gamma_2h(\mathbf{x})\right]\right\}\ge0, \tag*{(34)}

As the true residual lies within the (1−α)(1-\alpha) confidence interval C(x)\mathcal{C}(\mathbf{x}), our controller in (33) accounts for the prediction error and guarantees safety with at least (1−α)(1-\alpha) probability. The constraint in (34) can be rewritten as

inf⁡d(x)∈C(x,θ)(aTu+c)≥0(35)\inf_{\mathbf{d}(\mathbf{x})\in\mathcal{C}(\mathbf{x},\theta)}(\mathbf{a}^{\mathsf T}\mathbf{u}+c)\ge0 \tag*{(35)}
a=gT∂2h∂x2d+gT[∂2h∂x2f+(∂f∂x+∂d∂x)∂h∂x](36)\mathbf{a}=\mathbf{g}^{\mathsf T}\frac{\partial^2h}{\partial\mathbf{x}^2}\mathbf{d}+\mathbf{g}^{\mathsf T}\left[\frac{\partial^2h}{\partial\mathbf{x}^2}\mathbf{f}+\left(\frac{\partial\mathbf{f}}{\partial\mathbf{x}}+\frac{\partial\mathbf{d}}{\partial\mathbf{x}}\right)\frac{\partial h}{\partial\mathbf{x}}\right] \tag*{(36)}
c=dT∂2h∂x2d+[2fT∂2h∂x2+(∂h∂x)T(∂f∂x+∂d∂x)T+(γ1+γ2)(∂h∂x)T]d+[fT∂2h∂x2+(∂h∂x)T(∂f∂x+∂d∂x)T]f+(γ1+γ2)(∂b∂x)Tf+γ1γ2b,(37)\begin{aligned} c={}&\mathbf{d}^{\mathsf T}\frac{\partial^2h}{\partial\mathbf{x}^2}\mathbf{d}\\ &+\left[2\mathbf{f}^{\mathsf T}\frac{\partial^2h}{\partial\mathbf{x}^2}+\left(\frac{\partial h}{\partial\mathbf{x}}\right)^{\mathsf T}\left(\frac{\partial\mathbf{f}}{\partial\mathbf{x}}+\frac{\partial\mathbf{d}}{\partial\mathbf{x}}\right)^{\mathsf T}+(\gamma_1+\gamma_2)\left(\frac{\partial h}{\partial\mathbf{x}}\right)^{\mathsf T}\right]\mathbf{d}\\ &+\left[\mathbf{f}^{\mathsf T}\frac{\partial^2h}{\partial\mathbf{x}^2}+\left(\frac{\partial h}{\partial\mathbf{x}}\right)^{\mathsf T}\left(\frac{\partial\mathbf{f}}{\partial\mathbf{x}}+\frac{\partial\mathbf{d}}{\partial\mathbf{x}}\right)^{\mathsf T}\right]\mathbf{f}\\ &+(\gamma_1+\gamma_2)\left(\frac{\partial b}{\partial\mathbf{x}}\right)^{\mathsf T}\mathbf{f}+\gamma_1\gamma_2b, \tag*{(37)} \end{aligned}

where ∂f∂x=[∂f1∂x,…,∂f6∂x]\frac{\partial\mathbf{f}}{\partial\mathbf{x}}=\left[\frac{\partial f_1}{\partial\mathbf{x}},\ldots,\frac{\partial f_6}{\partial\mathbf{x}}\right]. Note that gT∂2h∂x2=0\mathbf{g}^{\mathsf T}\frac{\partial^2h}{\partial\mathbf{x}^2}=0, and the Jacobian ∂d∂x\frac{\partial\mathbf{d}}{\partial\mathbf{x}} term can be computed using autograd. Therefore, a\mathbf{a} is independent of d\mathbf{d}, and the infimum of (34) is determined solely by cc. Further, since ∂2h∂x2=diag⁡(2,2,2,0,0,0)\frac{\partial^2h}{\partial\mathbf{x}^2}=\operatorname{diag}(2,2,2,0,0,0), cmin⁡c_{\min} can be obtained straightforwardly. Therefore, the robust CBF constraint in (34) reduces to aTu+cmin⁡≥0\mathbf{a}^{\mathsf T}\mathbf{u}+c_{\min}\ge0.

Simulation Setups

A perturbed double integrator is implemented as x˙=Ax+Bu+d(x)\dot{\mathbf{x}}=A\mathbf{x}+B\mathbf{u}+\mathbf{d}(\mathbf{x}), where we assume the residual d(x)\mathbf{d}(\mathbf{x}) is unknown to the robot in the simulation. Three types of residuals are considered, namely, “Attractive”, “Repulsive”, and “Time-varying”. In “Attractive” and “Repulsive” experiments, the robot is attracted and repulsed towards and away from the center of the obstacle, i.e., datt(x)=[0;−κr]\mathbf{d}_{\mathrm{att}}(\mathbf{x})=[0;-\kappa\mathbf{r}], drep(x)=[0;κr]\mathbf{d}_{\mathrm{rep}}(\mathbf{x})=[0;\kappa\mathbf{r}], where κ=0.4\kappa=0.4. In “Time-varying” experiment, residuals alternate between repulsive and attractive over time, i.e., dvar(x)=[0;κsin⁡(t)r]\mathbf{d}_{\mathrm{var}}(\mathbf{x})=[0;\kappa\sin(t)\mathbf{r}], where κ=1.0\kappa=1.0. A Runge–Kutta (RK4) numerical solver with sampling time of Δt=0.01s\Delta t=0.01\mathrm{s} is used to simulate responses given the control. We assumed the robot state-control pair z:=[x;u]\mathbf{z}:=[\mathbf{x};\mathbf{u}] can be measured at 100Hz. The closed-loop control runs at 100Hz. We use a similar neural network architecture to [28]. The value of d^θ\hat d_\theta is computed as the weighted sum of three parallel neural networks with the same architecture. Each neural network has two hidden layers, each with only 16 neurons, where the hyperbolic tangent activation is applied after the first hidden layer. The parallel structure enables continual adaptation while preserving previously learned dynamics. The queue size is fixed to three: in each training epoch, a new neural network is added, and the oldest one is removed if the queue is at capacity. Older neural networks are combined using exponential forgetting weights. This facilitates online adaptation and avoids instability in the closed-loop controller. We set the residual coverage target to (1−α)=0.6(1-\alpha)=0.6. Accordingly, the finite-difference construction uses the 0.6 quantile in (26), whereas the state-based construction uses the 0.8 quantile in (28), which is then transformed into a residual uncertainty bound through (29).

A closed-loop PID synthesizes the desired control udesu_{\mathrm{des}} to track a circular reference of radius 2m at height 1m, centered at the origin of the x-y plane, with constant angular velocity 0.5rad/s0.5\mathrm{rad}/\mathrm{s}. A spherical obstacle of radius Ds=3mD_s=3\mathrm{m} is also located at the origin. Thus, the CBF must be effective to avoid safety violations. Our Neural Barrier controller supports both offline and online modes as described in Sec. V-B. For our online controller, we maintain an FIFO queue of 10s of online data for training. For our offline model, we collect 40s of state-control data for training.

Benchmarking. We compare the safety performance between: (i) robust HOCBFs controller, when there does not exist residual dynamics [23] (we use the open-source implementation from [29]), (ii) robust HOCBFs controller, (iii) HO-RaCBFs controller [18], [19], (iv) our online Neural Barrier controller, and (v) our offline Neural Barrier controller. The robust HOCBF controller without residual dynamics serves as the guideline performance. The comparison of our online and offline controllers with robust HOCBF controller demonstrates that our controllers guarantee safety and reduce the controller conservativeness by adapting to model perturbations. The comparison of our online and offline controllers with HO-RaCBFs shows that our controllers guarantee safety even under a time-varying model perturbation, without knowledge of residual dynamics nor tuning, highlighting the flexibility of our controller.

In CBF constraints of all controllers, we use extended class K\mathcal{K} functions αi(h)=γih\alpha_i(h)=\gamma_i h, where γi=3\gamma_i=3 for i=1,2i=1,2. For the HO-RaCBFs [18], it is assumed that d(x)=Y(x)ϑ^d(x)=Y(x)\hat{\vartheta}, where Y(x)∈Rp×sY(x)\in\mathbb{R}^{p\times s} is a known matrix and ϑ^∈Rs\hat{\vartheta}\in\mathbb{R}^{s} is a constant vector to estimate. To update the parameter ϑ^\hat{\vartheta}, HO-RaCBFs require computing its update law ϑ^˙\dot{\hat{\vartheta}} using an adaptation gain κ∈R>0\kappa\in\mathbb{R}_{>0} and a positive definite gain matrix Γ∈Rs×s\Gamma\in\mathbb{R}^{s\times s} (see [18], eq. (14)). We extensively tune κ\kappa and Γ\Gamma in ϑ^˙\dot{\hat{\vartheta}} and assume a known knowledge matrix Y(x)=[03×3;−r1,0,0;0,−r2,0;0,0,−(r3−1)]Y(x)=[0_{3\times3};-r_1,0,0;0,-r_2,0;0,0,-(r_3-1)]. Note that this is a strong assumption, and we usually do not have prior knowledge about Y(x)Y(x) in practice. In addition, we also benchmark RaCBF controller without prior knowledge, where Y(x)=[03×3;−1,0,0;0,−1,0;0,0,−1]Y(x)=[0_{3\times3};-1,0,0;0,-1,0;0,0,-1]. To compute the HO-RaCBF controller at 100Hz, it only supports historical data with a length of 0.5s. In the following section, we discuss that increasing the HO-RaCBF’s data horizon does not improve its performance significantly, yet prohibits its online

performance. For HO-RaCBFs [18], we set the bounds of the estimate ϑ^\hat{\vartheta} between [−4,−4,−4][-4,-4,-4] and [4,4,4][4,4,4], which cover the range of the underlying residual given our choice of Y(x)Y(x).

Simulation Qualitative Results

We illustrate representative trajectories of the robust HOCBF, HO-RaCBF, and our controllers in the simulation in Figure 4. Due to space limitations, we include only the single-obstacle “Attractive” and “Time-varying” experiments (as the “Repulsive” result is similar to the “Attractive” one), as well as the multiple-obstacle “Time-varying” experiment. In all shown experiments, the robust HOCBF and both our online and offline controllers preserve safety, while the HO-RaCBF controller violates the safety. For the HO-RaCBF controller, we adopt Y(x)Y(x) without prior knowledge, since the estimated residual using Y(x)Y(x) with knowledge fails to converge in the multiple obstacle setting, resulting in a faulty controller. Compared to the robust HOCBF, our online controller becomes less conservative as it sees more data, and our offline controller has reduced conservativeness to begin with, while guaranteeing safety with a pre-defined probability. In these two simulation instances, we notice that the safety is preserved with a higher probability compared to the pre-defined value, i.e., 100% achieved v.s. 60% demanded. On the other hand, the HO-RaCBF controller results in safety violations when its conservativeness is reduced.

Figure 4. Typical trajectories of the baseline and our controllers under different model perturbations. single-obstacle “Attractive” residual (top left), single-obstacle “Time-varying” residual (top right) and multi-obstacle “Time-varying” residual (bottom). The gray sphere is the obstacle. The blue dot represents the initial state, and the red dot represents the current reference. The red cross indicates that the collision occurred, the trajectory is depicted in a dashed line.

Note that the online Neural Barrier controller results in a slightly noisier and slower adaptation at the beginning compared to the HO-RaCBF controller, as depicted in Figure 4. The HO-RaCBF controller updates the estimated residual at each control step, instead, our Neural Barrier learns a neural network alongside the control loop. We call this noisier and slower adaptation a learning delay. Despite this delay, the neural network provides the nonlinearity required by complex residuals and learns an underlying manifold, enabling it to generalize to unseen areas. Decoupling learning from the control loop enables our Neural Barrier to learn patterns from more data without slowing the control loop. We highlight that our controllers successfully adapt to the time-varying residual while preserving safety, whereas existing RaCBFs controller fails to adapt without causing collisions, despite extensive tuning.

Remark 2. Assuming a double-integrator model, we will derive a tighter bound for Thm. 2. Assume we know that d(x)=[0;kr]d(\mathbf{x}) = [0; k\mathbf{r}] and u≫r˙\mathbf{u} \gg\dot{\mathbf{r}}. Given the assumptions in Thm. 2, the residual d(x)d(\mathbf{x}) prediction interval satisfies

P{∥d^(xt)−d(xt)∥2≤L2+(Lh+2)q}≥1−α,\mathbb{P}\left\{\left\|\hat{d}(\mathbf{x}_t)-d(\mathbf{x}_t)\right\|_2 \le\frac{L}{2}+(L_h+2)q\right\}\ge1-\alpha,

where L=Ltlt+LhlhL=L_tl_t+L_hl_h, is derived as the Lipschitz constant of g(t)=d^(x^t)−d(xt)g(t)=\hat{d}(\hat{\mathbf{x}}_t)-d(\mathbf{x}_t). In this case, we will derive an alternate formulation for LL. In particular, we have

∥g(t)−g(s)∥=∥d^(x^t)−d^(x^s)+d(xs)−d(xt)∥≤∥d^(x^t)−d^(x^s)∥+∥d(xs)−d(xt)∥,\begin{aligned} \|g(t)-g(s)\|&=\left\|\hat{d}(\hat{\mathbf{x}}_t)-\hat{d}(\hat{\mathbf{x}}_s)+d(\mathbf{x}_s)-d(\mathbf{x}_t)\right\|\\ &\le\left\|\hat{d}(\hat{\mathbf{x}}_t)-\hat{d}(\hat{\mathbf{x}}_s)\right\|+\|d(\mathbf{x}_s)-d(\mathbf{x}_t)\|, \end{aligned}

where

∥d(xs)−d(xt)∥=∥−krs+krt∥=k∥rt−rs∥≈k∥r˙t∥∣t−s∣\begin{aligned} \|d(\mathbf{x}_s)-d(\mathbf{x}_t)\|&=\|-k\mathbf{r}_s+k\mathbf{r}_t\|=k\|\mathbf{r}_t-\mathbf{r}_s\|\\ &\approx k\|\dot{\mathbf{r}}_t\||t-s| \end{aligned}

(given by assumption, ∣t−s∣|t-s| is very small)

and

∥d^(x^t)−d^(x^s)∥≤Lh∥x^t−x^s∥2=Lh∥r^t−r^s∥22+∥v^t−v^s∥2=Lh∥r^˙t∥22+∥ut∥22∣t−s∣≈Lh∥u∥∣t−s∣\begin{aligned} \|\hat{d}(\hat{\mathbf{x}}_t)-\hat{d}(\hat{\mathbf{x}}_s)\|&\le L_h\|\hat{\mathbf{x}}_t-\hat{\mathbf{x}}_s\|_2\\ &=L_h\sqrt{\|\hat{\mathbf{r}}_t-\hat{\mathbf{r}}_s\|_2^2+\|\hat{\mathbf{v}}_t-\hat{\mathbf{v}}_s\|^2}\\ &=L_h\sqrt{\|\dot{\hat{\mathbf{r}}}_t\|_2^2+\|\mathbf{u}_t\|_2^2}|t-s|\\ &\approx L_h\|\mathbf{u}\||t-s| \end{aligned}

(given by assumption, u≫r˙\mathbf{u}\gg\dot{\mathbf{r}}).

Therefore, we have

∥g(t)−g(s)∥≤(k∥r˙∥+Lh∥u∥)∣t−s∣.\|g(t)-g(s)\|\le(k\|\dot{\mathbf{r}}\|+L_h\|\mathbf{u}\|)|t-s|.

Hence now the residual d(x)d(\mathbf{x}) prediction interval satisfies

P{∥d^(xt)−d(xt)∥2≤k∥r˙∥+Lh∥u∥2+(Lh+2)q}≥1−α.(38)\mathbb{P}\left\{\left\|\hat{d}(\mathbf{x}_t)-d(\mathbf{x}_t)\right\|_2\le\frac{k\|\dot{\mathbf{r}}\|+L_h\|\mathbf{u}\|}{2}+(L_h+2)q\right\}\ge1-\alpha. \tag*{(38)}

Our Neural Barrier, when equipped with the confidence interval from Thm. 2, guarantees safety but yields a more conservative controller. The conservativeness is primarily introduced by the term Lhlh+LtltL_hl_h+L_tl_t in (29), which, for a double integrator model, can be approximated as k∥r˙∥+Lh∥u∥k\|\dot{\mathbf{r}}\|+L_h\|\mathbf{u}\| (see

Trajectories of offline Neural Barrier controller with confidence interval computed from Thm. 2

Figure 5. Trajectories of offline Neural Barrier controller with confidence interval computed from Thm. 2. The model perturbations are “Time-varying” with different magnitude kk.

Sensitivity Analysis for RaCBF controllers

The RaCBF controller is sensitive to tuning and can lose its safety guarantee when a nonlinear or time-varying residual is not modeled in its knowledge matrix Y(x)Y(\mathbf{x}). Moreover, its performance does not scale with data, as its residual model’s expressiveness is limited. In Figure 6, we examine the effects of gain tuning, prior knowledge Y(x)Y(\mathbf{x}), and data horizon on the HO-RaCBF controller. Figure 6a and Figure 6c compare different choices of Γ\Gamma and Y(x)Y(\mathbf{x}).

Trajectories of the HO-RaCBF controller with different hyperparameters

Figure 6. Trajectories of the HO-RaCBF controller with different hyperparameters. The blue dot represents the initial state, and the red dot represents the current reference. The red cross indicates the collision location. Once the robot collided, the trajectory is depicted in a dashed line.

A Y(x)Y(\mathbf{x}) with prior knowledge leads to more sensitive adaptation in the single-obstacle setting; Adaptation can be achieved in the “Attractive” and “Repulsive” residuals when Γ\Gamma is well tuned. However, in the multiple-obstacle setting, the same choice of Y(x)Y(\mathbf{x}) results in non-convergent residual estimates and destabilizes the controller, regardless of the tuning of Γ\Gamma. More broadly, the control performance is sensitive to the choice of Γ\Gamma: a well-tuned Γ\Gamma (blue) leads to a fast response to the residual model change without overshoot, whereas a large Γ\Gamma (purple) leads to overshoot, and a small Γ\Gamma (green) leads to sluggish adaptation.

In contrast, a Y(x)Y(\mathbf{x}) without prior knowledge results in slower and less accurate adaptation, and safety is violated under all simulated model perturbations in both single- and multiple-obstacle settings. Although a tuned Γ\Gamma (orange) adapts the residual noticeably better than a large or small Γ\Gamma (pink and brown), it still fails to preserve safety. Figure 6b further shows that increasing the data horizon from 0.5s to 1.5s and 10.0s does not improve adaptation, due to the limited expressiveness of the HO-RaCBF controller. In addition, learning from a longer horizon significantly slows the control loop, breaking the required control frequency. These prominent drawbacks—fragility to gain tuning, reliance on carefully chosen prior knowledge to preserve safety (yet sensitive to prior knowledge in different instances), and limited expressiveness and limited scale of data without slowing down control frequency—make HO-RaCBF secondary compared to our approach.

Simulation Quantitative Results

We use the following quantitative evaluation criteria:

  • hmin⁡h_{\min}: the minimum value of h(x)h(\mathbf{x}) during execution.

  • h¬h_{\neg}: the fractional time for which h(x)<0h(\mathbf{x}) < 0 over execution time.

  • Average Distance (Avg.Dist.): the average distance to the obstacle surface over execution time.

  • Average settleDistance (Avg.sDist.): same as Avg.Dist., excluding the first 20s in the simulation execution.

  • CP Coverage (CP Cover.): the fractional time for the true d(x)d(\mathbf{x}) is within its (1−α)(1-\alpha) confidence interval.

In the Table I and Table II, we record the averaged quantitative results from 10 simulation trials. “RCBFs No Res.” stands for the experiments using the Robust HOCBFs controller without simulated dynamics perturbation.

Residual TypeAttractiveRepulsiveTime-varying
Methodhmin⁡h_{\min}h¬h_{\neg}Avg. Dist.Avg. sDist.CP Cover.hmin⁡h_{\min}h¬h_{\neg}Avg. Dist.Avg. sDist.CP Cover.hmin⁡h_{\min}h¬h_{\neg}Avg. Dist.Avg. sDist.CP Cover.
RCBFs No Res.0.020.0%0.040.00100%0.020.0%0.040.00100%0.020.0%0.040.00100%
RCBFs8.310.0%1.611.63100%10.190.0%2.963.08100%5.570.0%1.591.61100%
RaCBFs (Tuned)0.000.0%0.100.00-0.00.0%0.850.0--0.4242.5%0.280.05-
RaCBFs Γ=1\Gamma= 1-0.7394.1%0.210.12-0.870.0%0.350.16--1.4444.3%0.330.19-
RaCBFs Const. YY-0.0291.8%0.040.00-0.020.0%0.050.01--0.5546.7%0.110.07-
Ours Online0.110.0%0.160.0559.36%0.070.0%0.180.0667.29%0.560.0%0.360.1863.91%
Ours Offline0.030.0%0.050.0182.41%0.020.0%0.050.0176.14%0.430.0%0.160.1270.05%
Ours Online States6.260.0%1.101.0979.64%9.10.0%1.451.4382.56%6.660.0%2.622.7197.28%
Ours Offline States6.570.0%1.101.0999.13%8.520.0%1.431.4391.70%9.290.0%2.632.6899.00%

Table I. Quantitative results for different residuals in single-obstacle simulation: Comparison between the baseline controllers and our Neural Barrier controllers (The “HO-” prefix is dropped in all methods due to space limit). The statistics are averaged across 10 trials.

Residual TypeAttractiveRepulsiveTime-varying
Methodhmin⁡h_{\min}h¬h_{\neg}Avg. Dist.Avg. sDist.CP Cover.hmin⁡h_{\min}h¬h_{\neg}Avg. Dist.Avg. sDist.CP Cover.hmin⁡h_{\min}h¬h_{\neg}Avg. Dist.Avg. sDist.CP Cover.
RCBFs No Res.0.040.0%0.340.30100%0.040.0%0.340.30100%0.040.0%0.340.30100%
RCBFs3.030.0%2.442.48100%2.690.0%3.503.65100%2.960.0%1.571.57100%
RaCBFs (Tuned)-0.0431.9%0.350.32-0.060.0%0.340.30--0.3941.4%0.370.34-
RaCBFs Γ=1\Gamma= 1-1.4342.5%0.520.48-1.570.0%0.870.86--0.6114.9%0.550.50-
RaCBFs Know. YY0.010.0%1.580.31-5.460.0%4.9e+099.7e+09-5.440.0%145.41248.92-
Ours Online0.170.0%0.470.3656.91%0.180.0%0.480.3658.04%0.430.0%0.770.5860.36%
Ours Offline0.110.0%0.360.3371.15%0.050.0%0.350.3173.91%0.320.0%0.470.4357.33%
Ours Online States2.850.0%1.251.2769.05%2.750.0%1.791.8271.65%3.070.0%2.913.0397.28%
Ours Offline States5.070.0%1.271.2777.62%5.860.0%1.601.6065.65%7.410.0%3.063.1599.00%

Table II. Quantitative results for different residuals in multi-obstacle simulation: Comparison between the baseline controllers and our Neural Barrier controllers (The “HO-” prefix is dropped in all methods due to space limit). The statistics are averaged across 10 trials.

Among all the metrics, a lower but positive hmin⁡h_{\min} indicates successful adaptation without collision, while a negative hmin⁡h_{\min} stands for collision. A zero h¬h_{\neg} stands for no collision, and a higher h¬h_{\neg} indicates more collisions happen during execution. A lower Avg.Dist. without collision indicates a better adaptation and a less conservative controller; same as Avg.sDist. Our Neural Barrier controller performs consistently across both single- and multi-obstacle instances with the same hyperparameter settings. The Robust HOCBFs controller guarantees safety by using worst-case CBF constraints derived from an online estimate of the residual bound based on observable data. This safety guarantee, however, comes with a cost of the controller being conservative. The HO-RaCBF controller, particularly tuned for each instance, can achieve adaptation in “Attractive” and “Repulsive” experiments but fails to adapt and violates safety in the “Time-varying” experiments, regardless of tuning.

In the “Attractive” and “Repulsive” experiments, the Robust HOCBFs controller leads to the largest Avg.Dist.Avg.Dist. and Avg.sDist.Avg.sDist. among all controllers, for both instances. HO-RaCBF control reduces the controller conservativeness by learning the residual at each control step. Its safety, however, heavily depends on the gain tuning and knowledge matrix Y(x)Y(x). Note that the HO-RaCBFs controller, tuned and kept hyperparameters the same for each instance, preserves safety while reducing the control conservativeness in the “Attractive” and “Repulsive” experiments for the single-obstacle instance, and “Repulsive” experiments for the multi-obstacle instance. It is worth mentioning that the performance of the HO-RaCBF controller degrades without the tuned hyperparameters, leading to significant safety violations in the single-obstacle instance, and fails to converge in the multi-obstacle “Repulsive” experiments. Both our online and offline Neural Barrier controllers using estimated CP intervals successfully preserve safety and adapt residual to reduce controller conservativeness across “Attractive”, “Repulsive”, single- and multi-obstacle instances. The CP coverage achieves near and above the pre-defined 60% confidence interval. A 60% confidence interval is chosen over a wider confidence interval, as a wider confidence interval leads to overly conservative control at the beginning. A 60% confidence interval also sufficiently covers the true residual to significantly reduce the safety violations compared to an HO-RaCBF controller, indicated by hnegh_{\mathrm{neg}}. When applied the CP interval derived in Thm. 2, our controller yields wider CP interval coverage than designed. The “Time-varying” experiments demonstrate the clearest adaptation with safety of our controller. Both our online and offline Neural Barrier controllers exhibit no observed safety violations in these experiments while maintaining small obstacle distances, indicated by hmin⁡h_{\min}, hnegh_{\mathrm{neg}}, Avg.Dist.Avg.Dist. While the robust HOCBFs controller is overly conservative, and the HO-RaCBFs controller violates safety and fails to adapt.

To further illustrate the conservativeness of our controllers, the time series plot of the estimated (1−α)(1-\alpha) quantile Q1−αQ_{1-\alpha} in (26) is depicted in Figure 7. We observe that the confidence interval reduces as the controller sees more data across different simulated residual types and instances, reflecting an improved adaptation over time.

Time series of the estimated quantile of nonconformity scores

Figure 7. (1−α)(1-\alpha) quantile of nonconformity scores sampled in online Neural Barrier controller. For each trial, a polynomial of degree 8 is fitted to all quantile samples, the mean and 95% confidence interval is plotted. The dot on the error bars represents the median, and the ends depict the 25th and 75th percentiles of the quantiles in a 1.33s time window. The statistics are averaged across 10 trials.

Coverage of Conformal Prediction

As we mentioned in Sec. III-C, to provide a valid confidence interval for the true model, the conformal prediction requires training data and calibration data to be exchangeable, which is a strong assumption for the time series we study. Instead, we employ WCP to alleviate such limitations. To validate the efficacy of WCP, we examine its coverage of the true model in its confidence interval. From Table I and Table II CP Coverage metric, we note that the WCP reaches near or above the designed confidence level, i.e., 60%. In Figure 8, we show the time series of the CP Coverage in the single- and multi-obstacle instances. Despite the lack of coverage at the beginning of the experiment, the CP Coverage converges to

Figure 8. The time series of CP Coverage for our online and offline controller in both single- and multi-obstacle instances under different residual types. The statistics are averaged across 10 trials.

the designed level once a moderate size of data, after 1000 samples or equivalently 10s of data, is collected. In practice, we manage this lack of coverage by training the first model with sufficient data. These results verify the efficacy of our CP module under the time series we study and the safety guarantee we present for the Neural Barrier.

In Figure 9, we depict the time series of residual prediction (gray) and its predictive interval (blue) against the ground truth residual model (red) for the xx-velocity. In the left column, the results show the online residual learning performance in the single-obstacle “Attractive”, “Repulsive”, “Time-varying”, multi-obstacle “Attractive”, “Repulsive”, and “Time-varying” experiments, respectively; in the right column, the results show our offline residual learning performance. The results support our conclusion that our online controller has a less accurate model and compensates for it with a wider predictive interval to cover the true residual model at early execution, and improves its prediction accuracy and narrows the predictive interval as it sees more data, leading to a less conservative controller while preserving safety. Our offline model has accurate prediction and maintains a narrow predictive interval during the entire execution.

Ground truth residual dynamics, neural network prediction, and CP predictive interval plots

Figure 9. The ground truth residual dynamics of the xx-velocity dimension (red), the neural network prediction (gray), and the CP predictive interval (blue) plots. On the left column, the plots are online residual learning results in single-obstacle “Attractive”, “Repulsive”, “Time-varying”, multi-obstacle “Attractive”, “Repulsive”, and “Time-varying”, respectively. On the right column, the plots are the offline residual learning results. Only one trial is depicted to demonstrate the exact coverage of our Neural Barrier controller.

Physical Experiments

Physical Experiment Setup

The Crazyflie 2.1 is used as the physical platform to verify our controller. The nano quadrotor weighs 38g with a 300mAh battery. The position of the quadrotor is obtained from the VICON motion capture system at 120Hz. The velocity is estimated using a Kalman filter. The controller and reference generator run at a frequency of 120Hz. We use Crazyswarm [30] to send position, velocity, and acceleration commands to the quadrotor at 100Hz. A laptop with Intel Core Ultra 9 275HX is used as the base station, and communication

with the Crazyflie is established using Crazyradio PA. Three box fans, each with dimensions 0.52m×0.54m0.52\text{m} \times0.54\text{m}, are placed in a row, with their centers at height of 0.7m0.7\text{m}, at 2.72m2.72\text{m} in the positive direction of the xx-axis from the origin. These fans produce wind disturbance that travels at 7.62m/s7.62\text{m/s}. (Their locations and wind direction are depicted in Figure 10). We define a planar figure-eight reference trajectory as

Top views of 150s trajectories using different safety controllers in the physical experiments

Figure 10. The top views of 150s trajectories using different safety controllers in the physical experiments. The red arrows indicate the wind’s location and direction (the length of each arrow represents its strength).

rref(t)=[2.4sin⁡(ωt)1.7sin⁡(ωt)cos⁡(ωt)0.7] m,ω=−0.25 rad/s.(39)\mathbf{r}_{\mathrm{ref}}(t)=\begin{bmatrix}2.4\sin(\omega t)\\1.7\sin(\omega t)\cos(\omega t)\\0.7\end{bmatrix}\,\mathrm{m},\qquad\omega=-0.25\ \mathrm{rad/s}. \tag*{(39)}

The trajectory has a period of approximately 25.13s. Two obstacles are centered at [−1.5m,0m,0.7m][-1.5\text{m},0\text{m},0.7\text{m}] and [1.5m,0m,1m][1.5\text{m},0\text{m},1\text{m}]. The safety controller enforces a minimum horizontal distance of 1m from each obstacle center. Conformal prediction bound is computed in (26). The finite difference in (25) and the neural network prediction of the residual dynamics are noisy due to the noisy estimation of the robot state. To smooth the residual signals, we use the Kalman filter for both d˙\dot{d} and d^\hat{d}.

To capture the wind disturbance, we increase the number of neurons in each layer to 64 in both our online and offline controllers. For the online Neural Barrier controller, we maintain a FIFO training buffer containing up to 7200 samples, corresponding to approximately 60s of online data at a sampling frequency of 120Hz. To enhance control stability, we allow the first neural network to begin training only after sufficient data has been collected. “Online 500” trains the model with at least 500 samples, approximately 4.2s of online data and “Online 2400” trains with at least 2400 samples. Neural adaptation is enabled after the first updated model becomes available. In offline mode, we pre-train the neural network on the collected trajectory. We report the two stages of pre-training: in stage one, the residual model is trained on a 150s trajectory, collected using the Robust HOCBF controller; in stage two, the residual model is fine-tuned with another 150s trajectory, collected using the Neural Barrier controller, whose residual model is trained in stage one. For Conformal Prediction, we select the confidence interval (1−α)=0.9(1-\alpha)=0.9 to prevent collision. The Conformal Prediction bound is computed in (26). We maintain a FIFO calibration buffer containing up to 120 samples, corresponding to approximately 1s of online data, and update at 10Hz to provide an instant safety response. For the HO-RaCBF controller, we use the state-informed matrix Y(x)=[O3×3;r1,0,0;0,r2,0;0,0,r3]Y(\mathbf{x})=[O_{3\times3};r_1,0,0;0,r_2,0;0,0,r_3], denoted as “HO-RaCBF State Y(x)Y(\mathbf{x})”, and a constant matrix Y(x)=[O3×3;I3×3]Y(\mathbf{x})=[O_{3\times3};I_{3\times3}], denoted as “HO-RaCBF Constant $Y(\mathbf{x})”.

Physical Experiment Results

In this section, we present qualitative and quantitative results for our Neural Barrier controller from the physical experiments.

As qualitative results, we depict the representative trajectory for each controller in the physical experiments in Figure 10. Note that the HO-RCBFs controller (Figure 10e) results in an overly conservative trajectory. While the HO-RaCBFs controller (Figure 10b, Figure 10f) adapts to uncertain dynamics, it fails to capture a high-fidelity residual model, causing safety violations when the dynamics change drastically. For our online controllers (Figure 10c, Figure 10g), as the amount of observed data increases, they quickly adapt to wind turbulence, i.e., reduce conservativeness while maintaining the safety guarantee. In our online learning setting, a warm start significantly improves the controller stability at the beginning of the experiment, as shown by the initial trajectory of “Online 2400” being more stable compared to “Online 500”. Our offline controller (Figure 10d, Figure 10h) adapts to wind turbulence out of the box through a pretraining stage, and safety is preserved throughout the experiment.

For the quantitative results, we first present benchmarks against the HO-RCBFs and HO-RaCBFs with our online and offline Neural Barrier controller, as shown in Table III.

Methodhmin⁡h_{\min}h¬h_{\neg}Avg.Dist.Avg.sDist.
RCBFs - No Wind0.070.00%0.130.13
RCBFs0.020.06%0.270.28
RaCBFs State YY-0.1153.14%0.060.06
RaCBFs Const. YY-0.1453.01%0.060.06
Ours Online 500-0.231.43%0.180.17
Ours Online 2400-0.010.38%0.160.16
Ours Offline Stage 1-0.030.41%0.140.14
Ours Offline Stage 2-0.051.38%0.120.12

Table III. Quantitative comparison between the baseline controllers and our controllers (The “HO-” prefix is dropped in all methods due to space limit) in the physical experiments. The statistics are averaged across 5 trials.

Compared to the HO-RCBFs controller, our Neural Barrier controllers significantly reduce the distance to the obstacles, according to Avg.Dist. and Avg.sDist.. Compared to the HO-RaCBFs controller, our Neural Barrier controllers significantly reduce h¬h_{\neg} and bring hmin⁡h_{\min} close to 0, thus improving the safety significantly.

To demonstrate the efficacy of Neural Barrier’s online adaptation during the physical experiment, 5 trials of “Online 2400” results are used as exemplars, for which we show the time series of measured residual, Neural Barrier predicted residual, the absolute value of prediction error between the measured and predicted dynamics residual for the velocity dimension. In addition, we plot the corresponding conformal prediction (1−α)(1-\alpha) quantile, as shown in Figure 11. Note that, with only online learning, the predicted residual closely approximates the measured residual, starting at 35s.

Time series of measured and predicted dynamics residual in the velocity dimension, prediction error, and $(1-\alpha)$ quantile

Figure 11. Time series of measured and predicted dynamics residual in the velocity dimension, prediction error, and (1−α)(1-\alpha) quantile used for RCBF in the “Online 2400” physical experiments. The 95% confidence intervals are over 5 trials.

Conclusion

In this paper, we proposed a learning-enhanced robust adaptive control barrier function that provides a safety guarantee with probabilistic bounds in the presence of uncertain dynamics. The guarantee holds provided that the underlying dynamics model and trajectories satisfy the assumed Lipschitz bounds. We further extended the formulation to high-order control barrier functions to accommodate a broader class of systems. Future work will explore certifiable generative motion planning, where our goal is to integrate the adaptive safety layer in a way to combine the efficiency of learning-based planners with safety guarantees, while avoiding overly conservative motions.

References

  1. [1]L. Pan, K. Hsu, and N. Ayanian, “Hierarchical large scale multirobot path (re) planning,” in 2024 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2024, pp. 5319–5326.arxiv.org/abs/2407.02777
  2. [2]L. Pan, Y. Wang, and N. Ayanian, “Hierarchical trajectory (re) planning for a large scale swarm,” arXiv preprint arXiv:2501.16743, 2025.arxiv.org/abs/2501.16743
  3. [3]K. Black, N. Brown, D. Driess, A. Esmail, M. Equi, C. Finn, N. Fusai, L. Groom, K. Hausman, B. Ichter, S. Jakubczak, T. Jones, L. Ke, S. Levine, A. Li-Bell, M. Muthukuri, S. Nair, K. Pertsch, L. X. Shi, J. Tanner, Q. Vuong, A. Walling, H. Wang, and U. Zhilinsky, “π₀: A vision-language-action flow model for general robot control,” 2026. [Online]. Available: https://arxiv.org/abs/2410.24164
  4. [4]Z. Luo, Y. Yuan, T. Wang, C. Li, F. Castañeda, S. Chen, Z.-A. Cao, J. Li, D. Minor, Q. Ben, et al., “Sonic: Supersizing motion tracking for natural humanoid whole-body control,” Science Robotics, vol. 11, no. 117, p. eaed4592, 2026.DOI
  5. [5]A. D. Ames, J. W. Grizzle, and P. Tabuada, “Control barrier function based quadratic programs with application to adaptive cruise control,” in 53rd IEEE conference on decision and control. IEEE, 2014, pp. 6271–6278.DOI
  6. [6]A. D. Ames, S. Coogan, M. Eggerstedt, G. Notomista, K. Sreenath, and P. Tabuada, “Control barrier functions: Theory and applications,” in 2019 18th European control conference (ECC). IEEE, 2019, pp. 3420–3431.arxiv.org/abs/1903.11199
  7. [7]T. Z. Jiahao, M. A. Hsieh, and E. Forgoston, “Knowledge-based learning of nonlinear dynamics and chaos,” Chaos: An Interdisciplinary Journal of Nonlinear Science, vol. 31, no. 11, 2021.DOI
  8. [8]T. Z. Jiahao, L. Pan, and M. A. Hsieh, “Learning to swarm with knowledge-based neural ordinary differential equations,” in 2022 International conference on robotics and automation (ICRA). IEEE, 2022, pp. 6912–6918.arxiv.org/abs/2109.04927
  9. [9]K. Y. Chee, T. Z. Jiahao, and M. A. Hsieh, “Knode-mpc: A knowledge-based data-driven predictive control framework for aerial robots,” IEEE Robotics and Automation Letters, vol. 7, no. 2, pp. 2819–2826, 2022.arxiv.org/abs/2109.04821
  10. [10]M. O’Connell, G. Shi, X. Shi, K. Azizzadenesheli, A. Anandkumar, Y. Yue, and S.-J. Chung, “Neural-fly enables rapid learning for agile flight in strong winds,” Science Robotics, vol. 7, no. 66, p. eabm6597, 2022.DOI
  11. [11]L. Pan, M. Catellani, T. C. Silva, L. Sabattini, and N. Ayanian, “Online learning-enhanced high order adaptive safety control,” arXiv preprint arXiv:2511.19651, 2025.arxiv.org/abs/2511.19651
  12. [12]A. Taylor, A. Singletary, Y. Yue, and A. Ames, “Learning for safety-critical control with control barrier functions,” in Learning for dynamics and control. PMLR, 2020, pp. 708–717.arxiv.org/abs/1912.10099
  13. [13]J. Choi, F. Castaneda, C. J. Tomlin, and K. Sreenath, “Reinforcement learning for safety-critical control under model uncertainty, using control lyapunov functions and control barrier functions,” arXiv preprint arXiv:2004.07584, 2020.arxiv.org/abs/2004.07584
  14. [14]M. Jankovic, “Robust control barrier functions for constrained stabilization of nonlinear systems,” Automatica, vol. 96, pp. 359–367, 2018.DOI
  15. [15]A. J. Taylor and A. D. Ames, “Adaptive safety with robust control barrier functions,” in 2020 American Control Conference (ACC). IEEE, 2020, pp. 1399–1405.DOI
  16. [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, 2020.DOI
  17. [17]M. Black and D. Panagou, “Safe control design for unknown nonlinear systems with koopman-based fixed-time identification,” IFAC-PapersOnLine, vol. 56, no. 2, pp. 11 369–11 376, 2023.arxiv.org/abs/2212.00624
  18. [18]M. H. Cohen and C. Belťa, “High order robust adaptive control barrier functions and exponentially stabilizing adaptive control lyapunov functions,” in 2022 American Control Conference (ACC). IEEE, 2022, pp. 2233–2238.DOI
  19. [19]A. Isaly, O. S. Patil, R. G. Sancelife, and W. E. Dixon, “Adaptive safety with multiple barrier functions using integral concurrent learning,” in 2021 American Control Conference (ACC). IEEE, 2021, pp. 3719–3724.DOI
  20. [20]Y. Lyu, W. Luo, and J. M. Dolan, “Probabilistic safety-assured adaptive merging control for autonomous vehicles,” in 2021 IEEE International Conference on Robotics and Automation (ICRA), 2021, pp. 10 764–10 770.arxiv.org/abs/2104.14159
  21. [21]L. Yang, B. Werner, R. K. Cosner, D. Fridovich-Keil, P. Culbertson, and A. D. Ames, “Shield: Safety on humanoids via cbfs in expectation on learned dynamics,” in 2025 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2025, pp. 203–210.DOI
  22. [22]H. K. Khalil and J. W. Grizzle, Nonlinear systems. Prentice hall Upper Saddle River, NJ, 2002, vol. 3.
  23. [23]W. Xiao and C. Belta, “High-order control barrier functions,” IEEE Transactions on Automatic Control, vol. 67, no. 7, pp. 3655–3662, 2021.
  24. [24]X. Tan, W. S. Cortez, and D. V. Dimarogonas, “High-order barrier functions: Robustness, safety, and performance-critical control,” IEEE Transactions on Automatic Control, vol. 67, no. 6, pp. 3021–3028, 2021.arxiv.org/abs/2104.00101
  25. [25]V. Vovk, A. Gammerman, and G. Shafer, Algorithmic learning in a random world. Springer, 2005, vol. 29.
  26. [26]R. F. Barber, E. J. Candes, A. Ramdas, and R. J. Tibshirani, “Conformal prediction beyond exchangeability,” The Annals of Statistics, vol. 51, no. 2, pp. 816–845, 2023.arxiv.org/abs/2202.13415
  27. [27]C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals, “Understanding deep learning requires rethinking generalization,” arXiv preprint arXiv:1611.03530, 2016.arxiv.org/abs/1611.03530
  28. [28]T. Z. Jiahao, K. Y. Chee, and M. A. Hsieh, “Online dynamics learning for predictive control with an application to aerial robots,” in Conference on Robot Learning. PMLR, 2023, pp. 2251–2261.arxiv.org/abs/2207.09344
  29. [29]L. Pan, M. Catellani, L. Sabattini, and N. Ayanian, “Robust trajectory generation and control for quadrotor motion planning with field-of-view control barrier certification,” arXiv preprint arXiv:2502.01009, 2025.arxiv.org/abs/2502.01009
  30. [30]J. A. Preiss, W. Honig, G. S. Sukhatme, and N. Ayanian, “Crazyswarm: A large nano-quadcopter swarm,” in IEEE Int Conf Robot Automat. IEEE, 2017, pp. 3299–3304.DOI

Paper details

vlnc:W_y2z5945y
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents