Shape Change as a Reflex: Sim-to-Real Recovery Policies for Reconfigurable Robots

When a robot gets wedged in a gap, slips on a step, or loses motor strength, the usual fixes are all in software: retry, replan, or adjust the gait. Some failures, though, are geometric. A body that is too wide or too tall for where it is cannot be rescued by any controller. A robot that can change its own shape, by crouching, narrowing its stance, locking a joint, or lengthening a leg, has an extra way out. Nobody has trained such a robot to use that ability as a fast, automatic response to unexpected failure and then carried that skill from simulation onto real hardware. We propose to do this with a single memory-equipped control policy, trained in simulation, whose actions include both motor commands and shape commands. Two things are deliberately varied during its training. The first is a stream of injected physical failures. The second is the imperfections of the shape-changing mechanism itself, such as joints that do not lock exactly where commanded.

The opportunity sits between two bodies of work that do not talk to each other. Reconfigurable-robot research treats shape change as a planned mode switch: wheels for flat ground, legs for stairs. Error-recovery research treats recovery as symbolic replanning by a language model, which is too slow for contact-level failures and, by its authors' own account, breaks down exactly when the failure is physical. Our claim is that shape-change recovery should live at the control rate, inside the policy, and that the main obstacle to transferring it is a specific failure of standard simulator randomization. Randomization teaches the policy to stop reconfiguring at all.

Core Claim

Domain randomization means training across many randomly perturbed simulator settings so that the policy works on whatever the real robot turns out to be. Applied naively to a reconfigurable robot, we hypothesize that it produces "reconfiguration collapse." Shape transitions are the moments when the body is least stable and least predictable, so a policy averaging over wide uncertainty learns to avoid them. It ends up behaving like a conservative fixed-shape robot. Two training changes prevent this.

The first change randomizes the reconfiguration mechanism rather than only the world. This includes lock-angle error, backlash, lock compliance, transition latency, and link-length error. The policy then learns transitions that stay safe under these imperfections instead of learning to fear transitions in general.

The second change injects failures and gives credit specifically for recovery. Episodes contain sudden jams, motor-torque drops, and hidden clearance violations. When distilling into the deployable policy, we mask the loss on the actions that led into the failure and weight the loss on the corrective segment. This transfers the trick that AgentRefine uses for text agents, where training on erroneous trajectories with loss only on the corrective step stops agents from repeating failed actions. Here the idea is moved to continuous control.

The prediction is that the resulting policy recovers from geometric failures that a fixed-body randomized policy cannot recover from. It should do so without becoming more conservative on nominal terrain, and the behavior should survive transfer.

Relation to Prior Work

Three papers motivate the gap. Learning to Reconfigure splits the policy into separate heads that choose which joints to lock, at what angles, and with what torques. It reports 5.95x more traversal progress than single-body controllers and 9.81x more than fixed co-designed bodies. However, it schedules shape changes by terrain type, assumes perfectly rigid locks, and never randomizes or transfers. We reuse its three-head structure but trigger shape change from failure evidence and randomize the locks. Automated Shapeshifting for Function Recovery shows that reshaping beats controller re-adaptation after catastrophic damage. Its recovery comes from hundreds of generations of offline evolution, though, and the physical demonstration used manual inflation. We replace that evolutionary search with a reflexive policy. Conditional Multi-Stage Failure Recovery documents a "physical bottleneck": language-model diagnosis fails when the failure is low-level spatial misalignment. That observation is the reason we do not put a language model in the recovery loop.

Three papers supply methods. Dynamics Randomization shows that a recurrent policy's memory acts as an implicit online estimator of unobserved dynamics. Only the recurrent policy reached 0.89 ± 0.06 hardware success on puck pushing, against 0.67 for a randomized feedforward policy. We rely on the same mechanism to infer "I am stuck" and "my lock slipped" from recent history. Learning to walk in confined spaces supplies the training recipe: a teacher policy that sees privileged simulator state, distilled into a student that sees only onboard sensing. It also supplies a crouch-and-tilt quadruped command interface and the finding that fixed-height controllers fail in 40% to 100% of confined cases. Walking Posture Adaptation supplies the compact body-envelope description we use as the shape action space for legged hardware, with height and span as parameters.

Two papers constrain the design. RRLS reports that uniform randomization gives better average return while adversarial training gives better worst-case survival. That warns us to report both, since recovery is a tail-event problem. RGAT grounds the simulator with a learned action transformer. It was validated only on fixed-body MuJoCo surrogates, which we adopt as one evaluation protocol.

Research Program

The work proceeds in three stages.

