Unitree H1-2 humanoid whipping a rope toward a row of lit candles
RopeFormer

Cross-Trial Adaptation from Interaction History for Dynamic Rope Manipulation

Menglin Wu*1,2 Kaixiang Yao*1,3 Shangbo Luan1,4 Masayoshi Tomizuka1 Yuxin Chen1
1UC Berkeley · 2Xi'an Jiaotong University · 3SUSTech · 4Peking University · *Equal contribution
Video Paper SOON Code SOON BibTeX

Every attempt reveals more about the rope.

Swinging, twirling and whipping a rope all depend on how the rope responds. The same arm motion can produce very different behaviour as mass, stiffness and damping change. These properties are difficult to measure, and their effects are difficult to reproduce faithfully in simulation.

One way to handle this uncertainty is to model the rope: calibrate a simulator, estimate physical parameters, or fit a model from earlier attempts. RopeFormer explores another way to use that experience.

Can a robot use what happened in one attempt to do better in the next?

RopeFormer uses a Transformer-XL policy to carry information about robot states, actions and rope motion across repeated trials. The policy adapts through this interaction history, with fixed weights and no explicit estimate of the rope's physical parameters. We evaluate it on three tasks — single-arm Rope_Swing, bimanual Rope_Twirl and target-line Rope_Whip — in simulation and on a Unitree H1-2 using previously unseen physical ropes.

Project video

Project video coming soon

Three tasks, a shared approach to adaptation

We train a separate policy for each task, using the same architecture and multi-trial training setup. A trial is one attempt; an episode is a sequence of attempts with the same rope. Between trials, the robot and rope return to their starting state while the policy retains its context. That context is cleared at the start of each new episode.

Three panels: Rope Swing, Rope Twirl and Rope Whip, each with a robot pose and a plot comparing trial 1 (grey) and trial 2 (orange)
Two trials with the same rope in simulation: trial 1 in grey and trial 2 in orange. Swing and Twirl show the robot when it reaches the target rotation in trial 2, with the tip or midpoint orbit inset. Whip shows the tip sweeping across the target plane, with its maximum deviation from the line plotted below.

(a) Rope_Swing

Holding one end in its right hand, the robot keeps the free tip rotating at a target speed and direction. We measure how quickly it reaches the commanded rotation.

(b) Rope_Twirl

Holding one end in each hand, the robot rotates the rope's midpoint around the line between its hands. We measure how quickly it meets a combined criterion for rotation rate, radius, direction and clearance.

(c) Rope_Whip

The robot whips the free tip along a target line segment in a single sweep. We measure the tip path's largest perpendicular deviation from that line.

Adapt through history, with fixed policy weights

At each control step, the policy receives joint states, measured rope points, the task command or target, and its previous action. An encoder turns this observation into a token. A six-layer Transformer-XL combines it with stored representations of earlier steps, then an action head produces joint targets at 30 Hz. The next observation captures how the rope responded, giving the policy new information for its next action.

Layer-specific KV caches KV 1 KV 2 KV 3 KV 4 KV 5 KV 6 Read Append Observation o t Embedding B1 B2 B3 B4 B5 B6 Actor head a t Within each block Segment length: 128 Layer input → Q, K, V KV mem 128 tokens KV cur 0–128 tokens || Q Attention episode mask Append K/V
Each of the six layers attends to the current segment and cached keys and values from the previous 128-frame segment. When a segment is complete, it replaces the cache. This keeps memory bounded while the policy produces an action at every control step.

Carry experience into the next trial

Resetting the robot and rope does not reset the policy's context. Information from one attempt remains available to guide the next. Attention masks keep histories from different episodes separate.

Practise across a range of ropes

Training in the Newton simulator varies rope properties and actuator behaviour between episodes, then gives the policy several attempts under the same conditions. This lets it encounter a wide range of dynamics and use experience from earlier trials within each episode.

Act on observations alone

We train with PPO and an asymmetric critic: the critic has access to simulated rope and actuator parameters, while the policy acts only on its observation history. Advantage estimation stops at trial boundaries; the policy's context carries across them.

How much does the previous attempt help?

For each task, we compare the same trained policy on a fixed set of 384 ropes, with matched starting states and noise. One condition retains context between trials; the other clears it. Both keep history within each trial, isolating the effect of experience from earlier attempts. TXL-1 and TXL-6 observe one and six rope points, respectively; an MLP with an eight-frame observation stack provides a non-recurrent reference. The videos show individual examples, while the figures summarise results across ropes.

