<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Safe and Efficient Reinforcement Learning Using Disturbance-Observer-Based Control Barrier Functions</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>06/15/2023</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10427348</idno>
					<idno type="doi"></idno>
					<title level='j'>Proceedings of Machine Learning Research</title>
<idno>2640-3498</idno>
<biblScope unit="volume">211</biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Yikun Cheng</author><author>Pan Zhao</author><author>Naira Hovakimyan</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Safe reinforcement learning (RL) with assured satisfaction of hard state constraints duringtraining has recently received a lot of attention. Safety filters, e.g., based on control barrier functions(CBFs), provide a promising way for safe RL via modifying the unsafe actions of an RL agent onthe fly. Existing safety filter-based approaches typically involve learning of uncertain dynamics andquantifying the learned model error, which leads to conservative filters before a large amount of datais collected to learn a good model, thereby preventing efficient exploration. This paper presents amethod for safe and efficient RL using disturbance observers (DOBs) and control barrier functions(CBFs). Unlike most existing safe RL methods that deal with hard state constraints, our methoddoes not involve model learning, and leverages DOBs to accurately estimate the pointwise valueof the uncertainty, which is then incorporated into a robust CBF condition to generate safe actions.The DOB-based CBF can be used as a safety filter with model-free RL algorithms by minimallymodifying the actions of an RL agent whenever necessary to ensure safety throughout the learningprocess. Simulation results on a unicycle and a 2D quadrotor demonstrate that the proposed methodoutperforms a state-of-the-art safe RL algorithm using CBFs and Gaussian processes-based modellearning, in terms of safety violation rate, and sample and computational efficiency.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">Introduction</head><p>Reinforcement learning (RL) has demonstrated impressive performance in robotic control in recent years. Many real-world systems are subject to safety constraints. As a result, safe RL has recently received a lot of attention, although there are different de&#57344;nitions of "safety" <ref type="bibr">Garc&#305;a and Fern&#225;ndez (2015)</ref>; <ref type="bibr">Brunke et al. (2022)</ref>. We limit our discussion to safe RL that aims to ensure satisfaction of hard state constraints all the time during both training and deployment.</p><p>Among different safe RL paradigms, a commonly used one is to leverage safety &#57344;lters (SFs) to constrain the actions of RL agents and modify them whenever necessary to ensure satisfaction of safety constraints. The advantages of this paradigm mainly lie in its &#57345;exibility, i.e., a safety &#57344;lter can often work with many existing RL algorithms without (many) modi&#57344;cations to the RL algorithms. Along this line, researchers have proposed different safety &#57344;lters based on shielding <ref type="bibr">Alshiekh et al. (2018)</ref>, control barrier functions (CBFs) <ref type="bibr">Cheng et al. (2019)</ref>; <ref type="bibr">Ohnishi et al. (2019)</ref>; <ref type="bibr">Emam et al. (2021)</ref>, Hamilton-Jacobi reachability (HJR) <ref type="bibr">Fisac et al. (2018)</ref>, and model predictive safety certi&#57344;cation (MPSC) <ref type="bibr">Wabersich et al. (2021)</ref>. Among these different SFs, the shielding SF of Alshiekh Assumption 1 There exist positive constants l d and b d such that for any x, y &#8712; X , the following inequalities hold:</p><p>(3)</p><p>Moreover, the constants l d and b d are known.</p><p>Remark 1 Assumption 1 is a fairly standard assumption in nonlinear systems stating that the uncertain function d(x) is locally Lipschitz continuous with a known bound on the Lipschitz constant in the compact set X and is bounded by a known constant at the origin. The Lipschitz constant and uniform bounds will affect the estimation error bound when using a DOB to estimate the uncertainty d(x), as characterized in Lemma 4.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.1.">Reinforcement Learning</head><p>Reinforcement learning aims to &#57344;nd an optimal policy &#960; * in an environment which can be formulated as a Markov decision process (MDP). In this work, an MDP is de&#57344;ned by a tuple (S, A, p, r), where the state space S and the action space A are continuous. Given the current state s t &#8712; S and action a t &#8712; A, the transition function p : S &#215; S &#215; A &#8594; [0, &#8734;) represents the probability density of the succeeding state s t+1 &#8712; S. The reward function r : S &#215; A &#8594; [r min , r max ] determines a bounded reward for each transition.</p><p>Our proposed safe RL scheme can work with any model-free RL algorithm. For illustration and experimental demonstration in Section 4, we choose soft actor-critic (SAC) <ref type="bibr">Haarnoja et al. (2018)</ref>, a state-of-the-art model-free RL algorithm. SAC uses an off-policy formulation that reuses historical data to improve sample ef&#57344;ciency and utilizes entropy maximization to improve the stability of the training process. In general, SAC aims to &#57344;nd a policy to maximize an entropy objective which is formed as</p><p>, where H(&#8226;) is the entropy term that incentivizes exploration, &#945; is a positive parameter to determine the relative importance of the entropy term against the reward, &#961; &#960; denotes the states and actions distribution induced by the policy &#960;, and T is the termination time.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.2.">Control Barrier Function</head><p>The CBFs are introduced in Ames et al. <ref type="bibr">(2016)</ref> to synthesize control laws to ensure forward invariance of some sets (often related to safety) for nonlinear control-af&#57344;ne systems. They are often used as safety &#57344;lters to modify a baseline control law to ensure that the system stays in a safety set. Consider a set</p><p>where h(x) is a continuously differentiable function h. A function &#946; : (-b, a) &#8594; (-&#8734;, &#8734;) is said to belong to extended class K for some a, b &gt; 0 if it is strictly increasing and &#946;(0) = 0.</p><p>De&#57344;nition 2 (CBF Ames et al. ( <ref type="formula">2016</ref>)). Given a set C de&#57344;ned using h(x) via (4), h(x) is a control barrier function for (1) if there exists an extended class</p><p>where</p><p>. We de&#57344;ne the input relative degree (disturbance relative degree) of a differentiable function h : R n &#8594; R with respect to (1) as the number of times we need to differentiate it along (1) until the input u (the disturbance d) explicitly shows up. Condition (5) works only for constraints with input relative degrees (IRDs) of one. To handle constraints with higher IRDs, high-order CBFs are introduced in <ref type="bibr">Xiao and Belta (2021)</ref>. Before introducing high-order CBFs, we make the following assumption, which indicates that the input u and the disturbance d show up together when differentiating h.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Assumption 2</head><p>The disturbance relative degree is equal to the input relative degree.</p><p>De&#57344;ne a sequence of functions &#981; i : R n &#8594; R, i &#8712; {1, ..., m} as:</p><p>Furthermore, de&#57344;ne an associate sequence of sets as:</p><p>De&#57344;nition 3 (High-Order CBF under Perturbed System Dynamics). Consider a sequential function &#981; i (x) de&#57344;ned in ( <ref type="formula">6</ref>) and a sequential set C i , i &#8712; {1, ..., m} de&#57344;ned in ( <ref type="formula">7</ref>). Under Assumption 2, an m th -order differentiable function h :</p><p>where</p><p>The true uncertainty d in De&#57344;nitions 2 and 3 is not accessible in practice. Therefore, it is impossible to evaluate whether a function h(x) obeys the constraints in ( <ref type="formula">5</ref>) or ( <ref type="formula">8</ref>). One solution is to derive a suf&#57344;cient condition for (5) or (8) using a uniform bound for the uncertainty d(x), as adopted in <ref type="bibr">Zhao et al. (2020)</ref>; <ref type="bibr">Nguyen and Sreenath (2016)</ref>. In the following, we will derive an alternative suf&#57344;cient condition to de&#57344;ne the so-called DOB-CBFs.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.3.">Disturbance Observer (DOB) with a Precomputable Estimation Error Bound</head><p>Disturbance observers have been widely used in control of uncertain systems <ref type="bibr">Chen et al. (2015)</ref>. All different types of DOBs share a common idea, i.e., lumping all the uncertainties (that may consist of unknown parameters, unmodeled dynamics and external disturbances) together as a total disturbance and estimate its value at each time instant. In this work, we leverage the DOB presented in <ref type="bibr">Zhao et al. (2020)</ref>, which is inspired by the piecewise-constant (PC) adaptive law <ref type="bibr">Wang et al. (2017)</ref> and <ref type="bibr">(Hovakimyan and Cao, 2010, Section 3.3)</ref>, and was used in L 1 adaptive control of manned aircraft <ref type="bibr">Ackerman et al. (2017</ref><ref type="bibr">Ackerman et al. ( , 2019))</ref>, and in learning-enabled control <ref type="bibr">Gahlawat et al. (2020)</ref>; <ref type="bibr">Cheng et al. (2022b)</ref>. The DOB contains two components, i.e., a state predictor and a PC estimation law to estimate the disturbance. For the disturbed system (1), the state predictor is given by</p><p>where x = xx denotes the prediction error, a &gt; 0 is a constant, and d(t) is the estimated disturbance. The disturbance estimation is updated according to</p><p>where T is the estimation sampling time. The estimation error bound associated with the DOB is given next.</p><p>Lemma 4 (Estimation Error Bound Zhao et al. ( <ref type="formula">2020</ref>)) Given the uncertain system (1) subject to Assumption 1, and the DOB de&#57344;ned via ( <ref type="formula">9</ref>) and ( <ref type="formula">10</ref>), the estimation error can be bounded as</p><p>where &#951; &#8796; l d (max x&#8712;X ,u&#8712;U &#8741;f (x) + g(x)u&#8741; + &#952;). Moreover, lim T &#8594;0 &#947;(T ) = 0.</p><p>Remark 5 Lemma 4 implies that the estimated disturbance can be made arbitrarily accurate for t &#8805; T , by reducing T , the latter only subject to hardware limitations, including measurement noises.</p><p>Remark 6 As seen from Lemma 4, larger values of the Lipschitz bound l d and the uniform bound b d (introduced in Assumption 1) lead to larger estimation error bounds. On the other hand, we found that the estimation error bound in (11) could be quite conservative in most cases, potentially due to the frequent use of Lipschitz continuity properties and triangular inequalities. Therefore, for practical implementation one could leverage some empirical study, e.g., doing simulations under a few user-selected functions of d(x) and determining a tighter bound than that de&#57344;ned in <ref type="bibr">(11)</ref>. The conservativeness also indicates that even if the constants l d and b d violate the conditions (3) to a certain extent, the error bound in (11) most likely still holds in practice.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">Main Approach</head><p>In this section, we &#57344;rst introduce high-order DOB-based CBFs (DOB-CBFs), by extending the result in <ref type="bibr">Zhao et al. (2020)</ref>, which only considers constraints with IRDs of one. The work in Das &#184;and Murray (2022) considers high IRD constraints using exponential CBFs in the presence of matched uncertainties (which are injected to the system through the same channel as control inputs). Compared to Das &#184;and Murray (2022), we do not constrain the uncertainties to be matched, and leverage high-order CBFs <ref type="bibr">Xiao and Belta (2021)</ref> which are generalizations of exponential CBFs. Then, we introduce our DOB-CBF based safe RL scheme (DOB-CBF-RL).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.">High-Order DOB-Based Control Barrier Function (DOB-CBF)</head><p>Given the disturbance bound in Assumption 1 and the estimation error bound in Lemma 4, we have</p><p>The detailed proof could be found in the extended version of this paper <ref type="bibr">Cheng et al. (2022a)</ref>. Therefore, we have the following de&#57344;nition.</p><p>De&#57344;nition 7 (DOB-CBF) Consider the system in (1), the DOB de&#57344;ned via (9) and (10) with an estimation error bound given by (11), and a sequential function &#981; i (x) de&#57344;ned in ( <ref type="formula">6</ref>) and a sequential set C i , i &#8712; {1, ..., m} de&#57344;ned in <ref type="bibr">(7)</ref>. Under Assumption 2, an m th -order differentiable function h : R n &#8594; R is a high-order DOB-based control barrier function of relative degree m for (1) if there exist extended class K functions &#946; i , i &#8712; {1, ..., m}, such that</p><p>It is obvious that if a control input u is a solution for (12), it also satis&#57344;es (8). We next de&#57344;ne</p><p>Then, the main theorem of the proposed approach is introduced as follows.</p><p>Theorem 8 Suppose the condition ( <ref type="formula">12</ref>) holds. Then, the condition</p><p>is a suf&#57344;cient condition for (8). It is also a necessary condition for ( <ref type="formula">8</ref>) for any t &#8805; T when T &#8594; 0.</p><p>The proof of Theorem 8 could be found in <ref type="bibr">Cheng et al. (2022a)</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2.">Safe RL Policy Training with DOB-CBFs</head><p>Using the condition in ( <ref type="formula">14</ref>) that depends on the estimated disturbance d(t), we can compute the safe control inputs via solving a quadratic programming (QP) problem de&#57344;ned as</p><p>where P is a positive-de&#57344;nite weighting matrix, u RL is the action of RL policy and u safe is the &#57344;nal control input applied to the system (1) during both policy training and policy deployment. In case u RL satis&#57344;es the constraints of ( <ref type="formula">15</ref>) and is therefore safe, we have u safe =u RL ; otherwise, (15) produces safe inputs that are mostly close to u RL . With the DOB-CBF-QP in (15), our proposed DOB-CBF-RL scheme is summarized in Algorithm 1. At each step during training, the vanilla RL policy determines a potentially unsafe action. This action is then modi&#57344;ed by the DOB-CBF-QP in (15) to produce a safe action u safe that is applied to the environment. It is worth mentioning that the tuple (x t , u safe t , x t+1 , r t ) involving the safe action is added to the reply buffer D and used to update the policy. Using safe actions for policy training will promote the agent to learn a safe and optimal policy (although not guaranteed), which the DOB-CBF as a safety &#57344;lter does not need to (frequently) intervene with.</p><p>Algorithm 1: DOB-CBF based safe RL Input: Initial SAC policy &#960; &#952; , number of episodes N , number of steps per episode M , number of policy update G, nominal dynamics &#7819; = f (x) + g(x)u, DOB de&#57344;ned via ( <ref type="formula">9</ref>) and ( <ref type="formula">10</ref>) with estimation error bound &#947;, for i = 1, ...., N do for t = 1, ..., M do Obtain action u RL t from policy &#960; &#952; Obtain disturbance estimation dt from the DOB de&#57344;ned via ( <ref type="formula">9</ref>) and ( <ref type="formula">10</ref> </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">Simulation</head><p>We use a unicycle and a 2D quadrotor to validate the ef&#57344;cacy of the proposed DOB-CBF-RL method. For comparison, we also implemented a state-of-the-art safe RL method based on CBFs and GPR-based model learning (denoted as GP-CBF-RL) in <ref type="bibr">Cheng et al. (2019)</ref>. The policy training was performed on a desktop with an INTEL i9-9980XE and an NVIDIA 3090Ti GPU and 64GB RAM. The codes are available at <ref type="url">https://github.com/Adriancyk/Safe-RL-with-Disturbance-</ref>Observer.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1.">Unicycle</head><p>A unicycle model was borrowed from <ref type="bibr">Emam et al. (2021)</ref> and adapted. The state x = [p x , p y , &#952;] T , where p x and p y denote the robot position along the x-axis and y-axis, respectively, and &#952; is the counterclockwise angle between the positive direction of the x-axis and the head direction of the robot. The control inputs are the linear velocity v and angular velocity &#969; of the system. The goal is to navigate the unicycle from the red dot to the yellow dot without colliding with any obstacles, as shown in Figure <ref type="figure">2</ref> (Right). The vehicle's equations of motion are given by</p><p>where the uncertainty d m is introduced to mimic the slippery ground that causes the vehicle to lose partial control ef&#57344;ciency. We train DOB-CBF-RL policy and the GP-CBF-RL policy separately and de&#57344;ne h i (x) = 1 2 ((&#8741;p i,obs &#8741; -&#57351; p 2 x + p 2 y ) 2r 2 i,obs ), where i = 1, 2, 3, p i,obs denotes the location of ith obstacle in xy-plane, and r i,obs is the radius of the ith obstacle. The parameters of the system dynamics and the details of the RL training are included in <ref type="bibr">Cheng et al. (2022a)</ref>.</p><p>We can see from Figure <ref type="figure">2</ref> (Left) that the DOB-CBF-RL policy consistently converges within 60 episodes. In comparison, it takes at least 90 episodes for the GP-CBF-RL to &#57344;nd an equally good</p></div>		</body>
		</text>
</TEI>
