Using Dynamic Safety Margins
as Control Barrier Functions


This paper provides an approach to design control barrier functions (CBFs) using the notion of dynamic safety margins (DSMs). In particular, it is shown that DSMs are CBFs for an augmented system. The proposed approach can handle multiple state and input constraints using the control-sharing property of CBFs. Moreover, it makes no assumption on the relative degree of the constraints. Numerical simulations show that the method outperforms existing DSM-based approaches, while also guaranteeing safety and recursive feasibility.

1 Introduction↩︎

Control barrier functions (CBFs) have become a popular tool for deriving constrained control laws that are safe, easy to implement, and achieve good performance [1][4]. Despite their success, the widespread use of CBFs is limited by the absence of a systematic method to synthesize them for general classes of systems given arbitrary state and input constraints.

In [5], the authors study the relationship between the CBF-condition, input constraints, and the CBF decay rate to guarantee pointwise feasibility. However, their approach does not guarantee recursive feasibility. In [6], the authors design CBFs for Euler–Lagrange systems. While the results are promising and the class of systems is relevant, the approach is limited to box constraints. In [7], the authors use a backup control policy to enlarge a small (but easy to find) control invariant set. The enlarged control invariant set is then used to derive a “backup” CBF. These backup CBFs rarely have closed form, which makes them difficult to implement. In [8], the authors use maximal output admissible sets (MOASs) to design discrete-time CBFs for arbitrary state and input constraints. While the approach works well for linear systems, finding the MOAS for nonlinear systems remains an open question.

This work expands the underlying theme of [7], [8], where CBFs are obtained starting from a prestabilizing (or backup) controller. To do this, we adopt the notion of dynamic safety margin (DSM) from the explicit reference governor (ERG) framework [9]. In particular, we show that DSMs are CBFs for the augmented system that includes the reference of the prestabilizing controller as a state. To address multiple constraints, we also show that DSMs have the control-sharing property [10] if they share the same prestabilizing controller. The main advantage of this analysis is that it enables the synthesis of CBFs using established tools from the ERG framework [9], [11][13]. Numerical simulations show that the DSM-based CBFs outperform the ERG, while boasting strict safety guarantees that are otherwise lost when the CBF is chosen incorrectly.

Notation: Throughout the paper, only vector quantities are presented in bold font: \(\boldsymbol{\mathbf{x}} \in \mathbb{R}^n\). The notation \([\boldsymbol{\mathbf{x}};~\boldsymbol{\mathbf{y}}]\) denotes the vertical stacking of two vectors \(\boldsymbol{\mathbf{x}}\) and \(\boldsymbol{\mathbf{y}}\) into a column vector. A continuous function \(\alpha:[0,\infty) \to [0,\infty)\) is said to belong to class \(K_{\infty}\) if it is strictly increasing, \(\alpha(0) = 0\), and \(\lim_{r\to\infty} \alpha(r) = \infty\).

2 Preliminaries↩︎

This section recalls the notion of control barrier functions and dynamic safety margins. Consider a nonlinear time-invariant system in the form \[\label{eq:sys} \dot{\boldsymbol{\mathbf{x}}} = f(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{u}}),\tag{1}\] where \(f:\mathcal{D}_x\times\mathcal{D}_u\to\mathbb{R}^n\) is a locally Lipschitz continuous function defined on the open domains \(\mathcal{D}_x\subseteq\mathbb{R}^n\) and \(\mathcal{D}_u\subseteq\mathbb{R}^m\). The system is subject to state \(\boldsymbol{\mathbf{x}} \in \mathcal{X}\) and input \(\boldsymbol{\mathbf{u}}\in\mathcal{U}\) constraints, where \(\mathcal{X}\subseteq\mathcal{D}_x\) and \(\mathcal{U}\subseteq\mathcal{D}_u\) are closed sets.

Assumption 1. System 1 admits a simply connected equilibrium manifold parameterized by continuous functions \(\bar{x}:\mathcal{D}_r\to\mathcal{D}_x\) and \(\bar{u}:\mathcal{D}_r\to\mathcal{D}_u\) such that \[f\big(\bar x(\boldsymbol{\mathbf{r}}),\bar u(\boldsymbol{\mathbf{r}})\big) = 0,\quad \forall \boldsymbol{\mathbf{r}}\in\mathcal{D}_r,\] where \(\mathcal{D}_r\subseteq\mathbb{R}^l\) is an open domain. Moreover, every equilibrium point \(\bar x(\boldsymbol{\mathbf{r}})\) is stabilizable.

The vector \(\boldsymbol{\mathbf{r}}\in\mathcal{D}_r\) is hereafter referred to as a “reference” for the system because it identifies a specific equilibrium point. The induced set of steady-state admissible references is \[\mathcal{R}=\{\boldsymbol{\mathbf{r}}\in\mathcal{D}_r~|~\bar x(\boldsymbol{\mathbf{r}})\in\mathcal{X},~\bar{u}(\boldsymbol{\mathbf{r}})\in\mathcal{U}\}.\] Note that, since \(\bar{x}\), \(\bar{u}\) are continuous and \(\mathcal{X}\), \(\mathcal{U}\) are closed sets, \(\mathcal{R}\) is closed in \(\mathcal{D}_r\).

Assumption 2. The set \(\mathcal{R}\subseteq\mathcal{D}_r\) is not empty, i.e., system 1 features steady-state admissible equilibria.

2.1 Control Barrier Functions↩︎

Control barrier functions are real-valued functions that certify the control invariance [14] of their zero-superlevel set.

Definition 1. [1] A continuously differentiable function \(h: \mathcal{D}_x \to \mathbb{R}\) is a control barrier function* (CBF) if there exists a class \(K_{\infty}\) function \(\alpha:[0,\infty) \to [0,\infty)\) such that \[\label{eq:cbf-cond} \sup_{\boldsymbol{\mathbf{u}}\in \mathcal{U}} \left[\dot{h}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{u}})\right] \geq -\alpha\big(h(\boldsymbol{\mathbf{x}})\big), \quad \forall \boldsymbol{\mathbf{x}} \in \mathcal{C},\tag{2}\] where \(\dot{h}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{u}}) = \frac{\partial h}{\partial \boldsymbol{\mathbf{x}}} f(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{u}})\), and \[\label{eq:setC} \mathcal{C}= \{\boldsymbol{\mathbf{x}} \in \mathcal{D}_x \mid h(\boldsymbol{\mathbf{x}}) \geq 0\}.\tag{3}\] *

Lemma 1. [1] The set \(\mathcal{C}\subseteq \mathcal{D}_x\) given in 3 is control invariant if and only if \(h(\boldsymbol{\mathbf{x}})\) is a CBF.

