bayesian learning-based adaptive control for …bayesian learning-based adaptive control for safety...

7
Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan 1,3 , Jennifer Nguyen 2 , Rohan Thakker 3 , Nikhilesh Alatur 3 , Ali-akbar Agha-mohammadi 3 , and Evangelos A. Theodorou 1 Abstract— Deep learning has enjoyed much recent success, and applying state-of-the-art model learning methods to con- trols is an exciting prospect. However, there is a strong reluctance to use these methods on safety-critical systems, which have constraints on safety, stability, and real-time performance. We propose a framework which satisfies these constraints while allowing the use of deep neural networks for learning model un- certainties. Central to our method is the use of Bayesian model learning, which provides an avenue for maintaining appropriate degrees of caution in the face of the unknown. In the proposed approach, we develop an adaptive control framework leveraging the theory of stochastic CLFs (Control Lyapunov Functions) and stochastic CBFs (Control Barrier Functions) along with tractable Bayesian model learning via Gaussian Processes or Bayesian neural networks. Under reasonable assumptions, we guarantee stability and safety while adapting to unknown dy- namics with probability 1. We demonstrate this architecture for high-speed terrestrial mobility targeting potential applications in safety-critical high-speed Mars rover missions. Index Terms— Robust/Adaptive Control of Robotic Systems, Robot Safety, Probability and Statistical Methods, Bayesian Adaptive Control, Deep Learning, Mars Rover I. I NTRODUCTION The rapid growth of Artificial Intelligence (AI) and Machine Learning (ML) disciplines has created a tremendous impact in engineering disciplines, including finance, medicine, and general cyber-physical systems. The ability of ML algo- rithms to learn high dimensional dependencies has expanded the capabilities of traditional disciplines and opened up new opportunities towards the development of decision making systems which operate in complex scenarios. Despite these recent successes [1], there is low acceptance of AI and ML al- gorithms to safety-critical domains, including human-centered robotics, and particularly in the flight and space industries. For example, both recent and near-future planned Mars rover missions largely rely on daily human decision making and piloting, due to a very low acceptable risk for trusting black- box autonomy algorithms. Therefore there is a need to develop computational tools and algorithms that bridge two worlds: the canonical structure of control theory, which is important for providing guarantees in safety-critical applications, and the data driven abstraction and representational power of machine learning, which is necessary for adapting the system to achieve resiliency against unmodeled disturbances. 1 Institute for Robotics and Intelligent Machines, Georgia Institute of Technology, Atlanta, GA, USA 2 Department of Mechanical and Aerospace Engineering, West Virginia University, Morgantown, WV, USA 3 NASA Jet Propulsion Laboratory, California Institute of Technology, Pasadena, CA, USA Fig. 1: The left image depicts a 1/5th scale RC car platform driving at the Mars Yard at JPL; and the right is a platform from the Mars Explore Rover (MER) mission. Towards this end, we propose a novel, lightweight frame- work for Bayesian adaptive control for safety critical systems, which we call BALSA (BAyesian Learning-based Safety and Adaptation). This framework leverages ML algorithms for learning uncertainty representations of dynamics which in turn are used to generate sufficient conditions for stability using stochastic CLFs and safety using stochastic CBFs. Treating the problem within a stochastic framework allows for a cleaner and more optimal approach to handling modeling uncertainty, in contrast to deterministic, discrete-time, or robust control formulations. We apply our framework to the problem of high- speed agile autonomous vehicles, a domain where learning is especially important for dynamics which are complex and difficult to model (e.g., fast autonomous driving over rough terrain). Potential Mars Sample Return (MSR) missions are one example in this domain. Current Mars rovers (i.e., Opportunity and Curiosity) have driven on average 3km/year [2], [3]. In contrast, if MSR launches in 2028, then the rover has only 99 sols (102 days) to complete potentially 10km [4], [5]. After factoring in the intermittent and heavily delayed communications to earth, the need for adaptive, high-speed autonomous mobility could be crucial to mission success. Along with the requirements for safety and adaptation, com- putational efficiency is of paramount importance for real sys- tems. Hardware platforms often have severe power and weight requirements, which significantly reduce their computational power. Probabilistic learning and control over deep Bayesian models is a computationally intensive problem. In contrast, we shorten the planning horizon and rely on a high-level, lower fidelity planner to plan desired trajectories. Our method then guarantees safe trajectory tracking behavior, even if the given trajectory is not safe. This frees up the computational budget for other tasks, such as online model training and inference. Related work - Machine-learning based planning and control is a quickly growing field. From Model Predictive Control (MPC) based learning [6], [7], safety in reinforcement learning [8], belief-space learning and planning [9], to imita- tion learning [10], these approaches all demand considerations of safety under learning [11], [12], [13], [14]. Closely related arXiv:1910.02325v2 [eess.SY] 4 Mar 2020

Upload: others

Post on 12-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Bayesian Learning-Based Adaptive Control for …Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan1; 3, Jennifer Nguyen2, Rohan Thakker , Nikhilesh Alatur3,

Bayesian Learning-Based Adaptive Control for Safety Critical Systems

David D. Fan1,3, Jennifer Nguyen2, Rohan Thakker3, Nikhilesh Alatur3,Ali-akbar Agha-mohammadi3, and Evangelos A. Theodorou1

Abstract— Deep learning has enjoyed much recent success,and applying state-of-the-art model learning methods to con-trols is an exciting prospect. However, there is a strongreluctance to use these methods on safety-critical systems, whichhave constraints on safety, stability, and real-time performance.We propose a framework which satisfies these constraints whileallowing the use of deep neural networks for learning model un-certainties. Central to our method is the use of Bayesian modellearning, which provides an avenue for maintaining appropriatedegrees of caution in the face of the unknown. In the proposedapproach, we develop an adaptive control framework leveragingthe theory of stochastic CLFs (Control Lyapunov Functions)and stochastic CBFs (Control Barrier Functions) along withtractable Bayesian model learning via Gaussian Processes orBayesian neural networks. Under reasonable assumptions, weguarantee stability and safety while adapting to unknown dy-namics with probability 1. We demonstrate this architecture forhigh-speed terrestrial mobility targeting potential applicationsin safety-critical high-speed Mars rover missions.

