  Learning-based controllers, such as neural network (NN) controllers, can show
high empirical performance but lack formal safety guarantees. To address this
issue, control barrier functions (CBFs) have been applied as a safety filter to
monitor and modify the outputs of learning-based controllers in order to
guarantee the safety of the closed-loop system. However, such modification can
be myopic with unpredictable long-term effects. In this work, we propose a
safe-by-construction NN controller which employs differentiable CBF-based
safety layers, and investigate the performance of safe-by-construction NN
controllers in learning-based control. Specifically, two formulations of
controllers are compared: one is projection-based and the other relies on our
proposed set-theoretic parameterization. Both methods demonstrate improved
closed-loop performance over using CBF as a separate safety filter in numerical
experiments.