CBFs are used to design add-on modules that enforce constraint satisfaction by filtering the control input. Specifically, let \(\kappa:\mathcal{D}_x \to \mathcal{D}_u\) be a nominal control policy with desirable closed-loop performance. Then, given a CBF \(h\) such that \(\mathcal{C}\subseteq \mathcal{X}\), the safety goal can be achieved with an optimization-based control policy \(\beta:\mathcal{C}\to \mathcal{U}\) defined as \[\label{eq:beta} \beta (\boldsymbol{\mathbf{x}}) = \underset{\boldsymbol{\mathbf{u}} \in \mathcal{K}(\boldsymbol{\mathbf{x}})}\mathop{\mathrm{argmin}}\:\|\boldsymbol{\mathbf{u}}-\kappa(\boldsymbol{\mathbf{x}})\|^2,\tag{4}\] where \[\mathcal{K}(\boldsymbol{\mathbf{x}}) = \{\boldsymbol{\mathbf{u}}\in \mathcal{U}\mid \dot{h}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{u}}) + \alpha\big(h(\boldsymbol{\mathbf{x}})\big) \geq 0\}.\] Since \(\mathcal{K}(\boldsymbol{\mathbf{x}}) \neq \emptyset\), \(\forall \boldsymbol{\mathbf{x}}\in \mathcal{C}\), the optimization problem 4 is always feasible, which makes \(\beta\) a well-defined function.

As noted in the introduction, finding a CBF for arbitrary constraint sets \(\mathcal{X}\subseteq \mathcal{D}_x\) is a challenging task. In fact, Lemma 1 states that a CBF \(h\) satisfying Definition 1 with \(\mathcal{C}= \mathcal{X}\) exists only if \(\mathcal{X}\) is control invariant (which is generally not the case). In spite of this, many practitioners insist on imposing \(\mathcal{C}= \mathcal{X}\) to construct a “candidate” CBF (i.e. a function that satisfies 3 , but may not satisfy 2 ) and then tuning the class \(K_{\infty}\) function \(\alpha\) on a case-by-case basis. Although this approach can yield good performance, it suffers from the fact that \(\exists \boldsymbol{\mathbf{x}} \in \mathcal{X}\) such that \(\mathcal{K}(\boldsymbol{\mathbf{x}}) = \emptyset\), which makes the controller \(\beta\) ill-defined.

In this paper, we leverage results from the ERG framework to design a valid CBF that satisfies Definition 1 using a control invariant subset \(\mathcal{C}\subseteq \mathcal{X}\).

2.2 Dynamic Safety Margins↩︎

Dynamic safety margins are real-valued functions that quantify the distance to constraint violation for a prestabilized system subject to a constant reference.

Recalling Assumption 1, let \(\pi:\mathcal{D}_x \times \mathcal{D}_r \to \mathcal{D}_u\), locally Lipschitz continuous on \(\mathcal{D}_x\) and continuous on \(\mathcal{D}_r\), be a prestabilizing control law such that \(\bar{x}(\boldsymbol{\mathbf{r}})\) is an asymptotically stable equilibrium point of the prestabilized system \[\dot{\boldsymbol{\mathbf{x}}} = f\big(\boldsymbol{\mathbf{x}}, \pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}})\big) = f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}).\] Given a reference \(\boldsymbol{\mathbf{r}} \in \mathcal{D}_r\), the prestabilized dynamics \(f_{\pi}\) ensure the existence of a closed set \(\mathcal{E}_{\boldsymbol{\mathbf{r}}}\subseteq\mathcal{D}_x\) that satisfies \(\bar{x}(\boldsymbol{\mathbf{r}}) \in \mathop{\mathrm{Int}}\left(\mathcal{E}_{\boldsymbol{\mathbf{r}}}\right)\) and is such that \[\boldsymbol{\mathbf{x}}(0) \in\mathcal{E}_{\boldsymbol{\mathbf{r}}} \implies \lim_{t \to \infty} \boldsymbol{\mathbf{x}}(t) = \bar{x}(\boldsymbol{\mathbf{r}}).\]

Note that, for each reference \(\boldsymbol{\mathbf{r}} \in \mathcal{D}_r\), the input constraint set \(\mathcal{U}\) induces state constraints on the prestabilized system. This property can be taken into account by defining the reference-dependent state constraint set \[\label{eq:Xr} \mathcal{X}_{\boldsymbol{\mathbf{r}}} = \{\boldsymbol{\mathbf{x}} \in \mathcal{X}\cap \mathcal{E}_{\boldsymbol{\mathbf{r}}} \mid \pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}})\in\mathcal{U}\}.\tag{5}\] By continuity of \(\pi\) on \(\mathcal{D}_r\), it follows that \(\mathcal{X}_{\boldsymbol{\mathbf{r}}}\) is closed in \(\mathcal{D}_x\). Given \(f_\pi\) and \(\mathcal{X}_{\boldsymbol{\mathbf{r}}}\), the following DSM definition satisfies the one featured in [9], although it makes stronger assumption by requiring a) differentiability rather than continuity and b) invariance rather than strong returnability.

Definition 2. A continuously differentiable function \(\Delta: \mathcal{D}_x \times \mathcal{D}_r \to \mathbb{R}\) is a dynamic safety margin* (DSM) if: \[\begin{align} \boldsymbol{\mathbf{r}} \in \mathcal{R}~ &\implies ~ \Delta\big(\bar{x}(\boldsymbol{\mathbf{r}}),\boldsymbol{\mathbf{r}}\big) \geq 0 \tag{6}\\ \Delta(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{r}}) \geq 0 ~ &\implies ~ \boldsymbol{\mathbf{x}} \in \mathcal{X}_{\boldsymbol{\mathbf{r}}} \tag{7}\\ \Delta(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{r}}) = 0 ~ &\implies ~ \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}}f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) \geq 0 \tag{8} \end{align}\] *

Lemma 2. If \(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) \geq 0\), then \(\boldsymbol{\mathbf{r}} \in \mathcal{R}\).

Proof. Let \((\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) \in \mathcal{D}_{x}\times \mathcal{D}_r\) be such that \(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}})\geq 0\). Given the initial conditions \(\boldsymbol{\mathbf{x}}(0) = \boldsymbol{\mathbf{x}}\), let \(\dot{\boldsymbol{\mathbf{x}}}(t) = f_{\pi}\big(\boldsymbol{\mathbf{x}}(t),\boldsymbol{\mathbf{r}}\big)\). Then, it follows from the continuity of \(\Delta\) and condition \(3\) that \(\Delta\big(\boldsymbol{\mathbf{x}}(t), \boldsymbol{\mathbf{r}}\big) \geq 0\). Therefore, by condition 7 , \(\boldsymbol{\mathbf{x}}(t) \in \mathcal{X}_{\boldsymbol{\mathbf{r}}} \subseteq \mathcal{E}_{\boldsymbol{\mathbf{r}}}\) for all \(t \geq 0\). Taking the limit as \(t \to \infty\), we obtain \[\lim_{t \to \infty} \boldsymbol{\mathbf{x}}(t) = \bar{x}(\boldsymbol{\mathbf{r}}) \in \mathcal{X}_{\boldsymbol{\mathbf{r}}}.\] Therefore, \(\boldsymbol{\mathbf{r}} \in \mathcal{R}\). ◻