Index Terms— Robust/Adaptive Control of Robotic Systems,Robot Safety, Probability and Statistical Methods, BayesianAdaptive Control, Deep Learning, Mars Rover

I. INTRODUCTION

The rapid growth of Artificial Intelligence (AI) andMachine Learning (ML) disciplines has created a tremendousimpact in engineering disciplines, including finance, medicine,and general cyber-physical systems. The ability of ML algo-rithms to learn high dimensional dependencies has expandedthe capabilities of traditional disciplines and opened up newopportunities towards the development of decision makingsystems which operate in complex scenarios. Despite theserecent successes [1], there is low acceptance of AI and ML al-gorithms to safety-critical domains, including human-centeredrobotics, and particularly in the flight and space industries.For example, both recent and near-future planned Mars rovermissions largely rely on daily human decision making andpiloting, due to a very low acceptable risk for trusting black-box autonomy algorithms. Therefore there is a need to developcomputational tools and algorithms that bridge two worlds:the canonical structure of control theory, which is importantfor providing guarantees in safety-critical applications, andthe data driven abstraction and representational power ofmachine learning, which is necessary for adapting the systemto achieve resiliency against unmodeled disturbances.

1Institute for Robotics and Intelligent Machines, Georgia Institute ofTechnology, Atlanta, GA, USA

2Department of Mechanical and Aerospace Engineering, West VirginiaUniversity, Morgantown, WV, USA

3NASA Jet Propulsion Laboratory, California Institute of Technology,Pasadena, CA, USA

Fig. 1: The left image depicts a 1/5th scale RC car platform drivingat the Mars Yard at JPL; and the right is a platform from the MarsExplore Rover (MER) mission.

Towards this end, we propose a novel, lightweight frame-work for Bayesian adaptive control for safety critical systems,which we call BALSA (BAyesian Learning-based Safety andAdaptation). This framework leverages ML algorithms forlearning uncertainty representations of dynamics which in turnare used to generate sufficient conditions for stability usingstochastic CLFs and safety using stochastic CBFs. Treatingthe problem within a stochastic framework allows for a cleanerand more optimal approach to handling modeling uncertainty,in contrast to deterministic, discrete-time, or robust controlformulations. We apply our framework to the problem of high-speed agile autonomous vehicles, a domain where learningis especially important for dynamics which are complexand difficult to model (e.g., fast autonomous driving overrough terrain). Potential Mars Sample Return (MSR) missionsare one example in this domain. Current Mars rovers (i.e.,Opportunity and Curiosity) have driven on average ∼3km/year[2], [3]. In contrast, if MSR launches in 2028, then the roverhas only 99 sols (∼102 days) to complete potentially 10km[4], [5]. After factoring in the intermittent and heavily delayedcommunications to earth, the need for adaptive, high-speedautonomous mobility could be crucial to mission success.

Along with the requirements for safety and adaptation, com-putational efficiency is of paramount importance for real sys-tems. Hardware platforms often have severe power and weightrequirements, which significantly reduce their computationalpower. Probabilistic learning and control over deep Bayesianmodels is a computationally intensive problem. In contrast, weshorten the planning horizon and rely on a high-level, lowerfidelity planner to plan desired trajectories. Our method thenguarantees safe trajectory tracking behavior, even if the giventrajectory is not safe. This frees up the computational budgetfor other tasks, such as online model training and inference.

Related work - Machine-learning based planning andcontrol is a quickly growing field. From Model PredictiveControl (MPC) based learning [6], [7], safety in reinforcementlearning [8], belief-space learning and planning [9], to imita-tion learning [10], these approaches all demand considerationsof safety under learning [11], [12], [13], [14]. Closely related

arX

iv:1

910.

0232

5v2

[ee

ss.S

Y]

4 M

ar 2

020

Page 2: Bayesian Learning-Based Adaptive Control for …Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan1; 3, Jennifer Nguyen2, Rohan Thakker , Nikhilesh Alatur3,

to our work is Gaussian Process-based Bayesian Model Ref-erence Adaptive Control (GP-MRAC) [15], where modelingerror is approximated with a Gaussian Process (GP). However,computational speed of GPs scales poorly with the amountof data (O(N3)), and sparse approximations lack representa-tional power. Another closely related work is that of [16], whoshowed how to formulate a robust CLF which is tolerant tobounded model error. Extensions to robust CBFs were given in[17]. A stated drawback of this approach is the conservativenature of the bounds on the model error. In contrast, weincorporate model learning into our formulation, which allowsfor more optimal behavior, and leverage stochastic CLF andCBF theory to guarantee safety and stability with probability 1.Other related works include [18], which uses GPs in CBFs tolearn the drift term in the dynamics f(x), but uses a discrete-time, deterministic formulation. [19] combined L1 adaptivecontrol and CLFs. Learning in CLFs and CBFs using adaptivecontrol methods (including neuro-adaptive control) has beenconsidered in several works, e.g. [20], [21], [22], [23].

Contributions - Here we take a unique approach toaddress the aforementioned issues, with the requirements of1) adaptation to changes in the environment and the system,2) adaptation which can take into account high-dimensionaldata, 3) guaranteed safety during adaptation, 4) guaranteedstability during adaptation and convergence of trackingerrors, 5) low computational cost and high control rates. Ourcontributions are fourfold: First, we introduce a Bayesianadaptive control framework which explicitly uses the modeluncertainty to guarantee stability, and is agnostic to the typeof Bayesian model learning used. Second, we extend recentstochastic safety theory to systems with switched dynamicsto guarantee safety with probability 1. In contrast toadaptive control, switching dynamics are used to account formodel updates which may only occur intermittently. Third,we combine these approaches in a novel online-learningframework (BALSA). Fourth, we compare the performanceof our framework using different Bayesian model learningand uncertainty quantification methods. Finally, we applythis framework to a high-speed driving task on roughterrain using an Ackermann-steering vehicle and validate ourmethod on both simulation and hardware experiments.

II. SAFETY AND STABILITYUNDER MODEL LEARNING VIA STOCHASTIC CLF/CBFS

Consider a system with dynamics:x1 =x2, x2 =f(x)+g(x)u (1)

