Learning to Get Unstuck: Stall-Triggered Recovery for Sim-to-Real Robotic Insertion

Robot arms trained in simulation to insert pegs, gears and connectors now transfer to real hardware with high success. Their main remaining failure is mundane: the part wedges. Real friction, tolerances and actuator lag differ from the simulator, the part jams partway in, and the policy keeps pushing against a rigid boundary until the episode times out. This proposal makes "the part has stopped moving" an explicit signal. A cheap stall detector reads robot telemetry that looks the same in simulation and on the real arm. During training in simulation it does two jobs. It changes the reward so that backing out of a jam is not punished as lost progress, and it saves jammed states so that the rare event of getting unstuck can be practiced many times. At deployment the same detector hands control to a recovery policy trained on those saved states.

The claim is that one stall signal can link three problems that are usually handled separately. The first is the search for a good moment to switch from pushing forward to exploring. The second is the sparse, delayed reward for actually escaping a jam. The third is the sim-to-real gap, which is what creates jams the simulator rarely produces. The concrete goal is to beat the IndustReal zero-shot pipeline on its own hardware tasks under tighter, higher-friction conditions. A second goal is to show which of the detector's three roles carries the gain.

Where the opening is

IndustReal trains insertion policies in the Factory simulator. Factory is a GPU contact simulator for assembly (Factory). IndustReal's training combines three pieces: dense rewards computed from signed distance fields (smooth measures of how far one part's surface is from another's), a sampling-based curriculum, and simulation-aware policy updates (SAPU) that discount reward when meshes interpenetrate. On a real Franka Panda arm it adds a policy-level action integrator (PLAI), which applies each action to the last commanded setpoint rather than the current pose. The pipeline reaches 83–99% zero-shot success over 600 real trials, and the authors name wedging and jamming as the main remaining failure. They leave tactile jam resolution to future work. This paper motivates the proposal and supplies most of the method. We keep its rewards, SAPU and PLAI unchanged.

Prior work on stagnation switching supplies the trigger idea but not the setting. iSAGO detects when an arm's trajectory optimizer is stuck. Its test is the angle between the obstacle-repulsion gradient and the accumulated objective gradient. When stuck, it switches from accelerated gradient descent to a stochastic mode. SD-SMHA* watches a sliding window of heuristic cost and turns on backup heuristics only when progress stops. BO-Leap ends local descent in differentiable simulation when the loss and gradients stall, then hands control to evolutionary or Bayesian search. All three switch inside an offline optimizer over kinematic or open-loop parameters. None switches inside a closed-loop feedback policy acting on a real contact. All three also set thresholds by hand, which the research file flags as brittle.

Recovery from contact failure has been studied at coarser time scales. Interpreting Contact Interactions to Overcome Failure in Robot Assembly Tasks interprets force traces from a failed attempt to update beliefs about where the hole is before the next attempt. This cut human interventions on a 5-peg task from 26.4% to 2.2%. Its work happens between attempts and only in simulation. We act within an attempt, on hardware. State Revisit and Re-explore resets the simulator to high-value states drawn from offline real-world data, which sharply reduces exploration cost under a dynamics mismatch. That reset idea is close to ours. The difference is that our reset states are failure states that the detector itself finds online in simulation, and no real dataset is required. Active task-oriented exploration probes real hardware in a separate calibration phase before the task. Our probing stays off until a stall occurs.

Work on dense rewards constrains the design. VLAC shows that a learned progress critic can turn sparse real-robot rewards into dense ones, raising success from 30% to 90% in 200 episodes. It also documents a weakness: because the critic assumes progress rises over time, it penalizes the retreat that recovery needs. The signed-distance rewards in IndustReal share this problem, since pulling a wedged peg back increases its distance to the goal. The BRIO labyrinth work adds a second warning: greedy dense rewards lead agents into dead ends. Our reward gating is designed in response to both papers.

Core mechanism