DSMs are used to design add-on modules that enforce constraint satisfaction by filtering the reference of the prestabilized system. Specifically, let \(\boldsymbol{\mathbf{v}} \in \mathcal{D}_r\) be a “virtual reference” for the prestabilized system and let \(\rho:\mathcal{D}_r \to \mathbb{R}^l\) be a navigation field [9] that steers \(\boldsymbol{\mathbf{v}}(t)\) to the target reference \(\boldsymbol{\mathbf{r}} \in \mathcal{D}_r\). Then, the ERG framework [9] ensures that the governed system \[\begin{bmatrix} \dot{\boldsymbol{\mathbf{x}}}\\ \dot{\boldsymbol{\mathbf{v}}} \end{bmatrix} = \begin{bmatrix} f_{\pi}(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{v}}) \\ \Delta(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{v}})\rho(\boldsymbol{\mathbf{v}}) \end{bmatrix},\] satisfies \(\boldsymbol{\mathbf{x}}(t) \in \mathcal{X}_{\boldsymbol{\mathbf{v}}(t)}\) at all times. The ERG literature provides systematic tools for computing DSMs for various classes of systems [9], [11][13]. The following section shows how to port DSMs into the CBF framework.

3 From Dynamic Safety Margins \(\qquad\)to Control Barrier Functions↩︎

Based on the intuition that both CBFs and DSMs can be used to design add-on modules for constraint handling, the following theorem states that a dynamic safety margin is, in fact, a CBF for an augmented system consisting of the concatenation of \(\boldsymbol{\mathbf{x}}\in \mathbb{R}^n\) and \(\boldsymbol{\mathbf{v}}\in\mathbb{R}^l\).

Theorem 1 (DSMs are CBFs). Consider the augmented system \[\label{eq:sys-dsm} \begin{bmatrix} \dot{\boldsymbol{\mathbf{x}}} \\ \dot{\boldsymbol{\mathbf{v}}} \end{bmatrix} = \begin{bmatrix} f(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{u}}) \\ \boldsymbol{\mathbf{\rho}} \end{bmatrix},\qquad{(1)}\] where \((\boldsymbol{\mathbf{u}}, \boldsymbol{\mathbf{\rho}}) \in\mathcal{D}_u \times \mathbb{R}^l\) are the augmented inputs. Then, a dynamic safety margin \(\Delta: \mathcal{D}_x \times \mathcal{D}_r \to \mathbb{R}\) is a control barrier function, with zero-superlevel set \[\label{eq:setC-dsm} \mathcal{C}= \{(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{v}}) \in \mathcal{D}_x \times \mathcal{D}_r \mid \Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \geq 0\} \subseteq \mathcal{X}\times \mathcal{R}.\qquad{(2)}\]

Proof. Define \(\hat{\alpha}: [0,\infty) \to \mathbb{R}\) as \[\hat{\alpha}(c) = - \inf_{\{(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\:\mid\: 0 \leq \Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \leq c\}} \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}} f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\] Clearly, \(\hat{\alpha}\) is nondecreasing. Furthermore, by definition of \(\Delta\), \(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})= 0\) implies \(\frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}}f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \geq 0\). Therefore, \(\hat{\alpha}(0) \leq 0\). This property is sufficient to ensure the existence of a class \(K_{\infty}\) function \(\alpha: [0,\infty) \to [0,\infty)\) that upper-bounds \(\hat{\alpha}\).

Let \((\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{v}}) \in \mathcal{C}\). By definition of \(\mathcal{C}\), \(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \geq 0\), which implies \(\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \in \mathcal{U}\). Consider the pair \(\big(\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}), 0\big) \in \mathcal{U}\times \mathbb{R}^l\) and note that \[\frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}} f\big(\boldsymbol{\mathbf{x}},\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\big) + \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{v}}} 0 = \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}} f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \geq -\hat{\alpha}\left(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\right).\] It then follows that, \(\forall (\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \in \mathcal{C}\), \[\sup_{(\boldsymbol{\mathbf{u}}, \boldsymbol{\mathbf{\rho}}) \in \mathcal{U}\times \mathbb{R}^l} \left[\frac{\partial \Delta}{ \partial \boldsymbol{\mathbf{x}}} f(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{u}}) + \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{v}}} \boldsymbol{\mathbf{\rho}}\right] \geq - \alpha\big(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\big).\] Therefore, \(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\) is a CBF. ◻

Thanks to this result, it is possible to reformulate the CBF policy \(\beta\) for the augmented system \((\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\). To do so, define the augmented set of admissible inputs \[\label{eq:InputSet} \mathcal{K}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) = \{(\boldsymbol{\mathbf{u}},\boldsymbol{\mathbf{\rho}})\in\mathcal{U}\times \mathbb{R}^l \mid \dot{\Delta} + \alpha\big(\Delta(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{v}})\big) \geq 0\},\tag{9}\] where \[\dot{\Delta}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}},\boldsymbol{\mathbf{u}}, \boldsymbol{\mathbf{\rho}}) = \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}} f(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{u}}) + \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{v}}} \boldsymbol{\mathbf{\rho}}.\] Let \(\kappa:\mathcal{D}_x \to \mathcal{D}_u\) be a nominal control policy with desirable closed-loop performance and let \(\rho:\mathcal{D}_r \to \mathbb{R}^l\) be a navigation field for the virtual reference \(\boldsymbol{\mathbf{v}}\). The following theorem states that constraint satisfaction can be guaranteed by using the DSM to filter both inputs.

Theorem 2 (DSM-CBF policy). Let \(\Delta\) be a DSM and let \(\mathcal{C}\) be the set given in ?? . Then, given a scalar \(\eta \geq 0\), the optimization-based policy \(\beta:\mathcal{C}\to \mathcal{U}\times \mathbb{R}^l\) given by \[\label{eq:beta-dsm} \beta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) = \underset{(\boldsymbol{\mathbf{u}},\boldsymbol{\mathbf{\rho}}) \in \mathcal{K}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})}\mathop{\mathrm{argmin}}\|\boldsymbol{\mathbf{u}}-\kappa(\boldsymbol{\mathbf{x}})\|^2 + \eta \| \boldsymbol{\mathbf{\rho}} - \rho(\boldsymbol{\mathbf{v}})\|^2,\qquad{(3)}\] is well-defined and ensures that the trajectory of the augmented system ?? satisfies \(\boldsymbol{\mathbf{x}}(t) \in \mathcal{X}\) and \(\boldsymbol{\mathbf{v}}(t) \in \mathcal{R}\) for all \(t\geq 0\), given \(\big(\boldsymbol{\mathbf{x}}(0),\boldsymbol{\mathbf{v}}(0)\big) \in \mathcal{C}\).