where x1,x2∈Rn, x=[x1,x2]ᵀ, and the controls are u∈Rn.For simplicity we restrict our analysis to systems of thisform, but emphasize that our results are extensible to systemsof higher relative degree [24], as well as hybrid systems withperiodic orbits [25]. A wide range of nonlinear control-affinesystems in robotics can be transformed into this form. Ingeneral, on a real system, f and g may not be fully known.We assume g(x) is known and invertible, which makes theanalysis more tractable. It will be interesting in future workto extend our approach to unknown, non-invertible controlgains, or non-control affine systems (e.g. x= f(x,u)). Let

f(x) be a given approximate model of f(x). We formulatea pre-control law with pseudo-control µ∈Rn:

u=g(x)−1(µ−f(x)) (2)which leads to the system dynamics being

x1 =x2, x2 =µ+∆(x) (3)where ∆(x) = f(x) − f(x) is the modeling error, with∆(x)∈Rn.

Suppose we are given a reference model and referencecontrol from, for example, a path planner:

x1rm=x2rm, x2rm=frm(xrm,urm)

The utility of the methods outlined in this work is foradaptive tracking of this given trajectory with guaranteedsafety and stability. We assume that frm is continuouslydifferentiable in xrm, urm. Further, urm is bounded andpiecewise continuous, and that xrm is bounded for abounded urm. Define the error e = x−xrm. We split thepseudo-control input into four separate terms:

µ=µrm+µpd+µqp−µad (4)where we assign µrm= x2rm and µpd to a PD controller:

µpd=[−KP−KD]e (5)Additionally, we assign µqp as a pseudo-control which weoptimize for and µad as an adaptive element which willcancel out the model error. Then we can write the dynamicsof the model error e as:

e=

[e1e2

]=

[0 I−KP −KD

]e+

[0I

](µqp−µad+∆(x))

=Ae+G(µqp−µad+∆(x)) (6)where the matrices A and G are used for ease of notation.The gains KD,KP should be chosen such that A is Hurwitz.When µad=∆(x), the modeling uncertainty is canceled outand the system can be controlled without error.

We construct an approximation of the modeling error∆(x) as a Bayesian regression problem. In discretetime, the learning problem is formulated as findinga mapping from input data Xt = x(t) to output dataYt=(x2(t+dt)−x2(t))/dt−(f(x(t))+g(x(t))u(t)). Giventhe ith dataset Di = Xt,Ytt=0,dt,...,ti with i∈N, we canconstruct the ith model ∆i(x). Note that we do not requireupdating the model at each timestep, which significantlyreduces computational load requirements and allows fortraining more expressive models (e.g., neural networks). Wealso assume the data is i.i.d. for tractability sake.

Our approximation ∆i(x) will not be exact with limiteddata. We assume the use of a function approximation modelwhich quantifies the uncertainty on its predictions, wherethe output of the model ∆i(x) ∼ N (mi(x), σi(x)) is amultivariate Gaussian random variable. This model shouldknow what it doesn’t know [26], and should capture both theepistemic uncertainty of the model, i.e., the uncertainty fromlack of data, as well as the aleatoric uncertainty, i.e., the un-certainty inherent in the system [27]. Methods for producingreliable confidence bounds include a large class of Bayesianneural networks ([28], [29], [30]), Gaussian Processes or itsmany approximate variants ([31], [32]), and many others.We anticipate that as this field matures the reliability andaccuracy of these methods will continue to improve.

Page 3: Bayesian Learning-Based Adaptive Control for …Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan1; 3, Jennifer Nguyen2, Rohan Thakker , Nikhilesh Alatur3,

By setting µad=mi(x), the error dynamics can be writtenas the following switching stochastic differential equation(SDE):

de=(Ae+G(µqp+εmi (t))dt+Gσi(x)dξ(t) (7)with e(0)=x(0)−xrm(0) and where εmi (t)=mi(x)−∆(x)and ξ(t) ∈ Rn is a zero-mean Wiener process. i ∈ N isa switching index which updates each time the model isupdated. The main problem which we address is how tofind a pseudo-control µqp which provably drives the trackingerror to 0 while simultaneously guaranteeing safety.

Since ∆(x) is not known a priori, one approach is toassume that ‖εmi (t)‖ is bounded by some known term. Thesize of this bound will depend on the type of model usedto represent the uncertainty, its training method, and thedistribution of the data Di. See [15] for such an analysisfor sparse online Gaussian Processes. For neural networksin general there has been some work on analyzing thesebounds [33], [34]. Without loss of generality, we let themodeling error to be fully captured in σi(x), i.e., ∆i(x)∼N (∆(x),σi(x)). Then we have the following dynamics:

de=(Ae+Gµqp)dt+Gσi(x)dξ(t) (8)with e(0) = x(0)−xrm(0). This is valid as long as σi(x)captures both the epistemic and aleatoric uncertaintyaccurately and as long as that uncertainty is distributed asa multivariate Gaussian. This is a special case of a moregeneral infinite-dimensional SDE formulation where ξ(t)is replaced with Ω([x,t]), an infinite-dimensional randomvariable which captures the uncertainty of learning. Fora more thorough discussion see [35], [36]. Note also thatif the bounds on ‖εmi (t)‖ are known, then our results areeasily extensible to this case via (7).

A. Stochastic Control Lyapunov Functions for SwitchedSystems

We establish sufficient conditions on µqp to guaranteeconvergence of the error process e(t) to 0. The result is alinear constraint similar to deterministic CLFs (e.g., [17]). Thedifference here is the construction a stochastic CLF conditionfor switched systems. The switching is needed to accountfor online updates to the model as more data is accumulated.

In general, consider a switched SDE of Ito type [37]defined by:

dX(t)=a(t,X(t))dt+σi(t,X(t))dξ(t) (9)where X ∈Rn1 , ξ(t)∈Rn2 is a Wiener process, a(t,X) isa Rn1-vector function, σi(t,X) a n1×n2 matrix, and i∈Nis a switching index. The switching index may change afinite number of times in any finite time interval. For eachswitching index, a and σ must satisfy the Lipschitz condition‖a(t,x)−a(t,y)‖+‖σi(t,x)−σi(t,y)‖≤L‖x−y‖,∀x,y∈Dwith D compact. Then the solution of (9) is a continuousMarkov process.

Definition II.1. X(t) is said to be exponentially meansquare ultimately bounded uniformly in i if there existspositive constants K,c0,τ such that for all t,X0,i, we havethat EX0

‖X(t)‖2≤K+c0‖X0‖2e−τt.

We first restate the following theorem from [15]:

Theorem II.1. Let X(t) be the process defined by the solutionto (9), and let V (t,X) be a function of class C2 with respect toX , and class C1 with respect to t. Denote the Ito differentialgenerator by L. If 1) −α1+c1‖X‖2≤V (t,X)≤ c3‖X‖2+α2 for real α1,α2,c1>0; and 2) LV (t,X)≤βi−c2V (t,X)for real βi, c2 > 0, and all i; then the process X(t) isexponentially mean square ultimately bounded uniformly ini. Moreover, K= α2

