  Learning-based control approaches have shown great promise in performing
complex tasks directly from high-dimensional perception data for real robotic
systems. Nonetheless, the learned controllers can behave unexpectedly if the
trajectories of the system divert from the training data distribution, which
can compromise safety. In this work, we propose a control filter that wraps any
reference policy and effectively encourages the system to stay in-distribution
with respect to offline-collected safe demonstrations. Our methodology is
inspired by Control Barrier Functions (CBFs), which are model-based tools from
the nonlinear control literature that can be used to construct minimally
invasive safe policy filters. While existing methods based on CBFs require a
known low-dimensional state representation, our proposed approach is directly
applicable to systems that rely solely on high-dimensional visual observations
by learning in a latent state-space. We demonstrate that our method is
effective for two different visuomotor control tasks in simulation
environments, including both top-down and egocentric view settings.