Proof. By Theorem 1, \(\Delta\) is a CBF and, \(\forall (\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \in \mathcal{C}\), the set \(\mathcal{K}(\boldsymbol{\mathbf{x,\boldsymbol{\mathbf{v}}}}) \neq \emptyset\). So, the map \(\beta\) is well-defined. Safety follows immediately because the condition \[\frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}} f(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{u}}) + \frac{\partial \Delta}{\partial \boldsymbol{\mathbf{v}}} \boldsymbol{\mathbf{\rho}} \geq - \alpha\big(\Delta(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{v}})\big),\] ensures invariance of \(\mathcal{C}\subseteq \mathcal{X}\times \mathcal{R}\) for the dynamics ?? with input \((\boldsymbol{\mathbf{u}},\boldsymbol{\mathbf{\rho}}) = \beta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\). ◻

Remark 1. It is worth noting that constraint enforcement is guaranteed even when \(\eta=0\). However, choosing \(\eta > 0\) makes the cost function ?? strongly convex, which can be beneficial depending on the solver.

Remark 2. Although the set \(\mathcal{K}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\) is generally not convex, if the system is control-affine i.e., \(f(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{u}}) = f_0(\boldsymbol{\mathbf{x}}) + g(\boldsymbol{\mathbf{x}})\boldsymbol{\mathbf{u}}\), and the input constraint set \(\mathcal{U}\) is polyhedral, the optimization problem ?? becomes a quadratic program (QP) for all \((\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \in \mathcal{C}\), which can be solved efficiently.

Remark 3. If \(\mathcal{R}\) is convex, a suitable navigation field is \(\rho(\boldsymbol{\mathbf{v}})=\boldsymbol{\mathbf{r}}-\boldsymbol{\mathbf{v}}\). Otherwise, please refer to works like [15].

Remark 4. The proposed approach can be interpreted as a closed-form variant of the backup CBF [7]. The approach assigns a safe control input \(\boldsymbol{\mathbf{u}}\) while simultaneously generating a safe reference \(\boldsymbol{\mathbf{v}}\) for the backup controller \(\pi\).

4 Control-sharing Property↩︎

Often, the sets \(\mathcal{X}\) and \(\mathcal{U}\) are the intersection of multiple state and input constraints. In these cases, it is easier to design a separate CBF for each constraint and then enforce all the CBF conditions in the CBF-based program. Unfortunately, there is typically no guarantee that feasibility is retained when all constraints are superimposed. This section shows that DSMs designed for the same prestabilized system have the control-sharing property [10], which makes their CBF conditions compatible.

Given \(q \in \mathbb{N}\) distinct CBFs \(h_i: \mathcal{D}_x \to \mathbb{R}\) and their associated control invariant sets \(\mathcal{C}_i = \{\boldsymbol{\mathbf{x}} \in \mathcal{D}_x \mid h_i(\boldsymbol{\mathbf{x}})\geq 0\}\), define the \(i\)-th set of safe inputs as \[\mathcal{K}_i(\boldsymbol{\mathbf{x}}) = \left\{\boldsymbol{\mathbf{u}} \in \mathcal{U}~\bigg| ~ \frac{\partial h_i}{\partial \boldsymbol{\mathbf{x}}}f(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{u}}) + \alpha_i\big(h_i(\boldsymbol{\mathbf{x}})\big) \geq 0\right\},\] where each \(\alpha_i\) is a class \(K_{\infty}\) function that satisfies Definition 1 for \(h_i\). Since \(\forall i \in \{1,\ldots, q\}\), \(h_i\) is a CBF, it follows by definition that \[\forall i \in \{1,\ldots, q\}, \quad \boldsymbol{\mathbf{x}} \in \mathcal{C}_i \implies \mathcal{K}_i(\boldsymbol{\mathbf{x}}) \neq \emptyset.\] However, there is generally no guarantee that the intersection \(\bigcap_{i = 1}^q \mathcal{K}_i(\boldsymbol{\mathbf{x}})\) is nonempty.

Definition 3. [10] Consider \(q \in \mathbb{N}\) CBFs \(h_i:\mathcal{D}_x \to \mathbb{R}\). These CBFs are said to have the control-sharing property* if \[\boldsymbol{\mathbf{x}} \in \bigcap_{i = 1}^q \mathcal{C}_i ~\implies~ \bigcap_{i = 1}^q \mathcal{K}_{i}(\boldsymbol{\mathbf{x}}) \neq \emptyset.\]*

If the CBFs \(h_i\) have the control-sharing property, then the optimization-based control policy \(\beta\) defined in 4 with \[\mathcal{C}= \bigcap_{i = 1}^q \mathcal{C}_i, \quad \mathcal{K}(\boldsymbol{\mathbf{x}}) = \bigcap_{i = 1}^q \mathcal{K}_{i}(\boldsymbol{\mathbf{x}}),\] is feasible for all \(\boldsymbol{\mathbf{x}} \in \mathcal{C}\) and ensures \(\boldsymbol{\mathbf{x}}(t) \in \mathcal{C}\) for all \(t \geq 0\).

Now, suppose we have \(q \in \mathbb{N}\) closed constraint sets \(\mathcal{X}_i \subseteq \mathcal{D}_x\) and \(\mathcal{U}_i \subseteq \mathcal{D}_u\) such that \(\mathcal{X}\times \mathcal{U}\subseteq \mathcal{X}_i \times \mathcal{U}_i, ~\forall i \in \{1,\ldots,q\},\) and \(\bigcap_{i= 1}^q \mathcal{X}_i \times \mathcal{U}_i = \mathcal{X}\times \mathcal{U}\). The \(i\)-th steady state admissible set is \(\mathcal{R}_i =\{\boldsymbol{\mathbf{r}} \in \mathcal{D}_r \mid \bar{x}(\boldsymbol{\mathbf{r}}) \in \mathcal{X}_i, ~\bar{u}(\boldsymbol{\mathbf{r}}) \in \mathcal{U}_i \}\) and note that \(\bigcap_{i =1}^{q} \mathcal{R}_i = \mathcal{R}\). Assume also that \(\Delta_i:\mathcal{D}_x \times \mathcal{D}_r \to \mathbb{R}\) is a dynamic safety margin for \(f_{\pi}\) with respect to the constraint sets \(\mathcal{X}_i \times \mathcal{U}_i\). The following theorem shows that DSMs obtained using a shared prestabilizing control policy \(\pi\) always have the control-sharing property.