Stage 1: measure reconfiguration collapse in simulation. We add a randomization layer to the Learning to Reconfigure multi-regime MuJoCo benchmark (Fly-Walk, Car-Leg, Wheel-Fly) and to a confined-space quadruped environment modeled on Miki et al. The layer randomizes friction, mass, latency, and observation noise. We then measure how often policies trigger shape changes as randomization width grows. This stage tests the core hypothesis directly, and it is cheap.

Stage 2: train the proposed policy. Training adds mechanism randomization and failure injection. Injected failures include wedging between procedurally placed obstacles, a sudden ceiling drop beneath the mapped clearance, partial torque loss, and lock slip. The teacher sees the ground-truth failure type. The recurrent student sees proprioception, motor currents, and a local occupancy map, and is trained with the recovery-weighted distillation described above.

Stage 3: transfer. We first evaluate on held-out perturbed simulators as surrogate "real" systems, following the RGAT protocol. We then move to two hardware tiers. The first is a quadruped whose body height, roll, pitch, and stance width act as the shape space. This "morphology" is a posture envelope rather than a true change of structure, and we treat it honestly as the low-risk tier. The second is a leg-length-changing robot of the lead-screw type built by Nygaard et al., where shape change is structural and lock imperfections are real.

Baselines

The naive reference is a fixed-body recurrent policy trained with standard dynamics randomization in the style of Peng et al., with shape actions disabled. It shows how much recovery is possible with software alone. Peng et al. report 0.89 ± 0.06 hardware success, but on a different task. We found no reported result on Lacuna for recovery rate on our failure suite, so this baseline must be run by us.

The strongest existing method is the three-head configuration-control policy of Learning to Reconfigure. We run it under the same randomization, simulator steps, network size, and hyperparameter search budget as our method. Its reported 5.95x and 9.81x progress gains were measured in nominal simulation without randomization. Beating it means a higher recovery rate on injected failures together with nominal traversal no worse than its own. Matching it on nominal terrain while losing on recovery would refute our claim.

A scripted-reflex baseline adds hand-written rules to the fixed-body policy, of the form "if motor current exceeds threshold, crouch and narrow by a fixed amount, then retry." A language-model diagnosis baseline is a CMFR-style four-stage reasoner that issues shape subgoals to the low-level controller at roughly one-second intervals. It tests whether slow symbolic diagnosis can substitute for reflexive recovery.

Three ablations isolate our ingredients. The first removes mechanism randomization. The second removes failure injection. The third keeps failure injection but drops the recovery-weighted loss, using plain distillation instead. All runs use the same seeds count, ten as in RRLS, and identical evaluation episodes.

Why not just…?

Why not just re-adapt the controller on a rigid body? For geometric failures, a body that does not fit cannot be steered through. Bandyopadhyay et al. pass 70 cm openings only by narrowing from an 82 cm nominal width. Kriegman et al. find controller re-adaptation fails after deep damage. The fixed-body baseline quantifies this on our suite. If it matches our method on non-geometric failures such as torque loss, we will report that shape change only matters for geometric ones.

Why not just randomize widely over a single compromise body? Learning to Reconfigure reports that fixed co-designed bodies trail reconfiguration by 9.81x in heterogeneous terrain, and RRLS reports that wide uncertainty costs nominal performance. Stage 1 measures this directly along the randomization-width axis.

Why not just train the reconfigurable policy with standard randomization and let recovery emerge? This is the real threat, since it is our method minus two ingredients. The ablations settle it. If plain randomization with shape actions recovers as well as our method and still uses shape changes, our collapse hypothesis is wrong and the contribution shrinks to an empirical transfer result. We will say so.

Why not just script reflexes? Scripts fire on thresholds without knowing which shape change helps. CMFR's gains over non-recovering execution suggest that context-aware recovery generalizes better. Our held-out failure geometries test whether scripts transfer to unseen traps.

Why not just ground the simulator with RGAT? Grounding needs real transitions from the situation to be modeled, and a novel jam supplies none in advance. We nonetheless run RGAT-grounded training as a complementary condition, because it may reduce lock-imperfection error better than randomization does.

Decisive Checks

We report six measures:

  • recovery rate within a fixed time window after injected failure;
  • time to recover;
  • nominal traversal success and speed;
  • reconfiguration frequency as a function of randomization width, which directly measures collapse;
  • energy spent per transition;
  • worst-decile return, alongside the mean.

The central result requires three things. Reconfiguration frequency must fall with randomization width under plain randomization and not fall under mechanism randomization. Recovery on geometric failures must beat both the fixed-body baseline and the three-head baseline. The gap must persist from surrogate simulators to the posture-envelope hardware tier.

The structural leg-length tier is the riskiest step. There, failure of transfer would itself be informative, showing whether lock backlash, rather than world dynamics, dominates the reality gap for reconfigurable bodies.