Under PLAI, a jam has a clear signature. The commanded setpoint keeps moving along the insertion axis, but the measured pose does not, so the gap between them grows. The detector uses this signal together with a force-direction check in the spirit of iSAGO. Let $\Delta z^{\text{cmd}}_k$ and $\Delta z^{\text{ach}}_k$ be the commanded and achieved displacements along the insertion axis at control step $k$. Over a window of $W$ steps we compute

$$ s_t = \frac{\sum_{k=t-W}^{t} \Delta z^{\text{ach}}_k}{\sum_{k=t-W}^{t} \Delta z^{\text{cmd}}_k + \epsilon}, $$

where $\epsilon$ is a small constant that prevents division by zero. A stall is declared when $s_t < \tau_s$, the measured contact force exceeds $f_{\min}$, and the angle between the measured force and the commanded motion exceeds $\phi_{\text{tol}}$, all for $W$ consecutive steps. Every quantity here comes from joint encoders and the wrist force/torque sensor, and each takes a few arithmetic operations at 1 kHz. This keeps the detector clear of the latency problem of language-model or Gaussian-process monitors.

To address threshold brittleness, the thresholds $(W, \tau_s, \phi_{\text{tol}})$ are not hand-tuned. They are chosen in simulation to hit a target false-alarm rate, such as 2% of nominal successful rollouts triggering. Among the settings that meet this rate, we pick the one that detects jams fastest. Whether that false-alarm rate holds on real hardware is a falsifiable prediction, and we test it directly.

The detector plays three roles. First, it gates the reward. In nominal mode the insertion policy receives IndustReal's signed-distance reward. Once a stall fires, a separate recovery policy takes over for at most $H$ steps, under a reward that ignores lost signed-distance progress inside a bounded retreat radius. The recovery reward is

$$ r^{\text{rec}}_t = \mathbb{1}[\text{nominal progress resumes within } K \text{ steps of handback}] - \lambda \lVert F_t \rVert, $$

where the indicator equals 1 if the insertion policy, after regaining control, raises $s$ above $\tau_s$ within $K$ steps, $F_t$ is the measured contact wrench, and $\lambda$ is a small penalty weight on force. SAPU's interpenetration discount still applies, so recovery exploration in the simulator cannot succeed by clipping through the hole wall. Without this, the policy would exploit the simulator in exactly the way the file warns about. The episode's sparse success reward is shared by both policies.

Second, the detector builds a stall archive. Getting unstuck is rare and its reward is sparse, so every simulated state where the detector fires is saved. A fraction of parallel Factory environments are then reset into these states. To make jams common enough to collect, training randomizes friction, clearance and lateral offset toward conditions that cause wedging.

Third, the detector switches modes at deployment. On the real Franka, the same detector with the same thresholds triggers the recovery policy. Control returns to the insertion policy when $s$ recovers or the horizon $H$ runs out.

Research Program

The work proceeds in three stages. The first is a characterization study. We replay IndustReal policies in Factory and on hardware under tightened clearance and raised friction. We log stall signatures and measure how often failures are stalls rather than misses, and how separable the stall statistic is between jammed and nominal rollouts in each domain. If real jams do not appear as low $s_t$ with high force, the detector design is wrong, and we find out before training anything.

The second stage trains the recovery policy with the stall archive and reward gating, using IndustReal's training budget. The third stage is real deployment and ablation. Where possible, all runs use IndustReal's released assets and library from IndustRealKit, on peg, gear and NEMA connector tasks.

Baselines

The do-nothing reference is the IndustReal policy deployed as published, with PLAI and no stall handling. Its reported figure is 83–99% zero-shot success across 600 real trials on the nominal tasks (IndustReal), and 82–99% in simulation. We rerun it on our hardware under both nominal and stressed conditions, so that every method faces the same parts, start poses and seeds. On nominal conditions, the proposal must not fall below this baseline, since unnecessary triggers could slow or derail insertions that would have succeeded. On stressed conditions it must beat the baseline clearly. We define the bar as at least a 10-point gain in success with lower 95% confidence bounds that do not overlap.