Theorem 3 (DSMs are control-sharing CBFs). If, for each \(i \in \{1,\ldots, q\}\) and \(\forall c \in [0,\infty)\), \[\label{eq:classK-cond} \alpha_i(c) \geq - \inf_{\{(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \mid 0 \leq \Delta_i(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \leq c\}} \frac{\partial \Delta_i}{ \partial \boldsymbol{\mathbf{x}}} f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \triangleq \hat{\alpha}_i(c),\qquad{(4)}\] then the DSMs \(\Delta_i(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\) have the control-sharing property.

Proof. By assumption, there exists \(\boldsymbol{\mathbf{r}} \in \mathcal{R}\neq \emptyset\). Furthermore, for all \(i \in \{1,\ldots,q\}\), \(\Delta_i\big(\bar{x}(\boldsymbol{\mathbf{r}}), \boldsymbol{\mathbf{r}}\big) \geq 0\) by definition because \(\boldsymbol{\mathbf{r}} \in \mathcal{R}_i\) for all \(i \in \{1,\ldots,q\}\). Thus, \(\big(\bar{x}(\boldsymbol{\mathbf{r}}),\boldsymbol{\mathbf{r}}\big) \in \bigcap_{i = 1}^q \mathcal{C}_i \neq \emptyset\).

By Theorem 1, \(\Delta_i\) is a CBF. Thus, the corresponding \(\mathcal{K}_{i}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\) satisfying 9 is nonempty. Let \((\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \in \bigcap_{i = 1}^q \mathcal{C}_i\) and note that \(\forall i \in \{1,\ldots,q\}\), \(\Delta_i(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \geq 0\). By definition of \(\Delta_i\), this implies that \(\forall i \in \{1,\ldots,q\}\), \(\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \in \mathcal{U}_i\). Thus, \(\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \in \bigcap_{i = 1}^q \mathcal{U}_i = \mathcal{U}\). Now, consider the pair \(\big(\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}), 0\big) \in \mathcal{U}\times \mathbb{R}^l\) and note that \[\frac{\partial \Delta_i}{\partial \boldsymbol{\mathbf{x}}}f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) + \frac{\partial \Delta_i}{\partial \boldsymbol{\mathbf{v}}}0 \geq -\hat{\alpha}_i\big(\Delta_i(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\big) \geq -\alpha_i\big(\Delta_i(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\big),\] which implies \(\big(\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}),0\big) \in \mathcal{K}_i(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\). Since \(i\) was arbitrary, \(\big(\pi(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}),0\big) \in \bigcap_{i=0}^q\mathcal{K}_i(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}})\), making it a nonempty set. ◻

Remark 5. The next section provides a specific method for constructing DSMs for which the conditions of Theorem 3 are trivially satisfied by any class \(K_{\infty}\) function.

5 Lyapunov-based Dynamic Safety Margins↩︎

This section shows that the Lyapunov-based DSMs in [9], [11][13] can be used within the context of this paper. Let the continuously differentiable function \(V:\mathcal{D}_x\times \mathcal{D}_r \to [0,\infty)\) be a reference-dependent Lyapunov function for the prestabilized system \(f_{\pi}\). That is, for all \(\boldsymbol{\mathbf{r}} \in \mathcal{D}_r\), \[\tag{10} \begin{align} V\big(\bar{x}(\boldsymbol{\mathbf{r}}),\boldsymbol{\mathbf{r}}\big) &= 0,\\ V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) &> 0, \quad \forall \boldsymbol{\mathbf{x}} \in \mathcal{D}_x \setminus \{\bar{x}(\boldsymbol{\mathbf{r}})\}, \\ \frac{\partial V}{\partial \boldsymbol{\mathbf{x}}}f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) & \leq 0, \quad \forall \boldsymbol{\mathbf{x}} \in \mathcal{E}_{\boldsymbol{\mathbf{r}}},\tag{11} \end{align}\] where \(\mathcal{E}_{\boldsymbol{\mathbf{r}}} \subseteq \mathcal{D}_x\) is a closed sub-level set of \(V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}})\). We say \(V:\mathcal{D}_x \times \mathcal{D}_r \to [0,\infty)\) is monotonically increasing over \(\mathcal{D}_x\), if it satisfies \[\forall \boldsymbol{\mathbf{r}}\in \mathcal{D}_r, \qquad \frac{\partial V}{\partial \boldsymbol{\mathbf{x}}} = 0 ~\iff~ \boldsymbol{\mathbf{x}} = \bar{x}(\boldsymbol{\mathbf{r}}).\] Moreover, given \(\mathcal{X}_{\boldsymbol{\mathbf{r}}}\) in 5 , let \(\mathcal{X}^c_{\boldsymbol{\mathbf{r}}} = \mathcal{D}_x \setminus \mathcal{X}_{\boldsymbol{\mathbf{r}}}\) be the set of unsafe states and let \(\Gamma^*: \mathcal{D}_r \to [0,\infty)\) be defined as \[\label{eq:threshold} \Gamma^*(\boldsymbol{\mathbf{r}}) \triangleq \begin{cases} \underset{\boldsymbol{\mathbf{x}} \in\: \mathcal{X}^c_{\boldsymbol{\mathbf{r}}}}\inf V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}), & \mathcal{X}^c_{\boldsymbol{\mathbf{r}}} \neq \emptyset, \\ \infty, & \mathcal{X}^c_{\boldsymbol{\mathbf{r}}} = \emptyset. \end{cases}\tag{12}\] Intuitively, \(\Gamma^*(\boldsymbol{\mathbf{r}})\) represents the largest admissible (or safe) level set of the Lyapunov function \(V\) at reference \(\boldsymbol{\mathbf{r}}\).

Theorem 4 (Lyapunov-based DSMs). Let \(V\) be monotonically increasing and let \(\Gamma: \mathcal{D}_r \to [0,\infty)\) be a continuously differentiable function that satisfies \(\Gamma(\boldsymbol{\mathbf{r}}) \leq \Gamma^*(\boldsymbol{\mathbf{r}})\) for all \(\boldsymbol{\mathbf{r}} \in \mathcal{R}\). Then, \[\label{eq:LyapDSM} \Delta(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{r}}) = \Gamma(\boldsymbol{\mathbf{r}}) - V(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{r}})\qquad{(5)}\] is a dynamic safety margin.

Proof. To prove property 6 in Definition 2, let \(\boldsymbol{\mathbf{r}} \in \mathcal{R}\). Then, \(\Delta\big(\bar{x}(\boldsymbol{\mathbf{r}}),\boldsymbol{\mathbf{r}}\big) = \Gamma(\boldsymbol{\mathbf{r}}) - V\big(\bar{x}(\boldsymbol{\mathbf{r}}),\boldsymbol{\mathbf{r}}\big) = \Gamma(\boldsymbol{\mathbf{r}}) \geq 0\).

