Safety: a safeguard on top of a neural policy
A well-trained policy avoids the kettle almost every time. In a home shared with people, that is not enough: a rare mistake is still dangerous. In this lesson we will add an independent safety filter on top of the policy. It measures the margin to an obstacle and changes only the part of a command that violates a constraint. Across the same one hundred runs, we will see both the benefit and the limit of the filter: it protects only against what it can observe and describe.
Ada is the wheeled domestic humanoid used throughout the course labs. Meet her in Lesson 0.1.
Almost always is not a guarantee
In Lesson 8.1, a neural network set the target and a classical controller executed it precisely. But the controller will execute a target placed inside the kettle just as precisely. Execution accuracy says nothing about whether the command itself is safe.
A policy that avoids the kettle in 99 cases out of 100 may hit it on the hundredth. “Almost always” may be enough for a demonstration, but not for a home shared with people. Safety is a mandatory constraint here, not a metric that can be traded for speed or average success.
In the labs, Ada again drives from the living room to the kitchen table. The kettle appears in a new location on every run, and the camera estimates its position with a small error. The policy was trained on 300 avoidance demonstrations. When the space on the two sides is nearly equal, some demonstrations go left and others go right. That is where regression is most likely to fail.
A separate filter receives the proposed velocity and the current kettle position. Its job is narrower: it does not choose a route, but rejects unsafe commands. This separation lets us evaluate safety independently of whichever policy comes before the filter.
Ames and coauthors divide system requirements into two kinds in their 2019 survey: safety means that “something bad never happens,” while liveness means that “something good eventually happens.” Not hitting the kettle is a safety requirement; reaching the table is a liveness requirement. A policy handles both at once and guarantees neither. The lesson separates them: the policy solves the task, while a policy-agnostic module monitors safety alone.
Hsu and coauthors call such a module a safety filter: an automated process that monitors a running system and intervenes when necessary, changing its command to prevent a catastrophic failure. The filter is designed without knowing the task and should intervene as rarely as possible—only when a command truly leads to danger. The authors call this the separation principle: the task policy does not reason about safety, and the safety filter does not reason about the task. The same filter can therefore sit on top of any policy, including a learned one.
These filters are fast enough for a high-rate loop. In the Ames survey, the small optimization problem for a modified Segway ran on a BeagleBone Black board in 0.4 ms on average. Without the filter, a strong push tipped the machine over; with the filter, its command changed before execution.
This is the safeguard promised in Lesson 0.1 under “What should we entrust to each approach?”: neural networks handle the open world; rules provide guarantees. A filter needs two things to make a guarantee: a measure of danger that can be computed at every step, and a rule for changing an unsafe command. We begin with the measure. How do we turn “do not hit the kettle” into a number?
Margin to the kettle: the barrier function and its derivative
On the plan, Ada is a circle with an 18 cm radius and the kettle is a circle with a 13 cm radius. They touch when their centers are less than 31 cm apart. Add a 5 cm margin and call every position where Ada's center is more than 36 cm from the kettle center safe. The barrier function tells us how much margin remains: the distance between the centers minus 36 cm. If is positive, Ada is inside the safe set; if it is zero, she is on its boundary; if it is negative, she is beyond the boundary. The Ames survey defines the safe set in exactly this way: all states where . Safety means never leaving it. If a run starts inside the set, it remains inside. The authors call this forward invariance.
The margin alone tells us little. Thirty centimeters is ample if Ada moves sideways, but not if she rushes straight at the kettle. The filter therefore examines how quickly the margin changes. That rate is the derivative . If Ada moves straight toward the kettle at 60 cm/s, the margin shrinks by 60 cm each second: . If she follows a circle around the kettle, the margin does not change: . If she moves away, it grows. Thus, depends on only one component of velocity: the component directed toward the kettle.
The filter rule is that the margin may shrink no faster than . When the margin is large, Ada may approach quickly. The closer she gets to the boundary, the slower she must approach. On the boundary she may not approach at all, although she may move sideways or backward. The number , measured in 1/s, controls how sharply the filter tightens the leash. With and a 30 cm margin, Ada may approach at up to 60 cm/s; with a 10 cm margin, only 20 cm/s.
Now write the idea as equations. Let be Ada's center on the plan, the camera's estimate of the kettle center, cm the sum of the radii and the margin, and the velocity vector Ada will receive on this step:
Here is the unit vector from the kettle to Ada, and the dot product gives the velocity component directed away from the kettle (with the opposite sign, toward it). If the last inequality holds at every step, the margin cannot become negative. In the worst case it decays as , where is the initial margin, and only approaches zero. Ames and coauthors prove a stronger result: for compact sets, the condition , with any increasing function that equals zero at , is necessary and sufficient for the safe set to remain invariant. The linear is the simplest case. A function for which such a command exists at every point is called a control barrier function (CBF). A precursor was Nagumo's 1942 theorem, which required only on the boundary; the barrier function extends the condition across the entire safe set.
The condition constrains one velocity component: approach toward the kettle. The policy, however, outputs a complete command with both forward and sideways motion. How can we turn it into a velocity that satisfies the condition while changing the policy's intent as little as possible?
One filter command: the nearest safe velocity
At every step, the filter solves the same problem: among all velocities for which the margin shrinks no faster than , choose the one nearest the policy command. The velocity plane makes this easiest to see. Every point in the plane is a possible velocity for Ada; upward means forward along the route and rightward means motion to the right. The condition divides the plane with a straight line. Velocities on one side approach the kettle too quickly; velocities on the other are allowed. If the policy command is already allowed, the filter leaves it unchanged. Otherwise, it selects the nearest allowed point—the foot of the perpendicular from the command to the line.
The top-down plan shows Ada beside the kettle; you can drag her with a mouse or finger. The velocity plane appears next to it. You can also drag the tip of the orange arrow, which is the policy command. The blue arrow shows what the filter will pass through.
On the plan, the gray circle with a spout is the kettle; the blue dashed line is the safe-set boundary (Ada's center 36 cm from the kettle center); the red dashed line is contact at 31 cm; and the thin gray line runs from the kettle center to Ada. In the velocity plane, the center means that Ada is stationary. The large gray circle limits speed to 90 cm/s, blue shading marks forbidden velocities, and the blue line is the constraint boundary. The orange arrow is the policy command and the blue arrow is the filtered command; the same arrows start at Ada on the plan.
Under the hood: the optimization problem and its one-line solution
Problem. There is one constraint, linear in , and the objective is a squared distance. This is a quadratic program (QP) with one constraint, and its solution is explicit. If , the answer is itself. Otherwise, the command receives exactly enough of vector to reach the boundary:
Ames and coauthors state this directly: with no constraints on the input itself, the problem has one inequality and a closed-form solution. The part of the command along the boundary—sideways relative to the kettle—does not change. Only the component along changes.
Speed does not increase. Zero velocity is allowed because implies . Projecting onto a convex set that contains zero cannot move a point farther from zero: . The filter can only remove part of the velocity; it cannot accelerate Ada.
Several objects. Every object known to the filter adds another line in the velocity plane, and allowed velocities must lie on the correct side of all lines at once. The closest point in this polygon is either the command itself, a point on one line, or the intersection of two lines. The lesson engine checks these candidates and chooses the closest allowed one, solving the problem exactly without iteration.
Time step. The filter solves the problem 10 times per second, and Ada follows a constant command between solutions. Because is convex, over a step the margin decreases no more than the linear estimate predicts: . If , the right-hand side is nonnegative. This is the condition from Corollary 1.2 in the Hsu survey.
Ames and coauthors express what the filter did in the diagram as a quadratic program that finds the smallest correction to the command—a CBF-QP:
Here is the policy command, is what the wheeled base receives, and is the value of with the smallest distance to the policy command. The authors call the correction minimally invasive: the existing controller changes only as much as the guarantee requires. This also shows what the filter does not do. It neither searches for the safest velocity nor plans a route around the kettle. If the policy stubbornly commands motion into the kettle, the filter removes all approach velocity and Ada stops at the boundary. What happens over complete runs in which the policy sometimes heads straight for the kettle?
One hundred runs without and with the filter
Ada's policy trains in the browser on 300 demonstrations in a few seconds, then completes a series of 100 runs. Each run has its own kettle position and its own camera and wheel errors. At left, Ada follows the policy alone; at right, the same policy runs through a filter with and a 5 cm margin. The runs are paired: the same kettle locations, camera errors, and wheel noise. A run ends at the table, on contact with the kettle, or after 15 seconds.
The house is shown from above through a 3.4 m-wide central strip: the living-room start is at the bottom, the kitchen is at the top, a dashed circle near the table is the goal, and a thin dashed line is the direct route. The kettle is drawn at its location in the selected run; the line traces Ada's path and Ada appears at its endpoint. A green check means she arrived, a red cross means she touched the kettle, and a gray dot means 15 seconds elapsed. Small dots mark all one hundred kettle locations; red dots are locations that produced contact on that panel. On the right panel, the blue dashed circle around the kettle is the safe-set boundary and blue path segments mark steps where the filter changed the command.
Each cell on the series board is one run, ordered left to right and top to bottom. The upper half shows the outcome without the filter and the lower half with it: green means reached the goal, red means contact, and gray means the 15-second limit expired. Click a cell to show that run on both panels.
Under the hood: policy, filter, wheeled base, and ten-seed check
World. The house and kettle come from Lessons 1.3 and 1.5. Ada is a circle with an 18 cm radius, the kettle a circle with a 13 cm radius, and contact occurs when their centers are less than 31 cm apart. The start is at the bottom of the living room and the goal is by the kitchen table, 312 cm away in a straight line. The kettle is placed randomly: is within 60 cm of the route, is between 200 and 290 cm—between the start and the doorway—and outside the furniture. A step lasts 0.1 s, Ada moves forward at 60 cm/s, and each run has a 15 s limit.
Demonstrations. A teacher program drives Ada as the operator did in Lesson 1.3. It moves her sideways from the route, leaves a 22 cm margin around the kettle, then returns after passing it. It chooses the left side with probability , where is the kettle's offset from the route in centimeters. With a 2 cm leftward offset, it goes right roughly three times out of four; with a 10 cm offset, almost always. The dataset contains 300 runs and about 16,000 observation–offset pairs.
Policy. This is a 3 → 32 → 32 → 1 tanh network like the one in Lesson 1.3, but with three inputs: remaining distance to the kettle along the route, kettle offset from the route, and the kettle's longitudinal position. All come from the camera estimate, with a 2 cm error on each axis at every step. The network outputs Ada's lateral position for the next step. It minimizes MSE for 2,500 Adam steps with batches of 64 examples. A controller drives Ada toward that position with lateral velocity up to 90 cm/s.
Filter. At every step the filter solves the CBF-QP from the interactive with cm and the kettle position from the same camera estimate seen by the policy. It changes both lateral and forward velocity.
Wheeled base. Velocity follows the command with acceleration limited to 300 cm/s²; lateral position receives 0.5 cm of noise per step. The filter does not know about the acceleration limit: its model assumes that velocity equals the command.
Matched runs. Each run draws its kettle location, camera errors, and wheel noise from separate seeded generators, one number per step. Thus, at step , the errors are identical with and without the filter even after the paths diverge.
Identical in every browser. The engine builds exponential, logarithm, tanh, sine, and cosine from additions, multiplications, and divisions, as in Lessons 5.2–5.6. Browser implementations differ in the last digit, and training would amplify that difference.
Ten seeds. The seed controls the demonstrations, initial weights, and its own set of 100 runs. Across seeds 1–10, Ada without a filter touches the kettle in 1–13 runs out of 100, always when the kettle is within 7 cm of the route centerline. With the filter, no seed produces contact; 0–3 runs out of 100 time out, and mean completion time rises by 0.01–0.33 s.
Without the filter, Ada touched the kettle in 7 of 100 runs. The straight path intersected the kettle in 53 runs, and the policy avoided almost all of them. Every contact occurred when the kettle stood within 4.1 cm of the route centerline. The teacher had gone left around some such kettles and right around others; regression averaged the two routes, as in Lesson 1.3. With the filter, the same runs produce no contact even though both the policy and the camera errors are unchanged.
The price is time and one timeout. The filter changed the command on 9% of steps, and mean completion time rose from 5.20 to 5.39 s. On runs 80 and 95, Ada followed the boundary around the kettle and took 11.9 and 11.3 s. On run 75 she never arrived: the policy kept pulling her onto a straight path through the kettle, the filter refused to cross the boundary, and the two commands balanced. What determines how early the filter intervenes and how often it stops Ada this way?
Parameter α: from a conservative filter to an aggressive one
The lesson's filter has one setting: . A small makes it conservative, limiting approach to the kettle far from the boundary. A large makes it aggressive: it stays silent until almost the last moment, then brakes. This lab uses the same 100 runs and highlights run 80, one in which the unfiltered policy drives straight into the kettle. Its approach appears in a phase plane: horizontal position is the margin to the boundary and vertical position is approach speed. In this plane, the filter rule becomes the line “approach speed = margin”; everything below the line is allowed.
Phase plane: horizontal position is the margin to the safe-set boundary in cm (; zero is the boundary and the red vertical line at −5 cm is contact). Vertical position is Ada's approach speed toward the kettle center in cm/s. The blue line is ; blue shading marks what the rule forbids. Points show run 80 every 0.1 s: gray without the filter and blue with the selected . Blue points may briefly cross the line because the filter sees a noisy kettle position and the base cannot change velocity instantly. The plan shows the same run from above through the central strip of the house: gray without the filter and blue with it.
The chart summarizes the 100-run series for every tested : a red bar shows kettle contacts and a gray bar shows runs that did not finish within 15 s. The two counts appear above the bars, separated by a slash; mean completion time appears below the label. The first pale bar is the unfiltered series for comparison.
Under the hood: why an aggressive filter acts too late, and what the papers say
Filter model and real base. The filter assumes that Ada's velocity equals the command immediately. The real base accelerates and brakes at no more than 300 cm/s². Canceling 60 cm/s takes 0.2 s and about 6 cm of travel. An aggressive filter starts braking when the margin is cm. At , this is less than 4 cm, too late for the base to stop.
Time step. The filter acts every 0.1 s. The Hsu survey requires for this filter, so when s. Otherwise Ada can cross the boundary in a single step even with an instantaneous base. violates this condition as well.
Higher relative degree. Ames and coauthors identify relative degree one as the main limitation of their condition: the command must change directly. If the command sets acceleration while the margin depends on position, the degree is two, and the authors construct exponential barrier functions for such systems. Our acceleration-limited base is exactly this case. A conservative hides the mismatch; an aggressive one exposes it.
Ten seeds. No seed produces contact for from 1 to 2. At , there are 0–1 contacts per seed; at , 0–3; at , 0–6. At , there are no contacts, but 1–9 runs out of 100 time out and successful runs take 8.14–8.53 s on average instead of 5.2 s.
At , there is no contact, but the filter changes 68% of commands. Ada slows down on every detour, successful runs take 8.32 s on average, and 5 runs time out. This is conservatism. At , contact returns in 3 runs—fewer than the 7 without the filter, but no longer a guarantee. The phase plane shows why: run 80 stays near 60 cm/s almost to the boundary; the filter commands a stop in the final centimeters, but the base can remove at most 30 cm/s per step.
Between the extremes, from 1 to 4 yields no contact in this series, at most one timeout, and completion times of 5.34–5.58 s. Choosing is a tradeoff between caution and trust in the model: the more aggressive the filter, the more accurate its base model must be. This works for a velocity command that can be rotated or shortened slightly. What if the policy's actions are discrete?
Shields: the same safeguard for discrete actions
A barrier function works with a continuous command—a velocity vector that can be rotated or shortened slightly. Many policies instead use discrete actions such as “forward,” “left,” “stop,” or “open the valve.” A discrete action cannot receive a small correction; it can only be replaced. For this case, Alshiekh and coauthors proposed a shield in 2017: a program synthesized before training from a formal safety specification, which then decides which actions are allowed at every step.
The specification is written in temporal logic, a language for statements such as “something bad must never happen.” One example in the paper says that the water level in a tank must never fall below one liter. To check one step ahead, the shield needs a simplified model of the environment—an abstraction that predicts where each action may lead. The authors require this abstraction to be conservative with respect to the real environment. Like a barrier-function filter, the shield should intervene as little as possible: it forbids an action only when that action could violate safety.
A shield may sit in either of two places. In preemptive shielding, it removes every unsafe action before the agent chooses, leaving only safe options. In post-posed shielding, the agent chooses freely and the shield replaces its action if and only if that action is unsafe. In the latter case, the agent may not even know it is being protected, so the shield can work with an already-trained policy. If unsafe actions receive only a penalty during training, there is no guarantee that the final policy has eliminated them; the shield must therefore remain active after training.
The authors tested shields on four tasks. In 9 × 9 and 15 × 9 grid worlds, a robot had to visit colored cells in order without hitting walls or a moving opponent; in the first world, it also could not remain on a bomb for more than two consecutive steps. The agent used tabular Q-learning, and the shields were synthesized in 2 and 0.6 s. Only unshielded agents received negative reward, while shielded agents learned faster. In a car task on a 480 × 480-pixel field, an unshielded DQN agent was still crashing at the end of training; a shielded agent never did. In Seaquest, the agent learned from screen frames while the shield treated it as a black box. Agent quality did not change, but the safety rules were never violated. The authors identify the main drawback directly: a shield needs at least an approximate model of which actions are dangerous in which states.
A shield and a barrier-function filter implement the same idea for different command spaces: specify danger in advance and change the policy command as little as possible at every step. Both need a model. The shield needs an environment abstraction; the filter needs a function and a model of how commands change the margin. How strongly does the guarantee depend on what the filter knows about the world?
The filter guarantees only what it knows
The filter's guarantee is conditional: if the kettle position is correct and no other obstacles exist, Ada will not leave the safe set. We will test what happens when those conditions fail. A camera error may be systematic rather than random—for example, poor calibration may make the kettle appear farther away than it is. An object missing from both the demonstrations and the filter map may also appear on the floor: a laundry basket in the living room. The policy and the 100 runs are unchanged, and . Choose what is wrong with the world and the filter's margin, then run the series. Results accumulate in the log below the scene.
The house is shown from above. A solid kettle marks its real location; a pale dashed kettle marks where the camera sees it; and the blue dashed line marks the safe-set boundary around that estimate. The woven circle left of the route is a laundry basket. A blue dashed boundary appears around it when the basket is on the filter's map. The line traces Ada's selected run: a green check means reached the goal, a red cross means contact, and a gray dot means the 15-second limit expired. Small dots mark all one hundred kettle locations; red dots mark locations that produced contact.
| Camera | Margin | Basket | Contacts | Timeouts | Time |
|---|
The log is empty: choose the conditions and start a series with the mission button.
Under the hood: what is wrong and why the filter knows only about the kettle
Camera error. A constant offset along the route is added to the kettle-position estimate, making the kettle appear 10 or 20 cm farther from the start. The previous random 2 cm error remains at every step. Both the policy and the filter see the offset because they share one camera. The policy begins its detour slightly later, while the filter guards a circle around a location where the kettle is not.
Basket. The basket is an 18 cm-radius circle in the living room, 50 cm left of the route. It was absent from the demonstrations and is invisible to the policy. “On the filter map” means that the filter receives its position with the same 2 cm error and constructs a second barrier function, giving the optimization problem two constraints.
Contacts. Contacts with either the kettle or the basket count, and a run ends on contact.
Ten seeds. With a 10 cm camera error and a 5 cm margin, there are 0–10 contacts per seed. A 15 cm margin removes contact across all ten seeds, but 1–8 runs out of 100 time out. With a 20 cm error, a 15 cm margin is insufficient (2–11 contacts), while 25 cm is sufficient again. Ada touches an unmapped basket in 18–31 runs without the filter and 21–33 with a filter that knows only about the kettle. No seed reduces basket contact, and 8 of 10 increase it. When the basket is on the map, no seed produces contact, but 11–24 runs out of 100 time out.
With a 10 cm camera error and a 5 cm margin, there are 5 contacts; without the filter there would be 8. The filter guards the wrong location. A 15 cm margin covers this error and removes contact, but 4 runs time out instead of one. With a 20 cm error, a 15 cm margin is no longer enough: 10 contacts, the same as without the filter. Ada touches the unmapped basket in 27 runs—more often than without the filter (24)—because steering her away from the kettle sometimes directs her straight into the basket.
Adding the basket to the map removes contact, but 21 of 100 runs end with Ada stopped between the kettle and the basket. The filter guarantees exactly what it knows: its model, its position estimate, and its map. Calibration, perception, and map completeness must come from elsewhere. What exactly is required, and how do surveys and standards describe it?
A guarantee relative to a model: what else a product needs
All three labs make the same point: a filter guarantees safety under the conditions built into it. Hsu and coauthors state this directly. A safety guarantee is not absolute safety, but a description of the conditions under which a system will avoid a specified class of catastrophic failures. These conditions are called an operational design domain (ODD), a term the authors take from SAE J3016. Ada's filter has this ODD: the wheeled base can execute the command in time, camera error does not exceed the margin, and every obstacle appears on the map.
In their 2021 safe-learning survey, Brunke and coauthors divide guarantees into three levels. At level III, a constraint always holds; at level II, it holds with a specified probability; at level I, safety is only encouraged—for example, through a penalty in the reward, as in the reinforcement-learning lessons. They place filters and barrier functions in the group of methods that certify a learned controller after training. Such methods typically provide level II or III, but only within the model assumptions. If the barrier-function derivative is itself learned with error, a filter may pass a command it incorrectly judges safe.
This is why a product needs engineering around the filter. The base model is validated on the real robot; if it is more complex than “velocity equals command,” the barrier function must match that model. Ames and coauthors developed exponential barrier functions precisely for systems in which commands change acceleration. The margin is chosen from measured perception error. A separate perception system supplies the obstacle map, and its errors are the hardest part. Hsu and coauthors write that occlusions and sensor failures can seriously threaten operation, and call the connection between guarantees, camera input, and learned representations an important open problem.
Some requirements come from standards rather than an engineer. Three ISO documents are especially relevant for robots. Their full text is not publicly available, so the table lists only each title and scope.
Standard titles and scopes follow the abstracts on iso.org. As of the access date, the new edition of ISO 13482 titled “Robotics — Safety requirements for service robots” had not yet been published.
Under this classification, Ada is closest to the mobile servant robot in ISO 13482. Engineers decide how to meet such requirements for a neural-network-controlled robot, and a safety filter is one of their tools. It turns “the policy almost always avoids the obstacle” into a testable condition with known assumptions.
A safeguard as a separate system layer
The core idea that persists in 2025–2026 systems is the separation principle from the Hsu survey: the task policy does not reason about safety, and the filter does not reason about the task. A team can fine-tune or replace the policy without proving safety again, as long as the filter and its assumptions remain unchanged. The survey also explains how a filter can support training. With it, an ordinary reinforcement-learning algorithm can explore and update the policy without damaging the robot. This addresses the difficulty that forced Ada to learn from logs in Lesson 5.6: every new real-robot trial carries a collision risk. Brunke and coauthors demonstrated the idea in safe-control-gym. An MPSC filter on top of an undertrained PPO policy kept the system within its constraints and intervened most often near their boundaries.
The largest open questions appear where the filter lacks a model. Barrier functions and shields rely on known geometry and dynamics, neither of which is exact for a domestic robot with a camera and neural perception. Filters based on learned safety estimates scale better, but, as Hsu and coauthors note, no longer provide guarantees. Probabilistic guarantees are possible only when training and deployment share the same data distribution. Standards are changing as well: ISO 10218 received a new edition in 2025 and absorbed collaborative-robot requirements, while a replacement for ISO 13482 is in preparation for service robots.
Eight common misconceptions
Lesson takeaways
- A learned policy fails rarely and unpredictably. Without a safeguard, Ada touched the kettle in 7 of 100 runs—each time when it stood almost on the route centerline and the demonstrations went left around some such kettles and right around others.
- The barrier function is the margin to the safe-set boundary. The rule means that the margin may shrink no faster than , and approach is forbidden altogether on the boundary.
- At every step, a safety filter solves a small optimization problem: it finds the velocity nearest the policy command that satisfies the rule. It changes only approach toward the obstacle and works on top of any policy. In the same 100 runs, the filter eliminated contact.
- Conservatism costs time; aggressiveness costs the guarantee. At , successful runs took 8.32 s instead of 5.39 s and 5 runs timed out. At , contact returned in 3 runs because the filter began braking after the base could no longer stop in time, and the condition was violated.
- The filter guarantees only what it knows. With a 10 cm camera error and a 5 cm margin, there were 5 contacts. Ada touched an unmapped basket 27 times. With the basket on the map there was no contact, but 21 of 100 runs timed out.
- A shield applies the same idea to discrete actions. From a specification synthesized in advance, it removes unsafe actions before the agent chooses or replaces an unsafe action afterward.
Open questions
Where does a barrier function come from when the world is visible only through a camera?
The lesson's filter knew the geometry: it represented the kettle as a circle and took its center from the camera estimate. A domestic robot faces obstacles of arbitrary shape, some occluded by other objects, and perception is a neural network. Hsu and coauthors call the connection between guarantees, camera input, and learned representations an important open problem. Filters built on learned safety estimates scale better but provide no guarantee. Probabilistic guarantees are possible only when training and deployment share the same data distribution.
How can a filter avoid obstructing the task?
The filter and policy are decoupled, and Brunke and coauthors warn that behavior may become suboptimal when a learned controller repeatedly tries to violate a constraint—exactly what happened to Ada near the basket. In their CLF-CBF QP, Ames and coauthors relax the goal, not safety. Hsu and coauthors show another route: if reinforcement learning includes the filter's effect in the reward, the policy reaches the boundary less often and interventions become less frequent. How to combine this with policies trained from demonstrations remains open.
Paper guide
- Read closelySection II.B: the safe set, Definitions 1–2, Remark 4 on the special case , and Theorem 2. Section II.C: the CBF-QP as the smallest correction to a command, and the CLF-CBF QP, where the goal is relaxed for safety. Section V.C: the Segway on which a barrier function acts as a safety filter.
- Can be skimmedSection III on constructing barrier functions under actuator limits and the derivations in Section IV if you do not need the formal proof; Section V.D on long-duration autonomy for a robot group on a first reading.
- Question to keep in mindWhy does the CLF-CBF QP add a slack variable to the stability condition rather than the safety condition? What does that imply for Ada stopped beside the basket?
Other papers in this lesson: the safety-filter survey (Hsu, Hu, Fisac, 2023) for the filter definition, separation principle, discrete time, and perception; the safe-learning survey in robotics (Brunke et al., 2021) for guarantee levels and three method families; and shielding for reinforcement learning (Alshiekh et al., 2017).
Resources
- safe-control-gymBrunke and coauthors' benchmark: constrained cart-pole and quadrotor tasks, safe-learning methods, and filters
- safe-rl-shieldingShield implementation from the Alshiekh paper
The safety filter prevents a collision but does not help Ada finish the task. With the basket on the map, 21 of 100 runs ended with Ada stopped at a boundary. A robot, however, is measured by the fraction of tasks it completes.
Lesson 8.3 · Reliability: how a long task moves from 90% to 99.9%