The strongest simple competitor is a hand-coded watchdog. It uses the same calibrated detector, but on a trigger it runs a fixed retract-and-spiral routine of the kind industry has used for decades. It shares our detector and thresholds, so it isolates whether learning the recovery matters at all.

The strongest learned competitor is IndustReal retrained with the same jam-inducing randomization and the same stall-archive resets, but as a single recurrent policy with no explicit switch and no reward gating. It is trained with the same number of simulator steps and the same hyperparameter search budget. It tests whether an explicit mode switch adds anything beyond exposure to jams. The bi-manual assembly results suggest it might not, since recovery behaviors emerged there from simulated perturbations alone.

We also run an abort-and-retry baseline in the spirit of Interpreting Contact Interactions. On a stall it fully withdraws and restarts with a fresh offset sample. This tests whether recovery needs to happen within the attempt.

Two ablations isolate the proposal's ingredients. One removes reward gating and trains recovery under the standard signed-distance reward, which tests the monotonicity concern raised by VLAC. The other removes the stall archive and trains recovery only on jams encountered naturally.

The research file contains no learning-based recovery numbers on stressed IndustReal tasks. No reported result was found on Lacuna for jam-recovery success on the IndustReal suite. All stressed-condition numbers will therefore come from our own reruns.

Why not just…?

Why not just randomize physics harder so the policy never jams? The research file reports that wide randomization yields conservative, imprecise behavior (Active task-oriented exploration) and can make tasks unlearnable (DrEureka). IndustReal already tuned its simulation heavily, and jamming persisted. Our recurrent-policy baseline gives randomization its best case, because it receives the same jam-inducing randomization and the same archive. If it matches the switched system, we will report that the switch is unnecessary and that the archive is the contribution.

Why not just add a timeout with a fixed spiral search? This is a real threat on round pegs, where spiral search was designed to work. The evidence against it as a general solution is indirect. Non-adaptive search left 26.4% human interventions in Interpreting Contact Interactions, and fixed patterns have no obvious extension to asymmetric parts such as NEMA connectors. The watchdog baseline uses our detector, so any gap between it and our method is attributable to the learned recovery. We expect the gap to be small on pegs and large on connectors and gears. If it is small everywhere, the honest conclusion is that a well-calibrated detector, rather than learned recovery, is the useful finding.

Why not just collect teleoperated demonstrations of wiggling, as TacDiffusion does? TacDiffusion reaches 95.7% zero-shot success across geometries with clearances down to 0.02 mm. It needed 1,500 real demonstrations for one training shape, and its wiggling emerges from human data rather than from any trigger. Our method uses no real demonstrations. We do not rerun TacDiffusion, because its data and hardware setup differ from ours. We cite it as evidence that force-domain recovery is achievable, not as a like-for-like comparison.

Decisive checks

Five measurements decide whether the idea works. The first is whether real-world false alarms on nominal successful trials stay near the 2% simulation target. If the rate is several times higher, the detector does not transfer and the switching story fails.

The second is the stressed-condition comparison. We measure success, time to insertion, peak wrench, and the fraction of detected stalls resolved, comparing against the do-nothing policy, the watchdog and the recurrent baseline. Each condition uses the same 50 trials per task under fixed seeds.

The third is the gating ablation, where we expect to see the frozen-recovery behavior VLAC describes. The recovery policy should retreat less and resolve fewer stalls when lost signed-distance progress is penalized.

The fourth is an interpenetration audit of the recovery policy in simulation. It checks that recovery success does not depend on clipping through parts.

The fifth is nominal-condition success, which must stay within IndustReal's reported 83–99% band. If the proposal loses there, its gains under stress are bought with regressions elsewhere.