To prove property 7 , let \((\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{r}}) \in \mathcal{D}_x \times \mathcal{D}_r\) be such that \(\Delta(\boldsymbol{\mathbf{x}}, \boldsymbol{\mathbf{r}}) \geq 0\). For a contradiction, assume \(\boldsymbol{\mathbf{x}} \notin \mathcal{X}_{\boldsymbol{\mathbf{r}}}\) or, equivalently, \(\boldsymbol{\mathbf{x}} \in \mathcal{X}^c_{\boldsymbol{\mathbf{r}}}\). This implies that \(\Gamma^*(\boldsymbol{\mathbf{r}}) \leq V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}})\) by definition of \(\Gamma^*\). However, \(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) \geq 0\) implies that \[\Gamma^*(\boldsymbol{\mathbf{r}}) \leq V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}})\leq \Gamma(\boldsymbol{\mathbf{r}}) \leq \Gamma^*(\boldsymbol{\mathbf{r}}).\] So, we must have \(\Gamma(\boldsymbol{\mathbf{r}}) = V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) = \Gamma^*(\boldsymbol{\mathbf{r}})\). Recall that, by Lemma 2, \(\boldsymbol{\mathbf{r}} \in \mathcal{R}\). If \(V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) = 0\), then \(\boldsymbol{\mathbf{x}} = \bar{x}(\boldsymbol{\mathbf{r}}) \in \mathcal{X}_{\boldsymbol{\mathbf{r}}}\) and we have a contradiction. Otherwise, if \(\Gamma^*(\boldsymbol{\mathbf{r}}) = V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) > 0\), recall that \(\mathcal{X}^c_{\boldsymbol{\mathbf{r}}}\) is open in \(\mathcal{D}_x\) because \(\mathcal{X}_{\boldsymbol{\mathbf{r}}}\) is closed in \(\mathcal{D}_x\). Therefore, there exists an open neighborhood \(\mathcal{N}\subset \mathcal{X}^c_{\boldsymbol{\mathbf{r}}}\) such that \(\boldsymbol{\mathbf{x}} \in \mathcal{N}\). Furthermore, since \(\boldsymbol{\mathbf{x}} \neq \bar{x}(\boldsymbol{\mathbf{r}})\), we have that \(\frac{\partial V}{\partial \boldsymbol{\mathbf{x}}} \neq 0\). So, there exists a sufficiently small scalar \(\lambda > 0\) such that \(\boldsymbol{\mathbf{x}} - \lambda \frac{\partial V}{\partial \boldsymbol{\mathbf{x}}}^\top \in \mathcal{N}\subset \mathcal{X}^c_{\boldsymbol{\mathbf{r}}}\). Furthermore, this point achieves lower value in \(V\). That is, \[V\left(\boldsymbol{\mathbf{x}} - \lambda \frac{\partial V}{\partial \boldsymbol{\mathbf{x}}}, \boldsymbol{\mathbf{r}}\right) < V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}).\] So, \(V(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) = \Gamma^*(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}})\) is a contradiction because the point \(\boldsymbol{\mathbf{x}} - \lambda \frac{\partial V}{\partial \boldsymbol{\mathbf{x}}} \in \mathcal{X}^c_{\boldsymbol{\mathbf{r}}}\) is feasible and achieves lower cost.

To prove the final property 8 , suppose \(\Delta(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) = 0\). Then, recalling \(\boldsymbol{\mathbf{x}} \in \mathcal{X}_{\boldsymbol{\mathbf{r}}} \subseteq \mathcal{E}_{\boldsymbol{\mathbf{r}}}\), \[\frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}} f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) = -\frac{\partial V}{\partial \boldsymbol{\mathbf{x}}} f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{r}}) \geq 0.\] This concludes the proof. ◻

Corollary 1. The Lyapunov-based DSM ?? is such that any class \(K_{\infty}\) function \(\alpha:[0,\infty)\to [0,\infty)\) satisfies the conditions ?? of Theorem 3.

Proof. Note that \[\frac{\partial \Delta}{\partial \boldsymbol{\mathbf{x}}} f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) = -\frac{\partial V}{\partial \boldsymbol{\mathbf{x}}} f_{\pi}(\boldsymbol{\mathbf{x}},\boldsymbol{\mathbf{v}}) \geq 0.\] Thus, \(\hat{\alpha}(c) \leq 0\), \(\forall c \in [0,\infty)\). Since class \(K_{\infty}\) functions are positive definite by definition, any class \(K_{\infty}\) function \(\alpha\) satisfies \(\alpha(c) \geq \hat{\alpha}(c)\) for all \(c\in [0,\infty)\). ◻

Systematic tools for computing \(\Gamma(\boldsymbol{\mathbf{v}})\) can be found in [9], [11][13] for various classes of systems. Corollary 1 ensures that the class \(K_{\infty}\) function \(\alpha\) can be chosen arbitrarily when using these approaches.

6 Overhead Crane Example↩︎

In this section, we design dynamic safety margins for the overhead crane system described in [16] and compare their performance with CBF candidates as well as the ERG. Throughout this section, simulations are computed in MATLAB and optimization problems are solved with MOSEK [17].

