Pessimism Only Where It Pays: Separating Robot Model Error from Moving-Obstacle Uncertainty in Zero-Shot Safe Transfer

A robot trained in simulation and deployed with no real-world fine-tuning faces two different kinds of surprise. The first is that its own body behaves differently than the simulator said: motors lag, friction is off, the payload is heavier. The second is that the world moves. Pedestrians, other vehicles, and co-workers follow paths the robot cannot know in advance. Current methods for safe zero-shot transfer handle one surprise and assume the other away. Methods that train across many randomized simulators, and penalize actions on which those simulators disagree, have produced zero physical violations on real robots, but only among fixed obstacles. Methods that plan carefully around moving obstacles assume the robot's own equations of motion are known exactly.

We propose to handle both, and our central claim is that they must be handled differently. Uncertainty about the robot's own dynamics cannot be observed within an episode and may extend beyond anything the simulator covered, so it deserves pessimism. Uncertainty about where an obstacle will go is mostly revealed by watching the obstacle, and most of it cannot be changed by the robot's action. Folding it into the same pessimism penalty charges the robot for uncertainty it can neither reduce nor avoid, and the result is a robot that refuses to move. We build a factored safety cost that is pessimistic about the robot and belief-conditioned about the obstacles. We then test, in a design that varies the two surprises independently, whether this removes the freezing that a naive extension of existing methods would produce.

Core Claim and Mechanism

The starting point is SPiDR (SPiDR: A Simple Approach for Zero-Shot Safety in Sim-to-Real Transfer). It keeps an ensemble of simulators with randomized physics, a practice known as domain randomization. It measures how much the ensemble disagrees about the next state, $\upsilon(s,a)$, and trains against the inflated cost $c(s,a)+\lambda\upsilon(s,a)$. On a Unitree Go1 and a 1/10-scale race car it satisfied constraints 100% of the time, while plain domain randomization had 26.1x and 6.2x more violations respectively. All of its obstacles were stationary.

The obvious extension randomizes obstacle behavior as well and keeps the single variance penalty. We predict this fails for a specific reason. When the state contains obstacle positions, much of the ensemble variance in the next state comes from obstacle motion that does not depend on the robot's action. That variance raises the cost floor everywhere near obstacles, which shrinks the constraint budget toward infeasibility. It grows with obstacle density, so in crowds the policy's best response is to stop. This is the freezing-robot failure that SPiDR itself flags as a theoretical risk when $\lambda$ is large.

Write the state as $s=(x,o)$, with $x$ the robot's state and $o$ the obstacles' state. Let $\theta$ be the randomized robot parameters, $b$ the randomized obstacle-behavior parameters (goal, speed, reactivity, intent), and $h$ the observed history of obstacle motion. Our factored cost is

