OSREC.012 — Control Barrier Functions for Robot Safety. A robot may have a useful motion command and still need to reject that command before it crosses a modeled safety boundary. Control barrier functions (CBFs) express a safe region mathematically; a quadratic-programming safety filter can then choose a nearby permissible command. This lesson builds directly on OSREC.011: Whole-Body Control and Hierarchical Quadratic Programming.
Learning objectives
- Define a mathematical safe set with a barrier function.
- Explain the difference between a nominal motion command and a safety-filtered command.
- Solve a one-dimensional CBF velocity-limit example and identify the limits of its guarantee.
1. Specify the safe set
Let x represent a robot’s state. A function h(x) labels the permissible states: the safe set is C = {x : h(x) ≥ 0}. At h(x) = 0, the system is on the modeled boundary; at h(x) < 0, it is outside the permitted region. The engineering problem is to select commands that keep a trajectory inside C, assuming it starts inside.
The key mathematical property is forward invariance: once a state is inside the safe set, a correctly enforced controller keeps future states there under the specified system model and assumptions. This framework is developed by Ames, Xu, Grizzle and Tabuada in their control-barrier-function QP research and explained in University of Washington’s lecture notes on CBFs.
2. Video — Multi-robot collision avoidance demonstration
A research-linked demonstration accompanying Wang, Ames and Egerstedt’s paper shows how barrier certificates can alter nominal multi-robot commands to respect collision-avoidance constraints. Their published research record explains the associated quadratic-program formulation.
Research demonstration from the Safety Barrier Certificates project. Open the video directly on YouTube.
3. Apply the CBF condition
For a control-affine model dx/dt = f(x) + g(x)u, a common zeroing-CBF constraint takes the form Lfh(x) + Lgh(x)u + α(h(x)) ≥ 0, where α is an appropriate increasing function with α(0) = 0. The Lie derivatives express how h changes through uncontrolled dynamics and through the commanded input.
A safety filter chooses a command u near the nominal command unom, for example by minimizing ½‖u − unom‖² subject to the CBF inequality and actuator bounds. The quadratic program does not plan an entire task; it edits a proposed command only as much as its constraints require. Feasibility is essential: no solution means the mathematical requirements cannot all be met by the available inputs at that instant.
4. Worked example — robot approaching a boundary
Consider an idealized one-dimensional robot position x measured in meters with directly commanded velocity dx/dt = u. Suppose the modeled permitted region is x ≥ 0.50 m. Define h(x) = x − 0.50 m and choose α(h) = κh with κ = 2 s−1.
- At x = 0.60 m, the clearance relative to this simplified boundary is h = 0.10 m.
- The CBF constraint becomes u + 2(0.10) ≥ 0, or u ≥ −0.20 m/s.
- Suppose the nominal controller asks for unom = −0.50 m/s. Among feasible commands, the closest one is u = −0.20 m/s, assuming the actuator bounds permit it.
- At the boundary x = 0.50 m, the same inequality requires u ≥ 0: the robot must not command velocity deeper into the forbidden region.
This arithmetic is an illustrative continuous-time model, not an industrial robot configuration. A real manipulator has inertia, acceleration and torque limits, sensor error, braking distance, latency, reachable volume, human presence and possible model mismatch. A position-only single-integrator barrier is not sufficient to certify an actual machine’s collision safety.
5. Video — Research lecture on safety-critical dynamic robots
In a University of Washington ECE colloquium, control researcher Aaron Ames discusses optimization-based safety-critical control and its application to dynamic robotic platforms. The university provides the original presentation listing and video link.
University of Washington ECE research colloquium, November 17, 2020. Open the lecture directly on YouTube.
6. Engineering checks before deployment
- State estimation: Identify sensor accuracy, update frequency and timing delays affecting the estimated state.
- Model validity: Check inertia, actuator limits, contact behavior and the relative motion of obstacles.
- Constraint feasibility: Test whether all required CBF and hardware limits can be satisfied together throughout the operating region.
- Controller timing: Verify solver execution time and what happens when the solver misses a cycle or returns no feasible command.
- Independent safeguarding: Follow applicable machinery risk assessments, interlocks, guarding and emergency-stop requirements. A modeled CBF is not a substitute for approved physical safeguards.
For additional context, the IEEE Robotics & Automation Magazine article Safety and Efficiency in Robotics: The Control Barrier Functions Approach discusses CBFs in industrial human–robot collaboration. For practical safeguarding, consult OSHA’s robotics guidance.
7. How this connects to earlier lessons
OSREC.010 introduced operational-space control and null-space behavior. OSREC.011 introduced task priorities and QP constraints. A CBF adds a principled way to construct some of those safety inequalities from a specified safe set. For hands-on gripper inspection rather than controller mathematics, see OSRTC.014.
Knowledge check
- What does h(x) ≥ 0 signify in a CBF design?
- At x = 0.60 m in the worked example, why is a nominal velocity of −0.50 m/s modified?
- Why does a feasible mathematical safety filter not eliminate the need for guarding and risk assessment?
Answers: The state is inside the modeled permissible set; −0.50 m/s violates the example’s bound u ≥ −0.20 m/s; real robots face model uncertainty, timing and actuator limitations, and must meet independent machine-safety requirements.
BitcoinVersus.Tech Editor’s Note: If this independent robotics engineering lesson helped you, consider supporting future lessons with 5,000 sats. Scan the Bitcoin donation QR below to contribute.

Display the QR code on another screen and scan it with a compatible Bitcoin wallet.

Leave a Reply