Consider the dynamics of an overhead crane \[M(\boldsymbol{\mathbf{q}})\ddot{\boldsymbol{\mathbf{q}}} + V_m(\boldsymbol{\mathbf{q}},\dot{\boldsymbol{\mathbf{q}}})\dot{\boldsymbol{\mathbf{q}}} + G(\boldsymbol{\mathbf{q}}) = B\boldsymbol{\mathbf{u}},\] where the degrees of freedom \(\boldsymbol{\mathbf{q}} = [x; ~\theta]\) are the gantry position \(x\) and the payload angle \(\theta\), and \[\begin{align} M(\boldsymbol{\mathbf{q}}) &= \begin{bmatrix} m_c + m_p & -m_pL\cos\theta \\ -m_pL\cos\theta & m_pL^2 \end{bmatrix}, \quad B = \begin{bmatrix} 1\\0 \end{bmatrix},\\ V_m(\boldsymbol{\mathbf{q}},\dot{\boldsymbol{\mathbf{q}}}) &= \begin{bmatrix} 0 & m_pL\dot{\theta}\sin\theta \\ 0 & 0 \end{bmatrix}, \quad G(\boldsymbol{\mathbf{q}}) = \begin{bmatrix} 0 \\ m_p gL\sin\theta \end{bmatrix}, \end{align}\] where \(m_c, m_p > 0\) represent the gantry and payload masses, respectively, \(L>0\) is the length of the rod connecting the crane and payload, and \(g>0\) is the acceleration of gravity. It can be shown that letting \(\boldsymbol{\mathbf{x}} = [\boldsymbol{\mathbf{q}}; ~\dot{\boldsymbol{\mathbf{q}}}]\), the system is control affine and satisfies \(\dot{\boldsymbol{\mathbf{x}}} = f_0(\boldsymbol{\mathbf{x}}) + g(\boldsymbol{\mathbf{x}})u\). We consider the prestabilizing PD control law given in [16] \[\label{eq:PDcontrol} \pi(\boldsymbol{\mathbf{x}},v) = -k_p(x-v) - k_d\dot{x},\tag{13}\] where \(k_p > 0\), \(k_d > 0\) are the proportional and derivative gains. The equilibrium mapping is \(\bar{x}:r \mapsto [r~;0~;0~;0]\) and the Lyapunov function is \[V(\boldsymbol{\mathbf{x}},r) = \frac{1}{2}\dot{\boldsymbol{\mathbf{q}}}^\top M(\boldsymbol{\mathbf{q}}) \dot{\boldsymbol{\mathbf{q}}} + m_pgL(1-\cos\theta) + \frac{1}{2}k_p(x-r)^2.\] Given the domain \(\mathcal{D}_x=\mathbb{R}\times(-\pi/2, \pi/2)\times\mathbb{R}^2\), it can be verified that \(V\) satisfies conditions 10 . We now define four types of constraints and, for each one, we design a Lyapunov DSM by finding the threshold value \(\Gamma^*\) or a lower bound.

  1. Position constraints: \(x_{\text{min}} \leq x \leq x_{\text{max}}\). The analytical solutions to 12 for the two bounds are respectively, \[\begin{align} \Gamma_1^*(v) &= \Gamma_1(v) = \frac{1}{2} k_p(x_{\text{min}} - v)^2, \\ \Gamma_2^*(v) &= \Gamma_2(v) = \frac{1}{2}k_p (x_{\text{max}} - v)^2. \end{align}\]

  2. Input constraints: \(|u| \leq u_{\text{max}}\), with \(u_{\text{max}} > 0\). The analytical solution to 12 is \[\Gamma_3^*(v) = \Gamma_3(v) = \frac{m_c u_{\text{max}}^2}{2(m_c k_p + k_d^2)}.\]

  3. Angle constraints: \(|\theta| \leq \theta_{\text{max}}\), with \(\theta_{\text{max}} \in (0,\pi/2)\). The analytical solution to 12 is \[\Gamma_4^*(v) = \Gamma_4(v) = m_pgL(1-\theta_{\text{max}}).\]

  4. Payload constraints: \(x + L\sin\theta \leq p_{\text{max}}\), with \(p_{\text{max}} > 0\). For this constraint, we were unable to find an analytical expression for \(\Gamma_5^*(v)\). As detailed in [11], however, \(\Gamma_5(v)\leq\Gamma_5^*(v)\) can be found by defining the Lyapunov lower bound \[\underline{V}(\boldsymbol{\mathbf{x}},v) = \frac{1}{2}\dot{\boldsymbol{\mathbf{q}}}^\top M(\boldsymbol{\mathbf{x}}) \dot{\boldsymbol{\mathbf{q}}} + \frac{4}{\pi^2}m_pgL\theta^2 + \frac{1}{2}k_p(x-v)^2,\] which satisfies \(\underline{V}(\boldsymbol{\mathbf{x}},v) \leq V(\boldsymbol{\mathbf{x}},v)\), \(\forall \theta \in (-\pi/2, \pi/2)\), and the linear constraint overapproximation \[\quad x + L\sin\theta \leq x + L\theta \leq p_{\text{max}}, \quad \forall x \in \mathbb{R}, ~\forall \theta \in [0,\pi/2).\] The threshold value \(\Gamma_5(v)\) is then obtained by solving 12 for the Lyapunov lower-bound \(\underline{V}(\boldsymbol{\mathbf{x}},v)\) and the linear overapproximation \(x + L\theta \leq p_{\text{max}}\). This yields \[\Gamma_5(v) = \frac{4k_pm_pg}{8m_p g + Lk_p\pi^2} (p_{\text{max}} - v)^2.\]

Given each threshold value \(\Gamma_i\), the corresponding DSM is \(\Delta_i(\boldsymbol{\mathbf{x}},v) = \Gamma_i(v) - V(\boldsymbol{\mathbf{x}},v)\). By Theorem 3 and Corollary 1, the DSMs have the control-sharing property and the resulting CBF policy ?? is recursively feasible. For all simulations, we use linear class \(K_{\infty}\) functions given by \(\alpha_i: c \mapsto \alpha_i c\) where \(\alpha_i > 0\) represents both the function and the scalar gain despite the slight abuse of notation. We choose \(\alpha_1 = \alpha_2 = 10\), \(\alpha_3 = 20\), \(\alpha_4 = 80\) and \(\alpha_5 = 2.2\).

The following approaches are used for comparison.

  1. Nominal: The nominal controller is a PD control law \(\kappa(\boldsymbol{\mathbf{x}}) = -k_{p,\kappa} (x - r) - k_{d,\kappa} \dot{x}\), where the gains \(k_{p,\kappa}> 0\) and \(k_{d,\kappa} > 0\) can differ from the ones in 13 and \(r \in \mathbb{R}\) is the target reference.

  2. ERG: The explicit reference governor uses the same dynamic safety margins as our approach, but changing \(k_p \to k_{p,\kappa}\) and \(k_d \to k_{d,\kappa}\) in all the expressions. The navigation field is \((r - v)\). The governed, closed-loop system is \[\begin{bmatrix} \dot{\boldsymbol{\mathbf{x}}} \\ \dot{v} \end{bmatrix} = \begin{bmatrix} f\big(\boldsymbol{\mathbf{x}}, \kappa(\boldsymbol{\mathbf{x}},v)\big) \\ \min_{i \in\{1,\ldots,5\}} \Delta_i(\boldsymbol{\mathbf{x}},v) (r - v) \end{bmatrix}.\]

  3. CBF: For each constraint, we design a candidate CBF.

    1. Position constraints: \(h_1(\boldsymbol{\mathbf{x}}) = \gamma_1(x - x_{\text{min}}) + \dot{x}\) for \(x_{\text{min}} \leq x\) and \(h_2(\boldsymbol{\mathbf{x}}) = \gamma_2(x_{\text{max}} - x) - \dot{x}\) for \(x \leq x_{\text{max}}\).

    2. Input constraints are added as upper and lower bounds for the optimization variable \(- u_{\text{max}} \leq u \leq u_{\text{max}}\).

    3. Angle constraints: \(h_3(\boldsymbol{\mathbf{x}}) = \gamma_3(\theta_{\text{max}} + \theta) + \dot{\theta}\) for \(-\theta_{\text{max}} \leq \theta\) and \(h_4(\boldsymbol{\mathbf{x}}) = \gamma_4(\theta_{\text{max}} - \theta) -\dot{\theta}\) for \(\theta \leq \theta_{\text{max}}\).

    4. Payload constraints: \(h_5(\boldsymbol{\mathbf{x}}) = \gamma_5(p_{\text{max}} - x - L\sin\theta) - \dot{x} - L\dot{\theta}\cos\theta\) for \(x + L\sin\theta \leq p_{\text{max}}\).

    Where \(\gamma_i\) are positive constants. For all simulations, we use \(\gamma_i = 6\) and \(\tilde{\alpha}_i = 8, \forall i \in \{1,\ldots,4\}\), and \(\gamma_5 = 4\), \(\tilde{\alpha}_5 = 3.5\), where \(\tilde{\alpha}_i: c \mapsto \tilde{\alpha}_ic\) is the class \(K_{\infty}\) function associated with \(h_i\). It must be noted that all \(h_i\) described above are “candidate” CBFs, meaning that there is no guarantee that they satisfy Definition 1 or that they have the control-sharing property given in Definition 3. However, designing candidate CBFs in this manner is common practice.

