SafeMind: A Risk-Aware Differentiable Control Framework for Adaptive and Safe Quadruped Locomotion
Authors: Zukun Zhang, Kai Shu, Mingqiao Mo
Organizations: The University of Hong Kong, Pokfulam, Hong Kong, China · Alibaba, Beijing, China · University of Chinese Academy of Sciences, No.1 Yanqihu East Rd, Huairou District, Beijing, China
Learning-based quadruped controllers achieve impressive agility but typically lack formal safety guarantees under model uncertainty, perception noise, and unstructured contact conditions. We introduce SafeMind, a differentiable stochastic safety-control framework that unifies probabilistic Control Barrier Functions with semantic context understanding and meta-adaptive risk calibration. SafeMind explicitly models epistemic and aleatoric uncertainty through a variance-aware barrier constraint embedded in a differentiable quadratic program, thereby preserving gradient flow for end-to-end training. A semantics-to-constraint encoder modulates safety margins using perceptual or language cues, while a meta-adaptive learner continuously adjusts risk sensitivity across environments. We provide theoretical conditions for probabilistic forward invariance, feasibility, and stability under stochastic dynamics. SafeMind is deployed on Unitree A1 and ANYmal C at 200~Hz and validated across 12 terrain types, dynamic obstacles, morphology perturbations, and semantically defined tasks. Experiments show that SafeMind reduces safety violations by 3--10x and energy consumption by 10--15% relative to state-of-the-art CBF, MPC, and hybrid RL baselines, while maintaining real-time control performance.
Figures & tables
Fig. 1: Overall architecture of SafeMind , a risk-aware differentiable control framework for adaptive and safe quadruped locomotion. Semantic cues and onboard sensory observations are encoded into task-dependent safety parameters (hs,α,κ) , which modulate the risk-aware differentiable safety layer. A stochastic Control Barrier Function (CBF) with variance-aware correction enforces the probabilistic safety constraint Lfh+Lghu+αh−κσh≥0 through a differentiable quadratic program, yielding the safe control command u∗ . A meta-adaptive learning module continuously updates risk sensitivity according to violation statistics and environmental shifts. The resulting controller operates in real time on quadruped platforms such as Unitree A1 and ANYmal C, enabling robust locomotion across uneven terrain, dynamic obstacles, and semantically defined hazards.
Fig. 2: Safety violation rate (SVR) and tracking RMSE over time for SafeMind and baseline controllers. Curves show mean performance across repeated trials; shaded regions denote 95% confidence intervals. SafeMind maintains near-zero violation rates while achieving the lowest tracking error, significantly outperforming Safety–MPC, Robust–MPC, BarrierNet, and RL–CBF under mixed-terrain conditions.
Method
SVR (%)
RMSE (cm)
E(N⋅m2)
Ta(s)
Robustness Index
Nominal MPC
7.84 ± 0.90
3.4 ± 0.3
1.00 ± 0.04
2.41 ± 0.13
0.52 ± 0.03
RL–CBF
5.21 ± 0.70
3.8 ± 0.4
1.09 ± 0.05
2.03 ± 0.11
0.56 ± 0.03
Safety–MPC
2.91 ± 0.40
3.1 ± 0.3
1.18 ± 0.05
1.54 ± 0.09
0.63 ± 0.03
Robust–MPC
2.44 ± 0.30
3.0 ± 0.3
1.21 ± 0.05
1.47 ± 0.08
0.67 ± 0.03
BarrierNet
1.96 ± 0.30
3.4 ± 0.3
1.13 ± 0.04
1.33 ± 0.08
0.71 ± 0.02
SafeMind (ours)
0.58 ± 0.10
2.8 ± 0.2
0.97 ± 0.03
0.88 ± 0.06
0.89 ± 0.02
TABLE I: Comprehensive locomotion performance across 12 terrain families. All values are reported as mean ± 95% CI across 2400 episodes unless otherwise stated. Lower is better for SVR, RMSE, E , and Ta . Robustness index is normalized, higher is better.
Transition
Method
ΔSVR (%)
Trec (s)
T1 → T5
Safety–MPC
3.8
1.72 ± 0.12
BarrierNet
4.6
1.41 ± 0.10
SafeMind
0.9
0.63 ± 0.05
T2 → T4
Safety–MPC
2.1
1.34 ± 0.10
BarrierNet
2.7
1.12 ± 0.09
SafeMind
0.6
0.48 ± 0.04
TABLE II: Safety degradation and recovery across terrain transitions. Trec is reported as mean ± 95% CI across repeated transition trials. Proportion-based metrics are reported as point estimates. ΔSVR is violation rate increase immediately after transition. Trec is time to recover safe-set invariance.
Method
0%
15%
25%
35%
Nominal MPC
3.2
7.4
10.1
15.6
BarrierNet
1.1
3.8
6.3
9.7
Robust–MPC
0.9
2.8
4.2
6.9
Safety–MPC
1.2
3.1
5.0
7.3
SafeMind
0.3
0.9
1.7
3.1
TABLE III: Impact of uncertainty scaling on safety violation rate (%). All values are reported as mean ± 95% CI across repeated trials unless otherwise stated.
Method
SVR (%)
RMSE [cm]
Impulse
Ta [s]
Nominal MPC
14.2
4.4 ± 0.3
1.82 ± 0.07
3.21 ± 0.18
BarrierNet
6.1
4.8 ± 0.4
1.63 ± 0.06
2.34 ± 0.14
Safety–MPC
4.3
4.2 ± 0.3
1.51 ± 0.05
1.89 ± 0.11
Robust–MPC
3.8
4.6 ± 0.3
1.49 ± 0.05
1.73 ± 0.10
SafeMind (ours)
1.12
3.6 ± 0.2
1.28 ± 0.04
1.02 ± 0.07
TABLE IV: Rocky Terrain Performance (T3, 200 episodes). Continuous valued metrics are reported as mean ± 95% CI unless otherwise stated. Proportion-based metrics are reported as point estimates.
Method
SVR (%)
RMSE [cm]
Energy
Jerk
Nominal MPC
16.7
5.2 ± 0.4
1.00 ± 0.04
1.00 ± 0.04
RL–CBF
11.4
5.6 ± 0.4
1.12 ± 0.05
1.19 ± 0.05
BarrierNet
7.9
5.8 ± 0.4
1.10 ± 0.05
1.14 ± 0.05
Robust–MPC
6.3
5.4 ± 0.4
1.18 ± 0.05
1.21 ± 0.05
SafeMind (ours)
1.94
4.3 ± 0.3
0.93 ± 0.03
0.87 ± 0.03
TABLE V: Rubble Field Traversal (T8). Continuous valued metrics are reported as mean ± 95% CI unless otherwise stated. Proportion-based metrics are reported as point estimates.
Method
SVR (%)
Success (%)
RMSE [cm]
Ta [s]
Nominal MPC
22.5
61.3
5.1 ± 0.4
4.10 ± 0.22
BarrierNet
9.7
82.0
4.8 ± 0.3
2.66 ± 0.15
Safety–MPC
7.4
88.1
4.6 ± 0.3
2.21 ± 0.13
Robust–MPC
5.6
90.8
4.9 ± 0.3
2.08 ± 0.12
SafeMind (ours)
1.85
97.2
3.7 ± 0.2
1.12 ± 0.07
TABLE VI: Gap Crossing Performance (T9). Continuous valued metrics are reported as mean ± 95% CI unless otherwise stated. Proportion-based metrics are reported as point estimates.
Method
SVR (%)
Lateral RMSE [cm]
Energy
Jerk
Nominal MPC
19.8
4.2 ± 0.3
1.00 ± 0.04
1.00 ± 0.04
BarrierNet
8.9
3.8 ± 0.3
1.13 ± 0.05
1.21 ± 0.05
Safety–MPC
6.3
3.5 ± 0.2
1.17 ± 0.05
1.27 ± 0.05
Robust–MPC
4.1
3.6 ± 0.3
1.22 ± 0.05
1.25 ± 0.05
SafeMind (ours)
1.02
2.4 ± 0.2
0.91 ± 0.03
0.83 ± 0.03
TABLE VII: Narrow Corridor Navigation (T11). Continuous valued metrics are reported as mean ± 95% CI unless otherwise stated. Proportion based metrics are reported as point estimates.
Method
SVR (%)
RMSE [cm]
E
Ta [s]
Nominal MPC
14.8
4.1 ± 0.3
1.00 ± 0.04
3.88 ± 0.21
BarrierNet
5.3
4.4 ± 0.3
1.11 ± 0.05
2.41 ± 0.14
Safety–MPC
3.7
4.0 ± 0.3
1.18 ± 0.05
1.97 ± 0.12
Robust–MPC
2.9
4.2 ± 0.3
1.21 ± 0.05
1.62 ± 0.10
SafeMind
0.77
3.3 ± 0.2
0.95 ± 0.03
0.89 ± 0.06
TABLE VIII: Mixed-Adversarial Terrain Transitions. Continuous valued metrics are reported as mean ± 95% CI unless otherwise stated. Proportion-based metrics are reported as point estimates.
Method
SVR (%)
RMSE [cm]
E
Success (%)
Nominal MPC
16.2
6.4
1.00
58.1
BarrierNet
8.3
6.1
1.11
72.4
Safety–MPC
5.6
5.4
1.14
78.6
Distributional RL
4.1
6.8
1.21
74.2
Ensemble–CBF
3.7
5.9
1.17
81.0
SafeMind
1.12
4.3
0.98
92.7
TABLE IX: Morphology Variation and Structural Disturbance.
Differentiable CBF–QP layer with fixed barrier parameters; cannot adapt risk to time-varying stochasticity
Safety– / Robust– / Stochastic MPC
Strong guarantees in deterministic or worst-case settings; high online cost and limited suitability for 200–250 Hz on-board control; not end-to-end differentiable
Ensemble–CBF
Uses model ensembles to capture epistemic uncertainty; still enforces deterministic CBF constraints without probabilistic invariance
RL–CBF
RL policy filtered by CBF QP; improves safety during learning but breaks differentiability and lacks explicit stochastic barrier modeling
Distributional RL
Learns risk-sensitive value distributions; no mechanism for state-wise safety invariance or hard constraints
Nominal MPC
High tracking performance but no safety guarantees; used as performance upper bound and safety lower bound
TABLE XVIII: Summary of baseline families and structural characteristics.
Differentiable CBF layer, MPC variants, ensemble- and RL-based controllers
Statistical reporting
Mean ± std., Wilson 95% CIs, paired bootstrap significance tests
TABLE XIX: Unified evaluation protocol used for all controllers.
Configuration
SVR (%)
RMSE (cm)
Energy
Full SafeMind
0.58
2.9 ± 0.2
0.96 ± 0.03
w/o Stochastic Term
3.74
3.3 ± 0.2
1.04 ± 0.04
w/o Risk Tightening (κ=0)
5.92
3.2 ± 0.2
1.03 ± 0.04
w/o Meta-Adaptation
1.48
3.1 ± 0.2
1.07 ± 0.04
w/o Semantic Encoder
2.61
3.5 ± 0.3
1.01 ± 0.03
Fixed (α,κ)
1.83
3.1 ± 0.2
1.02 ± 0.03
TABLE XX: Extended ablation across all simulation domains. Continuous valued metrics are reported as mean ± 95% CI unless otherwise stated. Proportion-based metrics are reported as point estimates.
Parameter Scaling
SVR (%)
RMSE (cm)
Energy
Mass +15%
0.72
3.1 ± 0.2
0.99 ± 0.03
Mass −15%
0.69
3.0 ± 0.2
0.98 ± 0.03
Friction −40%
1.31
3.4 ± 0.2
1.02 ± 0.03
Latency +20 ms
1.12
3.7 ± 0.3
1.05 ± 0.04
Control Frequency 100 Hz
1.84
3.3 ± 0.2
1.11 ± 0.04
Control Frequency 50 Hz
3.02
3.8 ± 0.3
1.20 ± 0.05
TABLE XXI: Sensitivity of SafeMind to parameter scaling. Continuous valued metrics are reported as mean ± 95% CI unless otherwise stated. Proportion-based metrics are reported as point estimates.
Terrain Transition
Mean κ
Std
Peak
Flat → Slippery
2.48 ± 0.14
0.91
4.83 ± 0.27
Soft → Rubble
3.07 ± 0.18
1.12
5.14 ± 0.31
Rubble → Gap
2.81 ± 0.16
0.97
4.55 ± 0.28
Gap → Flat
1.21 ± 0.09
0.41
2.19 ± 0.15
TABLE XXII: Statistics of risk sensitivity κ across terrain transitions. Mean and Peak are reported as mean ± 95% CI; Std denotes the empirical standard deviation of κ over the transition window.
Constraint
T2
T4
T5
T8
Foot Clearance
22.3
18.1
13.8
31.4
Body Tilt
11.8
33.2
24.9
29.5
Joint Limits
4.3
5.9
4.8
6.4
Semantic Boundaries
0.0
2.7
4.6
7.1
TABLE XXIII: Constraint activation frequencies (percentage of active cycles). All values are reported as point estimates across repeated runs.
Stress Scenario
SVR (%)
Failure Rate
Recovery Time (s)
50 N Push
1.14
0.0 (0/200)
1.25 ± 0.09
Friction Collapse
2.38
0.0 (0/200)
1.91 ± 0.13
300 ms Perception Drop
1.07
0.0 (0/200)
1.48 ± 0.10
10 cm Drop-off
1.44
0.0 (0/200)
1.72 ± 0.12
TABLE XXIV: Aggregated results under rare-event stress tests. Recovery time is reported as mean ± 95% CI. Proportion-based metrics are reported as point estimates. Failure rate is reported as observed episode-level failure percentage with count in parentheses.
Controller
150 s
300 s
450 s
600 s
Nominal MPC
4.2%
7.3%
9.7%
12.4%
Safety–MPC
1.9%
3.1%
4.8%
5.6%
BarrierNet
1.6%
2.8%
3.7%
4.2%
SafeMind
0.41%
0.58%
0.65%
0.71%
TABLE XXV: Long-horizon accumulated violation probability. All values are reported as mean ± 95% CI unless otherwise stated.
κ
SVR (%)
Energy
RMSE (cm)
0.5
1.82
0.91 ± 0.03
2.4 ± 0.2
1.5
0.93
0.95 ± 0.03
2.7 ± 0.2
3.0
0.58
0.96 ± 0.03
2.9 ± 0.2
5.0
0.41
1.04 ± 0.04
3.3 ± 0.2
TABLE XXVI: Safety–performance Pareto frontier for varying κ . Continuous valued metrics are reported as mean ± 95% CI across repeated trials. Proportion-based metrics are reported as point estimates.
Efficiently learning safe and agile quadruped navigation in densely cluttered environments remains difficult: existing methods often lack safety and agility, or become conservative in complex scenes and require long training schedules. We propose SEA-Nav (Safe, Efficient, and Agile Navigation), a safe reinforcement learning framework for quadruped navigation in cluttered environments. A differentiable control barrier function (CBF) shield constrains the policy to produce safe velocity commands. An adaptive collision-state initialization mechanism increases the probability of learning from safety-critical near-collision experience. An action regularization term further suppresses infeasible commands for physical deployment. The policy converges after about one hour of training on a single RTX 4090 and transfers zero-shot to real-world cluttered scenes.
Shiyi Chen, Mingye Yang, Haiyi Liu +6
Tsinghua University, Beijing, China. · Imperial College London, London, UK.
Achieving safe quadrupedal locomotion in real-world environments has attracted much attention in recent years. When walking over uneven terrain, achieving reliable estimation and realising safety-critical control based on the obtained information is still an open question. To address this challenge, especially for low-cost robots equipped solely with proprioceptive sensors (e.g., IMUs, joint encoders, and contact force sensors), this work first presents an estimation framework that generates a 2.5-D terrain map and extracts support plane parameters, which are then integrated into contact and state estimation. Then, we integrate this estimation framework into a safety-critical control pipeline by formulating control barrier functions that provide rigorous safety guarantees. Experiments demonstrate that the proposed terrain estimation method provides smooth terrain representations. Moreover, the coupled estimation framework of terrain, state, and contact reduces the mean absolute error of base position estimation by 64.8%, decreases the estimation variance by 47.2%, and improves the robustness of contact estimation compared to a decoupled framework. The terrain-informed CBFs integrate historical terrain information and current proprioceptive measurements to ensure global safety by keeping the robot out of hazardous areas and local safety by preventing body-terrain collision, relying solely on proprioceptive sensing.
Peiyu Yang, Jiatao Ding, Wei Pan +2
Dynamic Legged Systems, Istituto Italiano di Tecnologia (IIT), Italy · Department of Industrial Engineering, University of Trento, Italy · Department of Computer Science, University of Manchester, UK +2
Robot learning has produced remarkably effective ``black-box'' controllers for complex tasks such as dynamic locomotion on humanoids. Yet ensuring dynamic safety, i.e., constraint satisfaction, remains challenging for such policies. Reinforcement learning (RL) embeds constraints heuristically through reward engineering, and adding or modifying constraints requires retraining. Model-based approaches, like control barrier functions (CBFs), enable runtime constraint specification with formal guarantees but require accurate dynamics models. This paper presents SHIELD, a layered safety framework that bridges this gap by: (1) training a generative, stochastic dynamics residual model using real-world data from hardware rollouts of the nominal controller, capturing system behavior and uncertainties; and (2) adding a safety layer on top of the nominal (learned locomotion) controller that leverages this model via a stochastic discrete-time CBF formulation enforcing safety constraints in probability. The result is a minimally-invasive safety layer that can be added to the existing autonomy stack to give probabilistic guarantees of safety that balance risk and performance. In hardware experiments on an Unitree G1 humanoid, SHIELD enables safe navigation (obstacle avoidance) through varied indoor and outdoor environments using a nominal (unknown) RL controller and onboard perception.
Lizhi Yang, Blake Werner, Ryan K. Cosner +3
Mechanical and Civil Engineering, California Institute of Technology · Aerospace Engineering and Engineering Mechanics, UT Austin · Computer Science, Cornell University