Same start, same driver, same physics; only the certifier / shield differs. Map colours as in the mini-map. In-browser simulation (exploratory).
unsafecrashunseen
Pink = trap. Click one to start there.
You can skip the jargon
A safety guard that can be wrong
- The robot has a guard. When the guard thinks a crash is coming, it grabs the wheel. Like an automatic emergency brake.
- The guard practised on incomplete data. The dashed blue zone is ice / weak brakes / a current it never saw. Real physics there are worse than it thinks.
- Pink = the bug this site measures. The guard still says “safe”, but a crash is already unavoidable. We call that false-safe.
Map colours, keys, and how to plug in your own guard · Point at each panel
Reading the screen
Map (top right): every possible position and speed. Green = safe and the guard knows it. Pink = the guard thinks it is safe but it is not (a trap). Amber = over-cautious. Dark = truly unsafe. The dashed blue band is where the real physics differ from the guard's model. Left panel: “What just happened” explains each event in plain words. The score adds 10 per second survived and 20 per second near the goal, and takes off 100 per crash.
Keys
←→ / AD and ↑↓ / WS drive (gamepad left stick and the on-screen pad work too) · Space shield on/off · R reset · T random start · P pause · L replay last episode · N/Shift+N next/prev scenario · V compare side by side · U copy share link · H/? this help · Esc close · C next certifier · M next driver (manual / go-to-goal / random / adversarial) · B batch · [/] rewind / step forward one frame (Shift: 10 frames) · H this help.
New: see the mistake happen
Timeline (bottom): the green line is the true safety value, the blue line is what the guard believes. Where blue is above zero but green is below, the stretch is shaded pink: that is a false-safe trap. Drag across it to rewind the episode and see where the robot was. Map: hover any point for its values, click to start an episode right there (try a pink spot). Danger vs. caution chart (left): every rule-book's false-safe and false-unsafe volume, computed in Python; switch to gap only to see that most of the danger lives where the training data was missing. Shield trigger margin (exploratory): move the dotted line and watch the guard step in earlier or later.
For the technically curious (the maths)
Each scenario is a system with hidden physics (a region, the gap, where the true dynamics differ from the model the certifier was built on), a hazard, and a choice of certifiers. The shield lets your input through while the certifier's value V̂(x) ≥ margin; otherwise it overrides you with the candidate control that maximises V̂ one step ahead under the nominal model (exactly lcert.framework.policies.SafetyFilter).
V_true is the HJ ground truth under the true dynamics. Where V̂ ≥ 0 but V_true < 0 the state is FALSE-SAFE: the shield believes you are fine but a crash is unavoidable. Try it: switch to the naive certifier, drive into the gap, and watch the shield fail to save you; then pick a robust-margin certifier or the oracle.
Mini-map (top right): classification of V_true vs V̂ over the first two state axes (for 3D systems: at the current heading), your position and trail. Scoring: +10/s survived, +20/s near the goal, −100 per crash.
Try your own rule-book
Write a certifier in Python, register it, and it appears in this gym next to the built-in ones. Save this as my_certifier.py (it is also in examples/framework/):
# my_certifier.py: your own safety check, shown in the gym next to the built-in ones.
import numpy as np
from lcert.framework import CertifierOutput, NominalInflatedCertifier, register_certifier
from lcert.framework.gym import Scenario, register_scenario
@register_certifier("cushioned_nominal")
class CushionedNominal:
"""The naive model's answer, minus a fixed safety cushion (bigger cushion = more cautious)."""
name = "cushioned_nominal"
def __init__(self, cushion=0.3):
self.cushion = cushion
def certify(self, env, grid): # must never look at the true answer
v = NominalInflatedCertifier(k=0.0).certify(env, grid).value
return CertifierOutput(np.asarray(v) - self.cushion, {"cushion": self.cushion})
register_scenario(Scenario(
"my_cart", "My certifier vs the naive one (cart vs wall)", "di_hidden_physics", {"horizon": 2.5},
[{"label": "naive nominal model (k=0)", "certifier": "nominal_inflated", "params": {"k": 0.0}},
{"label": "my cushioned certifier (0.3)", "certifier": "cushioned_nominal", "params": {"cushion": 0.3}}],
render="cart", manual={"x": 0}, goal=[0.15, 0.0], start=[2.0, -0.5], start_box=([0.2, -1.5], [2.8, 1.0]),
user_defined=True, blurb="Made with examples/framework/my_certifier.py"))
Then export it and reload this page:
PYTHONPATH=src python -m lcert.framework.gym my_cart --plugin examples/framework/my_certifier.py python scripts/build_site.py # optional: rebuild the static site
A cushion of 0.3 cuts false-safe a lot but makes the guard over-cautious (more amber), so there is a trade-off to explore. Want a new environment, too? See examples/framework/my_rover.py and docs/FRAMEWORK.md. Your numbers are exploratory, like all in-browser numbers.
Honesty notes: numbers in the Score and Batch panels are in-browser simulations (exploratory, not preregistered results). The JS dynamics mirror the Python envs and are cross-checked against Python RK4 rollouts in tests/test_gym_js_parity.py; user-defined envs use dynamics tabulated on the grid by the exporter (interpolated, so approximate near discontinuities). Value grids are int16-quantised (error shown in Provenance). FSV/FUV/gap-FSV are computed in Python on the full grid.