Table 1: Simulation parameters
\(m_c\) (kg) \(1\) \(k_p\) \(1\) \(x_{\text{min}}\) (m) \(1.1\) \(p_{\text{max}}\) (m) \(1.1\)
\(m_p\) (kg) \(0.5\) \(k_d\) 0.1 \(x_{\text{max}}\) (m) \(1.1\) \(\boldsymbol{\mathbf{x}}(0)\) (-) \(0\)
\(L\) (m) \(0.7\) \(k_{p,\kappa}\) \(10\) \(u_{\text{max}}\) (N) \(4\) \(v(0)\) (m) \(0.1\)
\(\eta\) (-) 0.01 \(k_{d,\kappa}\) \(4\) \(\theta_{\text{max}}\) (deg) \(10\) \(r\) (m) \(1\)

General parameters for the example are provided in Table 1. For the first simulation, shown in Fig. 1, we don’t enforce the angle constraint \(|\theta| \leq \theta_{\text{max}}\). In this case, all constrained control approaches achieve the safety objective. In terms of performance, the CBF tracks the nominal behavior better than the proposed DSM-CBF, whereas the ERG exhibits the slowest response.



Figure 1: Closed-loop behavior in the absence of angle constraints. Even though the nominal controller violates the constraints, the CBF, ERG, and proposed DSM-CBF successfully enforce the safety requirements..

Our second simulation, shown in Fig. 2, includes the angle constraint \(|\theta| \leq \theta_{\text{max}}\). The ERG and our proposed DSM-CBF successfully enforce the constraints, with the proposed method achieving better performance. However, the CBF-based controller becomes infeasible despite our best efforts to tune \(\gamma_i\) and \(\tilde{\alpha}_i\).



Figure 2: Closed-loop behavior in the presence of angle constraints. The ‘\(\times\)’ marks the instant in which the CBF policy becomes infeasible. Conversely, the ERG and proposed DSM-CBF successfully enforce the safety requirements..

7 Conclusion↩︎

This paper showed how dynamic safety margins can be used to obtain control barrier functions with the control-sharing property. The work also highlighted an approach based on Lyapunov functions to compute DSMs and presented simulation results that demonstrate the usefulness of this approach. Future work includes studying other methods to design DSMs and robustifying the results by considering disturbances.


A. D. Ames, X. Xu, J. W. Grizzle, and P. Tabuada, “Control barrier function based quadratic programs for safety critical systems,” IEEE Trans. Autom. Control, vol. 62, no. 8, pp. 3861–3876, Aug. 2017.
M. Rauscher, M. Kimmel, and S. Hirche, “Constrained robot control using control barrier functions,” in Proc. IEEE/RSJ Int. Conf. Intell. Robots Syst. (IROS), Oct. 2016, pp. 279–285.
V. Freire and X. Xu, “Flatness-based quadcopter trajectory planning and tracking with continuous-time safety guarantees,” IEEE Trans. Control Syst. Technol., vol. 31, no. 6, pp. 2319–2334, Mar. 2023.
T. G. Molnar, G. Orosz, and A. D. Ames, “On the safety of connected cruise control: analysis and synthesis with control barrier functions,” in Proc. IEEE 62nd Conf. Decis. Control (CDC), Dec. 2023, pp. 1106–1111.
J. Zeng, B. Zhang, Z. Li, and K. Sreenath, “Safety-critical control using optimal-decay control barrier function with guaranteed point-wise feasibility,” in Proc. IEEE Amer. Control Conf. (ACC), May 2021, pp. 3856–3863.
W. S. Cortez and D. V. Dimarogonas, “Safe-by-design control for Euler–Lagrange systems,” Automatica, vol. 146, p. 110620, Dec. 2022.
Y. Chen, M. Jankovic, M. Santillo, and A. D. Ames, “Backup control barrier functions: Formulation and comparative study,” in Proc. IEEE 60th Conf. Decis. Control (CDC), Dec. 2021, pp. 6835–6841.
V. Freire and M. M. Nicotra, “Systematic design of discrete-time control barrier functions using maximal output admissible sets,” IEEE Control Syst. Lett., vol. 7, pp. 1891–1896, Jun. 2023.
M. M. Nicotra and E. Garone, “The explicit reference governor: A general framework for the closed-form control of constrained nonlinear systems,” IEEE Control Syst. Mag., vol. 38, no. 4, pp. 89–107, Aug. 2018.
X. Xu, “Constrained control of input–output linearizable systems using control sharing barrier functions,” Automatica, vol. 87, pp. 195–201, Jan. 2018.
M. M. Nicotra and E. Garone, “Control of Euler-Lagrange systems subject to constraints: An explicit reference governor approach,” in Proc. IEEE 54th Conf. Decis. Control (CDC).1em plus 0.5em minus 0.4emIEEE, Dec. 2015, pp. 1154–1159.
E. Garone, M. Nicotra, and L. Ntogramatzidis, “Explicit reference governor for linear systems,” Int. J. Control, vol. 91, no. 6, pp. 1415–1430, 2018.
M. M. Nicotra, T. W. Nguyen, E. Garone, and I. V. Kolmanovsky, “Explicit reference governor for the constrained control of linear time-delay systems,” IEEE Trans. Autom. Control, vol. 64, no. 7, pp. 2883–2889, Jul. 2019.
F. Blanchini, “Set invariance in control,” Automatica, vol. 35, no. 11, pp. 1747–1767, 1999.
E. Rimon and D. E. Koditschek, “The construction of analytic diffeomorphisms for exact robot navigation on star worlds,” in Proc. IEEE Int. Conf. Robot. Autom. (ICRA), May 1989, pp. 21–26.
Y. Fang, E. Zergeroglu, W. Dixon, and D. Dawson, “Nonlinear coupling control laws for an overhead crane system,” in Proc. IEEE Int. Conf. Control Appl. (CCA), Sep. 2001, pp. 639–644.
M. ApS, The MOSEK optimization toolbox for MATLAB manual. Version 10.1.28., Copenhagen, Denmark, 2024.

  1. The authors are with the Department of Electrical, Computer & Energy Engineering, University of Colorado, Boulder, CO 80309 USA (email:;↩︎