c1+maxi(

|βi|c1c2

+ α1

c1), c0 = c3

c1, and τ=c2.

Proof. See [15] Theorem 1.

We use Theorem II.1 to derive a stochastic CLF sufficientcondition on µqp for the tracking error e(t). Consider thestochastic Lyapunov candidate function V (e)= 1

2eᵀPe where

P is the solution to the Lyapunov equation AᵀP+PA=−Q,where Q is any symmetric positive-definite matrix.

Theorem II.2. Let e(t) be the switched stochastic processdefined by (8), and let ε>0 be a positive constant. Supposefor all t, µqp and the relaxation variable d1i ∈R satisfy theinequality:

Ψ0i +Ψ1µqp≤d1i (10)

Ψ0i =−1

2eᵀQe+

1

εV (e)+

1

2tr(Gσiσ

ᵀi G

ᵀP )

Ψ1 =eᵀPG.

Then e(t) is exponentially mean-square ultimately boundeduniformly in i. Moreover if (10) is satisfied with d1i <0 forall i, then e(t)→0 exponentially in the mean-squared sense.

Proof. The Lyapunov candidate function V (e) is boundedabove and below by 1

2λmin(P )‖e‖2 ≤ V (e(t)) ≤12λmax(P )‖e‖2. We have the following Ito differential ofthe Lyapunov candidate:

LV (e)=∑j

∂V (e)

∂ejAej+

1

2

∑j,k

[Gσiσᵀi G

ᵀ]jk∂2V (e)

∂ek∂ej

=−1

2eᵀQe+eᵀPGµqp+

1

2tr(Gσiσ

ᵀi G

ᵀP ). (11)

Rearranging, (10) becomes LV (e) ≤ − 1εV (e). Setting

α1 =α2 = 0,βi = d1i ,c1 = 12λmin(P ),c2 = 1

ε ,c3 = 12λmax(P ),

we see that the conditions for Theorem II.1 are satisfiedand e(t) is exponentially mean square ultimately boundeduniformly in i. Moreover,

Ee0‖e(t)‖2≤

κ(P )‖e0‖2e−tε +max

i(

|d1i |4λmin(P )λmax(P )

) (12)

where κ(P ) is the condition number of the matrix P .Therefore if d1i <0 for all i, e(t) converges to 0 exponentiallyin the mean square sense.

The relaxation variable d1i allows us to find solutions forµqp which may not always strictly satisfy a Lyapunov stabilitycriterion LV ≤0. This allows us to incorporate additional con-straints on µqp at the cost of losing convergence of the error eto 0. Fortunately, the error will remain bounded by the largestd1i . In practice we re-optimize for a new d1i at each timestep.This does not affect the result of Theorem II.2 as long as we re-optimize a finite number of times for any given finite interval.

Page 4: Bayesian Learning-Based Adaptive Control for …Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan1; 3, Jennifer Nguyen2, Rohan Thakker , Nikhilesh Alatur3,

One highly relevant set of constraints we want to satisfyare control constraints Hu ≤ b, where H ∈ Rnc ×Rn is amatrix and b ∈Rnc is a vector. Let µd = µrm+µpd−µad.Recall the pre-control law (2). Then the control constraint is:

Hg−1(x)µqp≤Hg−1(x)(µd−f(x))+b. (13)Next we formulate additional constraints to guarantee safety.

B. Stochastic Control Barrier Functions for Switched Systems

We leverage recent results on stochastic control barrier func-tions [38] to derive constraints linear in µqp which guaranteethe process x(t) satisfies a safety constraint, i.e., x(t) ∈ Cfor all t. The set C is defined by a locally Lipschitz functionh :Rn→R as C=x :h(x)≥0 and ∂C=x :h(x)=0. Wefirst extend the results of [38] to switched stochastic systems.

Definition II.2. Let X(t) be a switched stochastic processdefined by (9). Let the function B : Rn → R be locallyLipschitz and twice-differentiable on int(C). If thereexists class-K functions γ1 and γ2 such that for all X ,1/γ1(h(X))≤B(X)≤ 1/γ2(h(X)), then B(x) is called acandidate control barrier function.

Definition II.3. Let B(x) be a candidate control barrierfunction. If there exists a class-K function γ3 such thatLB(X)≤ γ3(h(X)), then B(x) is called a control barrierfunction (CBF).

Theorem II.3. Suppose there exists a CBF for the switchedstochastic process X(t) defined by (9). If X0 ∈C, then forall t, Pr(X(t)∈C)=1.

Proof. [38] Theorem 1 provides a proof of the resultfor non-switched stochastic processes. Let ti denote theswitching times of X(t), i.e., when t ∈ [0,t0), the processX(t) has diffusion matrix σ0(X), and when t ∈ [ti−1, ti)for i > 0, the process X(t) has diffusion matrix σi(X). IfX0 ∈ C, then Xt ∈ C for all t ∈ [0, t0) with probability 1since the process X(t) does not switch in the time intervalt ∈ [0,t0). By similar argument for any i > 0 if Xti−1

∈ Cthen Xt∈C for all t∈ [ti−1,ti) with probability 1. This alsoimplies that Xti ∈ C, since X(t) is a continuous Markovprocess. Then Xt∈C for all t∈ [ti,ti+1) with probability 1.Then by induction, for all t, Pr(X(t)∈C)=1.

