Open Source Robotics

A curated collection of high-quality open source robotics projects, tools, and software to propel the robotics community forward.

Safety Filter

  • Category: Control › Feedback control
  • Tags: safety, safe-control, optimization, learning-based-control, runtime-assurance

A runtime layer that checks each command from a nominal controller, human or learned policy and replaces it with the closest command that keeps the system provably inside a safe set.

Definition

A safety filter sits between a nominal controller and the actuators. The nominal controller, which may be a hand-tuned law, a planner, a teleoperator or a learned policy, proposes a command u_nom. The filter checks whether applying it keeps the system within a set of safe states and, if not, replaces it with a safe command, usually the one closest to u_nom. When the proposed command is already safe, it passes through unchanged. This separation lets engineers design for performance in the nominal controller and enforce safety in one small, analyzable component.

Several constructions are common. Control barrier function filters solve a small quadratic program at each control step: minimize ‖u − u_nom‖² subject to a linear constraint that keeps a barrier function from decreasing too fast, plus actuator limits. Hamilton-Jacobi reachability filters compute, offline, the set of states from which safety can be maintained, and switch to or blend in a safe controller when the state approaches its boundary. Predictive safety filters use model predictive control: they check whether the proposed command can be followed by a safe backup trajectory over a horizon and modify it if not. Learning-oriented work uses closely related ideas under names such as shields and safety layers.

A safety filter is only as good as the model and the state estimate it relies on. Model errors, delays, actuator saturation and perception errors can all break the guarantee, so robust variants tighten the constraints by bounds on these errors, for example to account for state estimates produced by learned perception. Filters can also cause unwanted behavior, such as a robot stopping near an obstacle when the nominal goal lies behind it, because they act locally and do not replan. The control barrier function entry describes the certificate itself; the safety filter is the runtime architecture that uses such a certificate, or a reachable set or predictive check, to modify commands.

Why it matters

Learned policies and human operators do not come with safety guarantees, and retraining them to be safe in every situation is rarely practical. A safety filter adds a verifiable layer that enforces limits such as collision avoidance, joint limits or geofences regardless of what the nominal controller does, which makes it a common pattern for deploying learning-based control on real robots.

Key applications

  • Collision avoidance around learned or teleoperated controllers
  • Enforcing joint, velocity and workspace limits on manipulators
  • Geofencing and obstacle avoidance for drones
  • Safe exploration during reinforcement learning on hardware
  • Shared autonomy, where a human command is minimally corrected

In practice

A team deploys a reinforcement-learning policy on a mobile robot in a lab with people. They wrap it in a CBF-based safety filter: for each nearby obstacle, the barrier function is the distance minus a margin, and a quadratic program running at the control rate finds the velocity command closest to the policy's output that satisfies all barrier constraints and the robot's speed limits. Because obstacle positions come from a learned detector with known error bounds, they enlarge the margin by that bound. During testing they log how often and how strongly the filter intervenes, which shows where the policy itself needs more training.

Common misconceptions

  • A safety filter makes any controller safe — its guarantee depends on the model, the state estimate and actuator limits being correct; errors in these must be bounded and accounted for
  • A safety filter replaces planning — it modifies commands locally and can leave the robot stuck or deadlocked; a planner is still needed to reach goals
  • Safety filter and control barrier function mean the same — a CBF is one kind of certificate; filters can also be built from reachable sets or predictive backup trajectories

Who should know this

  • Control engineers deploying learning-based controllers
  • Safety engineers for mobile robots and drones
  • Reinforcement learning researchers working on safe exploration
  • Teleoperation and shared-autonomy developers

Related technologies

  • Quadratic Programming
  • OSQP
  • Hamilton-Jacobi Reachability
  • Predictive Safety Filter
  • Shielding

Related terms

  • Control Barrier Function
  • Hamilton-Jacobi-Bellman Equation (HJB)
  • Model Predictive Control
  • Region of attraction
  • Obstacle Avoidance
  • Reinforcement Learning

Related projects

  • Drake: MIT robotics toolbox for model-based dynamics, optimization, and control system design
  • GTSAM: Factor-graph optimization library powering many modern SLAM backends
  • PyPose: PyTorch library for differentiable robotics with deep learning and Lie group optimization
  • NeuPAN: Real-time end-to-end planner that maps raw lidar points directly to robot actions
  • OpEn (Optimization Engine): Embedded nonconvex optimization solver in Rust for real-time MPC on robots
  • ProxSuite: High-performance QP/LP solver for robotics control and optimization

This website requires JavaScript to function properly. Please enable JavaScript to explore our collection of open source robotics projects.