Rope_Swing

one arm, sustained rotation · same command, two ropes
Fig. 3 — Acquisition time and success rate over 384 ropes and five trials. Solid lines and filled bars retain context; dashed lines and outlined bars reset it between trials. Lower time and higher success are better.

Prior experience helps establish the target rotation.

The video shows the same policy and speed command with two ropes: one softer (bending stiffness 2.1), the other stiffer (21.1). Without receiving either rope's physical parameters, the policy settles into different arm motions in response to their dynamics.

Across 384 ropes and trials 2–5, retaining context reduces TXL-1's mean capped acquisition time from 7.39 s to 4.89 s and raises success from 48.2% to 79.8%. TXL-6 improves from 5.64 s to 4.34 s. The MLP results overlap because it carries no state between trials.

Rope_Twirl

two arms, sustained rotation · trial 2 with memory cleared vs. kept
Fig. 4 — Mean capped acquisition time over trials 2–5, grouped by low, medium and high stiffness (128 ropes each). Filled bars retain context; grey outlines reset it. Labels show retained − reset in seconds, so negative values indicate faster acquisition.

A second attempt, with and without prior experience.

Both panels show trial 2 with the same rope, starting state and noise. On the left, context from trial 1 is cleared; on the right, it is retained. In this example, retaining context reduces acquisition time from 3.57 s to 2.37 s. The accompanying figure shows how the effect varies across the evaluation set.

The benefit depends on rope stiffness and the available observations. With one observed rope point, the largest gains occur for low and medium stiffness (1.55 s and 1.19 s faster). With six points, the largest gain occurs for high stiffness (0.79 s faster). Which architecture performs best also changes with stiffness.

Rope_Whip

one arm, transient sweep · five attempts at the same line
Rope Whip results: trial 1 versus trial 2 maximum tip-path deviation for ropes at three target-line angles
Fig. 5 — Trial 1 (grey) and trial 2 (orange) at three selected target angles. Points show signed normal deviations; numbers report mean unsigned dmax, where lower is better.

Repeated attempts bring the tip closer to the target line.

This example follows five attempts with the same rope, target line and initial state, retaining context throughout. Maximum deviation falls from 7.8 cm to 4.9, 3.8, 3.1 and 2.9 cm. The first attempt exceeds the 5 cm threshold; the next four stay within it.

The figure compares trial 1 (grey) and trial 2 (orange) for the same ropes at three selected target angles. Mean deviation is lower in trial 2 at each angle shown, with the largest decrease at 60°. Target-length coverage remains above 95% in both trials.

Across all three tasks, retaining context improves aggregate performance. The size of the benefit varies with rope dynamics and the observations available to the policy; individual attempts do not always improve.

From simulation to unfamiliar physical ropes

Each task runs on a Unitree H1-2 with a frozen TXL-1 policy at 30 Hz, using physical ropes unseen during training.

The physical ropes used for Rope Swing, Rope Twirl and Rope Whip
Ropes used for Swing, Twirl and Whip, from left to right. Their identities and physical parameters are not provided to the policy.

One tracked point

Two ZED 2i cameras track a single marker at the rope tip for Swing and Whip, or at the midpoint for Twirl. Its triangulated position provides the rope observation.

Three consecutive attempts

Each block begins with empty context, which is retained through trials 2 and 3. Between attempts, the policy pauses while the rope is returned to rest.

Three rows of frames showing the H1-2 executing Rope Swing, Rope Twirl and Rope Whip
Representative executions, top to bottom: Rope_Swing, Rope_Twirl, Rope_Whip. Frames progress left to right.
Thin lines show individual ropes for Swing and Twirl, or rope–height groups for Whip; thick lines show their means. TAT is target acquisition time and MNE is mean normalised tracking error; lower is better for both. Whip reports balls struck out of three. Context is retained from trial 1 through trial 3.

Rope_Swing

−30.9%
Acquisition time, T1 → T3 (8.57 → 5.92 s, five ropes). Every rope is faster at T3 than at T1.

Rope_Twirl

−33.9%
Acquisition time, T1 → T3 (3.23 → 2.13 s). Most of the gain arrives by T2; tracking error falls 55.6%.

Rope_Whip

0.2 → 2.3
Mean balls struck out of three, T1 → T3, over ten rope–height groups on two ropes.

Citation details will be available with the paper.