Next, we establish a linear constraint condition sufficient forµqp to guarantee safety for (8). Rewrite (8) in terms of x(t) as:

dx=(A0x+G(µd+µqp))dt+Gσi(x)dξ(t) (14)

A0 =

[0 I0 0

], µd=µrm+µpd−µad.

Theorem II.4. Let x(t) be a switched stochastic processdefined by (15). Let B(x) be a candidate control barrierfunction. Let γ3 be a class-K function. Suppose for all t,µqp satisfies the inequality:

Φ0i +Φ1µqp≤0 (15)

Φ0i =

∂B

∂x

(A0x+Gµd)−γ3(h(x))+1

2tr(Gσiσ

ᵀi G

ᵀ ∂2B

∂x2)

Φ1 =∂B

∂x

G

Then B(x) is a CBF and (16) is a sufficient condition forsafety, i.e., if x0∈C, then x(t)∈C for all t with probability 1.

Proof. We have the following Ito differential of the CBFcandidate B(x):

LB(x)=∂B

∂x

(A0x+G(µd+µqp))

+1

2tr(Gσiσ

ᵀi G

ᵀ ∂2B

∂x2). (16)

Rearranging (16) it is clear that LB(x) ≤ γ3(h(x)). ThenB(x) is a CBF and the result follows from Theorem II.3.

C. Safety and Stability under Model Adaptation

We can now construct a CLF-CBF Quadratic Program (QP)in terms of µqp incorporating both the adaptive stochastic CLFand CBF conditions, along with control limits (Equation (17)):

arg minµqp,d1,d2

µᵀqpµqp+p1d

21+p2d

22 (17)

s.t. Ψ0i +Ψ1µqp≤d1 (Adaptive CLF)

Φ0i +Φ1µqp≤d2 (Adaptive CBF)

Hg−1(x)µqp≤Hg−1(x)(µd−f(x))+b

In practice, several modifications to this QP are often made([24],[39]). In addition to a relaxation term for the CLF in The-orem II.2, we also include a relaxation term d2 for the CBF.This helps to ensure the QP is feasible and allows for slowingdown as much as possible when the safety constraint cannot beavoided due to control constraints, creating, e.g., lower impactcollisions. Safety is still guaranteed as long as the relaxationterm is less than 0. For an example of guaranteed safety inthe presence of this relaxation term see [17], also see [21]for an approach to handling safety with control constraints.The emphasis of this work is on guaranteeing safety in thepresence of adaptation so we leave these considerations forfuture work. Our entire framework is outlined in Algorithm 1.

III. APPLICATION TO FAST AUTONOMOUS DRIVING

In this section we validate BALSA on a kinematicbicycle model for car-like vehicles. We model the statex = [px, py, θ, v]ᵀ as position in x and y, head-ing, and velocity respectively, with dynamics x =[v cos(θ), v sin(θ), v tan(ψ)/L, a]ᵀ. where a is the inputacceleration, L is the vehicle length, and ψ is the steeringangle. We employ a simple transformation to obtain dynamicsin the form of (1). Let z = [z1,z2,z3,z4]ᵀ where z1 = px,z2 = py, z3 = z1, z4 = z2, and c = tan(ψ)/L. Let thecontrols u=[c,a]ᵀ. Then z fits the canonical form of (1). Toascertain the importance of learning and adaptation, we addthe following disturbance to [z3,z4]ᵀ to use as a “true” model:

δ(z)=

[cos(θ) −sin(θ)sin(θ) cos(θ)

][−tanh(v2)−(0.1+v)

](18)

This constitutes a non-linearity in the forward velocityand a tendency to drift to the right.

We use the following barrier function for pointcloud-basedobstacles. Similar to [17], we design this barrier functionwith an extra component to account for position-basedconstraints which have a relative degree greater than 1. Thisis done by including the time-derivative of the position-based

Page 5: Bayesian Learning-Based Adaptive Control for …Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan1; 3, Jennifer Nguyen2, Rohan Thakker , Nikhilesh Alatur3,

Algorithm 1: BAyesian Learning-based Safety and Adap-tation (BALSA)

1 Require: Prior model f(x), known g(x), referencetrajectory xrm, choice of modeling algorithm∆i(x)∼N (mi(x),σi(x)), dt, A, Hu≤b.

2 Initialize: i=0, Dataset D0 =∅, t=0, solve P3 while true do4 Obtain µrm= x2rm(t) and compute µpd5 Compute model error and uncertainty

µad=mi(x(t)), and σi(x(t))6 µqp← Solve QP (17)7 Set u(t)=g(x)−1(µrm+µpd+µqp−µad−f(x))8 Apply control u(t) to system.9 Step forward in time t← t+dt.

10 Append new data point to database:11 Xt=[x(t)], Yt=