$$\tilde c(s,a,h) = \mathbb{E}_{b\sim q(b\mid h)}\big[c(x'_{\bar\theta}, o'_b)\big] + \lambda\, \mathrm{Var}_{\theta}\big[x'_\theta \mid s,a\big].$$

Here $q(b\mid h)$ is a learned posterior over obstacle behavior given what has been observed, $x'_{\bar\theta}$ is the robot's ensemble-mean next state, and the variance term is SPiDR's penalty restricted to the robot's own coordinates. The robot-side term is action-dependent and irreducible within an episode, so pessimism there buys safety. The obstacle-side term is an expectation under a belief that sharpens as the obstacle is observed. Within a short horizon we add a hard margin from the obstacle's physically reachable set (maximum speed times time), so a never-seen behavior cannot produce an unbounded surprise.

The penalty weight $\lambda$ is heuristic in SPiDR. We calibrate it by holding out a shell of robot parameters just outside the training support, including delays and friction values the ensemble never saw. We then pick the smallest $\lambda$ that keeps held-out violations under budget. This replaces trial-and-error with a sim-only proxy for an out-of-support reality gap.

Relation to Prior Work

Two groups of work motivate the proposal, and each assumes away half of the problem.

On the transfer side, SPiDR and dynamics randomization for locomotion and manipulation (Sim-to-Real: Learning Agile Locomotion For Quadruped Robots, Sim-to-Real Transfer of Robotic Control with Dynamics Randomization) randomize the robot and keep the world still. We reuse SPiDR's ensemble-variance penalty but restrict where it applies.

On the dynamic-world side, three papers let the world move but take the robot's model as given. The Density Planner (Density Planner: Minimizing Collision Risk in Motion Planning with Dynamic Obstacles using Density-based Reachability) propagates uncertainty distributions through known ego dynamics among real inD road users. Human-Robot Gym's SaRA shield (Human-Robot Gym: Benchmarking Reinforcement Learning in Human-Robot Collaboration) overrides actions using reachability with known robot kinematics. Schmerling et al.'s importance-sampling certificates (Evaluating Trajectory Collision Probability through Adaptive Importance Sampling for Safe Motion Planning) assume known dynamics and explicitly note that static-obstacle certificates break once agents move. We keep their forward-predictive treatment of obstacles and drop the known-robot-model assumption.

Space2Time (From Space to Time: Enabling Adaptive Safety with Learned Value Functions via Disturbance Recasting) is the nearest attempt to mix both kinds of uncertainty. It recasts spatial wind disturbances as time-varying bounds for reachability-based safety on Crazyflies. Its exogenous uncertainty is a smooth field rather than discrete, reactive agents. It also constrains our design, because its worst-case reachability baseline was safe but "likely didn't move much." That result is direct evidence that uniform worst-case treatment of exogenous uncertainty freezes the robot.

The tabular certified-mismatch work (Provably Safe Sim-to-Real Transfer) assumes stationary transitions. Its confidence sets would be invalidated by moving obstacles, which is why we do not attempt formal certificates here.

Research Program

We will build moving-obstacle versions of three environments. Each obstacle's behavior is drawn from a parameterized family: goal-seeking with random goals, constant velocity with random turns, and social-force reactive agents with random reactivity. The robot's physics is randomized as in SPiDR.

The posterior $q(b\mid h)$ is a small recurrent encoder trained in simulation to predict obstacle futures. During training we sample $K$ robot models and $M$ behavior draws per state on GPU physics (MJX, as SPiDR does). Only the robot coordinates contribute to the variance term.

The evaluation separates the two surprises. "Reality" is a simulator whose robot parameters lie in the held-out shell, with added actuator delay. Its obstacles follow recorded real trajectories that were never used in training: inD road users and Vicon human motion from Human-Robot Gym. This lets us move the endogenous gap and the exogenous novelty independently. If the simulation results hold, we will run a hardware check on the 1/10-scale race car platform, with a second remote-driven car or walking people as moving obstacles.

Baselines

The naive reference is standard domain randomization over both robot and obstacle parameters, trained with PPO-Lagrangian. Safety Gymnasium (Safety Gymnasium: A Unified Safe Reinforcement Learning Benchmark) reports that PPO-Lag cut safety violations by 98% relative to PPO, at a 45% cost in reward, in velocity tasks. Beating it means fewer violations at equal or higher success.

The strongest existing method is SPiDR. We run it two ways. The first is SPiDR-static: trained among fixed obstacles as published, then deployed among moving ones. The second is SPiDR-joint: obstacle behaviors are randomized and the full-state variance is penalized. SPiDR-joint is also the key ablation, because it differs from our method only in how uncertainty is factored.

For SPiDR the file gives hardware numbers: 100% constraint satisfaction on the race car, and 6.2x more violations for plain domain randomization. There is no reported result on Lacuna for SPiDR on Safety Gym PointGoal2, or on any moving-obstacle task. We will therefore generate those numbers ourselves.

The third baseline is a SPiDR-static policy wrapped in a SaRA-style reachability shield that assumes nominal kinematics, following Human-Robot Gym. The fourth is a worst-case variant that replaces our belief expectation with the obstacle's full reachable set over the whole horizon, in the spirit of Space2Time's worst-case baseline. On the inD planar task we also run the Density Planner with nominal dynamics. It reports 90% simulation success and 24 of 30 inD scenarios, which gives a reference point for a planner that knows the robot model.

Further ablations remove the belief conditioning, using the prior over $b$ instead of $q(b\mid h)$, and remove the robot variance term.

To keep the comparison fair, every learned method gets the same simulator, the same number of environment steps, the same five seeds, and the same size of grid over its penalty weight or Lagrange settings. All are selected on the same held-out shell. Our method beats the field if it matches SPiDR-joint's violation rate while reaching the goal substantially more often. It must also avoid the violations of the shield and the plain randomization baselines once the robot's parameters are pushed outside the training support.

Why not just…?

Why not just extend SPiDR by randomizing obstacles too? This is the real threat, and it is the ablation the proposal is built around. Our argument that it freezes rests on the claim that action-independent obstacle variance only raises the cost floor. If SPiDR-joint shows no loss in goal-reaching as obstacle density rises, the factoring is unnecessary and we will report that.

Why not just train SPiDR among static obstacles and add a reactive braking or shield layer for moving ones? Schmerling et al. note that a state that is safe now can become an inevitable collision a moment later, so reactive checks without forward prediction cannot guarantee avoidance. SaRA-style shields also compute their fallback motion from nominal kinematics, which the reality gap corrupts. Our out-of-support robot shell tests exactly this failure: we expect overshoots and deadlocks from the shield there.

Why not just use worst-case reachability over all obstacle motions? Space2Time's worst-case reachability baseline had 0% violations but barely moved. The Density Planner reports that robust tube-based MPC fails in crowded scenes. Worst-case reachability is also limited to about six state dimensions (Refining Control Barrier Functions through Hamilton-Jacobi Reachability). We include it to measure the freezing directly, not as a straw man.

Decisive Experiments

The main result is a two-by-two grid. One axis is the endogenous gap: in-support versus held-out robot parameters. The other is exogenous novelty: synthetic versus recorded real obstacle motion. Across the grid we sweep obstacle density on the Safety Gymnasium point robot, the Human-Robot Gym reach and handover tasks, and an inD-driven planar navigation task.

We report four metrics: violation rate, goal-reaching rate, a freezing rate (episodes that time out with no collision), and median time to goal.

The proposal succeeds if three things happen together. First, SPiDR-joint's freezing rate climbs with density while ours stays flat at comparable violation rates. Second, removing the robot variance term causes violations in the held-out robot shell. Third, removing belief conditioning causes violations or freezing under recorded real obstacle motion. The calibration check succeeds if the $\lambda$ chosen on the held-out shell keeps violations under budget on a second, disjoint shell.