(x2(t+dt)−x2(t))/dt−(f(x(t))+g(x(t)u(t)).12 Di←Di∪Xt,Yt13 if updateModel then14 Update model ∆i(x,µ) with database Di15 Di+1←Di, i← i+1

constraint as an additional term in the barrier function, whichpenalizes velocities (or higher order derivatives) leading toa decrease of the level set function h. Let our safety setC = x ∈ Rn|h(x,x′) ≥ 0, where x′ is the position of anobstacle. Let h(x,x′) = ‖(x−x′)‖2− r where r > 0 is theradius of a circle around the obstacle. Then construct a barrierfunction B(x;x′)=1/(γph(x,x′)+ d

dth(x,x′)). As shown by[24], B(x) is a CBF, where γp helps to control the rate ofconvergence. We chose γ1(x),γ2(x)=x and γ3(x)=γ/x.

A. Validation of BALSA in Simulation

One iteration of the algorithm for this problem takes lessthan 4ms on a 3.7GHz Intel Core i7-8700K CPU, in Pythoncode which has not been optimized for speed. We make ourcode publicly available1. Because training the model occurson a separate thread and can be performed anytime online,we do not include the model training time in this benchmark.We use OSQP [40] as our QP solver.

In Figure 2, we compare BALSA with several differentbaseline algorithms. We use a Neural Network trained withdropout and a negative-log-likelihood loss function forcapturing the uncertainty [30]. We place several obstaclesin the direct path of the reference trajectory. We also placevelocity barriers for driving too fast or too slow. We observethat the behavior of the vehicle using our algorithm maintainsgood tracking errors while avoiding barriers and maintainingsafety, while the other approaches suffer from variousdrawbacks. The adaptive controller (ad) and PD controller(pd) violate safety constraints. The (qp) controller with aninaccurate model also violates constraints and exhibits highlysuboptimal behavior (Figure 3). A robust (rob) formulationwhich uses a fixed robust bound which is meant to bound

1https://github.com/ddfan/balsa.git

0 10 20 30 40 50 60X Position

−3

−2

−1

0

1

2

Y Po

sitio

n

ref ad qp pd rob balsa

Fig. 2: Comparison of the performance of four algorithms in trackingand avoiding barrier regions (red ovals). ref is the reference trajectory.ad is an adaptive controller (µrm+µpd−µad). qp is a non-adaptivesafety controller (µrm+µpd+µqp). pd is a proportional derivativecontroller (µrm + µpd). rob is a robust controller which uses a fixedσi(x) to compensate for modeling errors. balsa is the full adaptiveCLF-CBF-QP approach outlined in this paper and in Algorithm 1,i.e. (µrm+µpd−µad+µqp).

0

2

Vel (

m/s

)

ref ad qp pd rob balsa

0

1

Pred

err

0 10 20 30 40 50 60Time(s)

10−3

10−1

σ i(x

)

Fig. 3: Top: Velocities of each algorithm. Red dotted line indicatessafety barrier. Middle: Output prediction error of model, decreasingwith time. Solid and dashed lines indicate both output dimensions.Bottom: Uncertainty σi(x), also decreasing with time. Predictionsare made after 10 seconds to accumulate enough data to train thenetwork. During this time we choose an upper bound for σ0=1.0.

any model uncertainty [17], while not violating safetyconstraints, is too conservative and non-adaptive, has troubletracking the reference trajectory. In contrast, BALSA adaptsto model error with guaranteed safety. We also plot themodel uncertainty and error in (Figure 3).

B. Comparing Different Modeling Methods in Simulation

Next we compared the performance of BALSA onthree different Bayesian modeling algorithms: GaussianProcesses, a Neural Network with dropout, and ALPaCA[29], a meta-learning approach which uses a hybrid neuralnetwork with Bayesian regression on the last layer. For allmethods we retrained the model intermittently, every 40 newdatapoints. In addition to the current state, we also includedas input to the model the previous control, angular velocityin yaw, and the current roll and pitch of the vehicle. For theGP we re-optimized hyperparameters with each training. Forthe dropout NN, we used 4 fully-connected layers with 256hidden units each, and trained for 50 epochs with a batch sizeof 64. Lastly, for ALPaCA we used 2 hidden layers, each with128 units, and 128 basis functions. We used a batch size of150, 20 context data points, and 20 test data points. The modelwas trained using 100 gradient steps and online adaption(during prediction) was performed using 20 of the most recentcontext data points with the current observation (see [29] fordetails of the meta-learning capabilities of ALPaCA). At each

Page 6: Bayesian Learning-Based Adaptive Control for …Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan1; 3, Jennifer Nguyen2, Rohan Thakker , Nikhilesh Alatur3,

−5

0

5No Learning

ref 0-60s 60-120sGP

−2.5 0.0 2.5−5

0

5Dropout NN

−2.5 0.0 2.5

ALPaCA

Fig. 4: Comparison of adaptation performance in a Gazebo simula-tion using three different probabilistic model learning methods.

No learn GP Dropout ALPaCA0-60s 0.580 0.3992 0.408 0.390

60-120s 0.522 0.097 0.105 0.110TABLE I: Average tracking error in position for different modelingmethods in sim, split into the first minute and second minute.

Mean Err Std Dev MaxNo Learn 1.417 0.568 6.003Learning 0.799 0.387 2.310

TABLE II: Mean, standard deviation, and max tracking error on ourrover platform for a figure-8 task.

training iteration we retrain both the neural network and thelast Bayesian linear regression layer. Figure (4) and Table (I)show a comparison of tracking error for these methods. Wefound GPs to be computationally intractable with more than500 data points, although they exhibited good performance.Neural networks with dropout converged quickly and wereefficient to train and run. ALPaCA exhibited slightly slowerconvergence but good tracking as well.

C. Hardware Experiments on Martian Terrain

To validate that BALSA meets real-time computationalrequirements, we conducted hardware experiments on theplatform depicted in Figure (5). We used an off-the shelfRC car (Traxxas Xmaxx) in 1/5-th scale (wheelbase 0.48 m),equipped with sensors such as a 3D LiDAR (Velodyne VLP-16) for obstacle avoidance and a stereo camera (RealSenseT265) for on-board for state estimation. The power trainconsists of a single brushless DC motor, which drives thefront and rear differential, operating in current control modefor controlling acceleration. Steering commands were fedto a servo position controller. The on-board computer (IntelNUC i7) ran Ubuntu 18.04 and ROS [41].

Experiments were conducted in a Martian simulation envi-ronment, which contains sandy soil, gravel, rocks, and roughterrain. We gave figure-eight reference trajectories at 2m/s andevaluated the vehicle’s tracking performance (Figure 5). Dueto large achieving good tracking performance at higher speedsis difficult. We observed that BALSA is able to adapt to bumpsand changes in friction, wheel slip, etc., exhibiting improvedtracking performance over a non-adaptive baseline (Table II).

We also evaluated the safety of BALSA under adaptation.We used LiDAR pointclouds to create barriers at eachLiDAR return location. Although this creates a large numberof constraints, the QP solver is able to handle these in

−2 0 2 4 6 8 10 12 14−3

−2

−1

0

1

2

3 No adaptationAdaptationReference

Fig. 5: Left: A high-speed rover vehicle. Right: Figure-8 tracking onour rover platform on rough and sandy terrain, comparing adaptationvs. no adaptation.

−4 −2 0 2 4 6 8 10

−4

−2

0

2

Fig. 6: Vehicle avoids collision despite localization drift andunmodeled dynamics. Blue line is the reference trajectory, coloredpluses are the vehicle pose, colored points are obstacles. Colorsindicate time, from blue (earlier) to red (later). Note that localizationdrift results in the obstacles appearing to shift position. Green circleindicates location of the obstacle at the last timestep. Despite thisdrift the vehicle does not collide with the obstacle.

real-time. Figure 6 shows what happens when an obstacleis placed in the path of the reference trajectory. The vehiclesuccessfully slows down and comes to a stop if needed,avoiding the obstacle altogether.

IV. CONCLUSION

In this work, we have described a framework for safe,fast, and computationally efficient probabilistic learning-basedcontrol. The proposed approach satisfies several importantreal-world requirements and take steps towards enabling safedeployment of high-dimensional data-driven controls andplanning algorithms. Further development other types ofrobots including drones, legged robots, and manipulators isstraightforward. Incorporating better uncertainty-representingmodeling methods and training on higher-dimensional data (vi-sion, LiDAR, etc) will also be a fruitful direction of research.

ACKNOWLEDGEMENT

The authors would like to thank Joel Burdick’s groupfor their hardware support. This research was partiallycarried out at the Jet Propulsion Laboratory (JPL), CaliforniaInstitute of Technology, and was sponsored by the JPL YearRound Internship Program and the National Aeronauticsand Space Administration (NASA). Jennifer Nguyen wassupported in part by NASA EPSCoR Research CooperativeAgreement WV-80NSSC17M0053 and NASA West VirginiaSpace Grant Consortium, Training Grant #NX15AI01H.Evangelos A. Theodorou was supported by the C-STARFaculty Fellowship at Georgia Institute of Technology.Copyright c©2019. All rights reserved.

Page 7: Bayesian Learning-Based Adaptive Control for …Bayesian Learning-Based Adaptive Control for Safety Critical Systems David D. Fan1; 3, Jennifer Nguyen2, Rohan Thakker , Nikhilesh Alatur3,

REFERENCES

[1] D. Silver, J. Schrittwieser, K. Simonyan, I. Antonoglou, A. Huang,A. Guez, T. Hubert, L. Baker, M. Lai, A. Bolton et al., “Mastering thegame of go without human knowledge,” Nature, vol. 550, no. 7676,p. 354, 2017.

[2] NASA, “Where is Curiosity? - NASA MarsCuriosity Rover,” 2018. [Online]. Available: https://mars.nasa.gov/msl/mission/whereistherovernow/

[3] NASA, “Opportunity Updates,” 2018. [Online]. Available:https://mars.nasa.gov/mer/mission/rover-status/opportunity/recent/all/

[4] E. Klein, E. Nilsen, A. Nicholas, C. Whetsel, J. Parrish, R. Mattingly,and L. May, “The mobile mav concept for mars sample return,” in2014 IEEE Aerospace Conference, March 2014, pp. 1–9.

[5] A. Nelessen, C. Sackier, I. Clark, P. Brugarolas, G. Villar, A. Chen,A. Stehura, R. Otero, E. Stilley, D. Way, K. Edquist, S. Mohan,C. Giovingo, and M. Lefland, “Mars 2020 entry, descent, and landingsystem overview,” in 2019 IEEE Aerospace Conference, March 2019,pp. 1–20.

[6] N. Wagener, C. Cheng, J. Sacks, and B. Boots, “An online learningapproach to model predictive control,” CoRR, vol. abs/1902.08967,2019. [Online]. Available: http://arxiv.org/abs/1902.08967

[7] G. Williams, P. Drews, B. Goldfain, J. M. Rehg, and E. A.Theodorou, “Information-theoretic model predictive control: Theoryand applications to autonomous driving,” IEEE Transactions onRobotics, vol. 34, no. 6, pp. 1603–1622, 2018.

[8] F. Berkenkamp, M. Turchetta, A. Schoellig, and A. Krause, “Safemodel-based reinforcement learning with stability guarantees,” inAdvances in neural information processing systems, 2017, pp. 908–918.

[9] S.-K. Kim, R. Thakker, and A.-A. Agha-Mohammadi, “Bi-directionalvalue learning for risk-aware planning under uncertainty,” IEEERobotics and Automation Letters, vol. 4, no. 3, pp. 2493–2500, 2019.

[10] S. Ross, G. Gordon, and D. Bagnell, “A reduction of imitation learningand structured prediction to no-regret online learning,” in Proceedingsof the fourteenth international conference on artificial intelligenceand statistics, 2011, pp. 627–635.

[11] C. J. Ostafew, A. P. Schoellig, and T. D. Barfoot, “RobustConstrained Learning-based NMPC enabling reliable mobile robotpath tracking,” The International Journal of Robotics Research,vol. 35, no. 13, pp. 1547–1563, nov 2016. [Online]. Available:http://journals.sagepub.com/doi/10.1177/0278364916645661

[12] K. Pereida and A. P. Schoellig, “Adaptive Model Predictive Controlfor High-Accuracy Trajectory Tracking in Changing Conditions,” in2018 IEEE/RSJ International Conference on Intelligent Robots andSystems (IROS). IEEE, oct 2018, pp. 7831–7837. [Online]. Available:https://ieeexplore.ieee.org/document/8594267/

[13] L. Hewing, J. Kabzan, and M. N. Zeilinger, “Cautious ModelPredictive Control using Gaussian Process Regression,” arXiv, may2017. [Online]. Available: http://arxiv.org/abs/1705.10702

[14] G. Shi, X. Shi, M. O’Connell, R. Yu, K. Azizzadenesheli,A. Anandkumar, Y. Yue, and S.-J. Chung, “Neural Lander: StableDrone Landing Control using Learned Dynamics,” arXiv, nov 2018.[Online]. Available: http://arxiv.org/abs/1811.08027

[15] G. Chowdhary, H. A. Kingravi, J. P. How, and P. A. Vela,“Bayesian Nonparametric Adaptive Control Using Gaussian Processes,”IEEE Transactions on Neural Networks and Learning Systems,vol. 26, no. 3, pp. 537–550, mar 2015. [Online]. Available:http://ieeexplore.ieee.org/document/6823109/

[16] Q. Nguyen and K. Sreenath, “Optimal Robust Control for BipedalRobots through Control Lyapunov Function based Quadratic Programs.”Robotics: Science and Systems, 2015.

[17] Q. Nguyen and K. Sreenath, “Optimal robust control for constrainednonlinear hybrid systems with application to bipedal locomotion,”in 2016 American Control Conference (ACC). IEEE, 2016, pp.4807–4813.

[18] R. Cheng, G. Orosz, R. M. Murray, and J. W. Burdick, “End-to-EndSafe Reinforcement Learning through Barrier Functions forSafety-Critical Continuous Control Tasks,” arXiv, mar 2019. [Online].Available: http://arxiv.org/abs/1903.08792

[19] Q. Nguyen and K. Sreenath, “L1 adaptive control for bipedal robotswith control Lyapunov function based quadratic programs,” in 2015American Control Conference (ACC). IEEE, jul 2015, pp. 862–867.[Online]. Available: http://ieeexplore.ieee.org/document/7170842/

[20] A. J. Taylor, V. D. Dorobantu, M. Krishnamoorthy, H. M. Le, Y. Yue,and A. D. Ames, “A Control Lyapunov Perspective on Episodic

Learning via Projection to State Stability,” arXiv, mar 2019. [Online].Available: http://arxiv.org/abs/1903.07214

[21] T. Gurriet, A. Singletary, J. Reher, L. Ciarletta, E. Feron, and A. Ames,“Towards a framework for realizable safety critical control through activeset invariance,” in Proceedings of the 9th ACM/IEEE InternationalConference on Cyber-Physical Systems. IEEE Press, 2018, pp. 98–106.

[22] V. Azimi and P. A. Vela, “Robust adaptive quadratic programmingand safety performance of nonlinear systems with unstructureduncertainties,” in 2018 IEEE Conference on Decision and Control(CDC). IEEE, 2018, pp. 5536–5543.

[23] V. Azimi and P. A. Vela, “Performance reference adaptive control:A joint quadratic programming and adaptive control framework,” in2018 Annual American Control Conference (ACC). IEEE, 2018, pp.1827–1834.

[24] Q. Nguyen and K. Sreenath, “Exponential Control Barrier Functionsfor enforcing high relative-degree safety-critical constraints,” in 2016American Control Conference (ACC). IEEE, jul 2016, pp. 322–328.[Online]. Available: http://ieeexplore.ieee.org/document/7524935/

[25] A. D. Ames, K. Galloway, K. Sreenath, and J. W. Grizzle, “Rapidlyexponentially stabilizing control lyapunov functions and hybrid zerodynamics,” IEEE Transactions on Automatic Control, vol. 59, no. 4,pp. 876–891, 2014.

[26] L. Li, M. L. Littman, T. J. Walsh, and A. L. Strehl, “Knows whatit knows: a framework for self-aware learning,” Machine learning,vol. 82, no. 3, pp. 399–443, 2011.

[27] C. J. Roy and W. L. Oberkampf, “A comprehensive framework forverification, validation, and uncertainty quantification in scientificcomputing,” Computer Methods in Applied Mechanics and Engineering,vol. 200, no. 25-28, pp. 2131–2144, jun 2011.

[28] D. Hafner, D. Tran, T. Lillicrap, A. Irpan, and J. Davidson,“Reliable Uncertainty Estimates in Deep Neural Networks usingNoise Contrastive Priors,” arXiv, jul 2018. [Online]. Available:http://arxiv.org/abs/1807.09289

[29] J. Harrison, A. Sharma, and M. Pavone, “Meta-Learning Priorsfor Efficient Online Bayesian Regression,” arXiv, jul 2018. [Online].Available: http://arxiv.org/abs/1807.08912

[30] Y. Gal and Z. Ghahramani, “Dropout as a bayesian approximation:Representing model uncertainty in deep learning,” in internationalconference on machine learning, 2016, pp. 1050–1059.

[31] B. Shahriari, K. Swersky, Z. Wang, R. P. Adams, and N. De Freitas,“Taking the human out of the loop: A review of bayesian optimization,”Proceedings of the IEEE, vol. 104, no. 1, pp. 148–175, 2015.

[32] Y. Pan, X. Yan, E. A. Theodorou, and B. Boots, “Prediction under un-certainty in sparse spectrum gaussian processes with applications to fil-tering and control,” in Proceedings of the 34th International Conferenceon Machine Learning-Volume 70. JMLR. org, 2017, pp. 2760–2768.

[33] D. Yarotsky, “Error bounds for approximations with deep relunetworks,” Neural Networks, vol. 94, pp. 103–114, 2017.

[34] G. Shi, X. Shi, M. OConnell, R. Yu, K. Azizzadenesheli, A. Anand-kumar, Y. Yue, and S.-J. Chung, “Neural lander: Stable drone landingcontrol using learned dynamics,” in 2019 International Conferenceon Robotics and Automation (ICRA). IEEE, 2019, pp. 9784–9790.

[35] P. Hennig, “Optimal reinforcement learning for gaussian systems,”in Advances in Neural Information Processing Systems, 2011, pp.325–333.

[36] Y. Pan, E. Theodorou, and M. Kontitsis, “Sample efficient pathintegral control under uncertainty,” in Advances in Neural InformationProcessing Systems, 2015, pp. 2314–2322.

[37] R. Khasminskii, Stochastic stability of differential equations. SpringerScience & Business Media, 2011, vol. 66.

[38] A. Clark, “Control barrier functions for complete and incompleteinformation stochastic systems,” in 2019 American Control Conference(ACC), July 2019, pp. 2928–2935.

[39] A. D. Ames, X. Xu, J. W. Grizzle, and P. Tabuada, “Control barrierfunction based quadratic programs for safety critical systems,” IEEETransactions on Automatic Control, vol. 62, no. 8, pp. 3861–3876, 2016.

[40] B. Stellato, G. Banjac, P. Goulart, A. Bemporad, and S. Boyd, “OSQP:An operator splitting solver for quadratic programs,” ArXiv e-prints,Nov. 2017.

[41] M. Quigley, K. Conley, B. Gerkey, J. Faust, T. Foote, J. Leibs,R. Wheeler, and A. Y. Ng, “Ros: an open-source robot operatingsystem,” in ICRA workshop on open source software, vol. 3, no. 3.2.Kobe, Japan, 2009, p. 5.