← All projects

Embodied AI • Internship

Teaching a robot to fold

The same shirt. A different fold, every time.

A successful folding demonstration. Two Piper arms fold a shirt on the worktable. This 52-second recording is shown at its supplied speed, without audio.

During my internship at Motion Brain, I developed a robot-learning pipeline for bimanual garment folding. I worked from the demonstration data through conversion, training-set preparation, multi-GPU π0.5 training, and inference bring-up.

I’m interested in garments because the object keeps changing as you work on it. What the robot needs to do next depends on how the cloth actually ended up, not just where it was supposed to go.

The setup

The folding setup used two Piper arms and three RGB views: front, left, and right. Robot state and camera streams were recorded through ROS. The practical problem was keeping what we recorded, what the model learned, and what the arms received consistent.

Dataset and implementation scope

July training dataset · distinct from the later joint-space experiments
Demonstration episodes142
Frames in the training set34,587
July learning stackLeRobot / PyTorch π0.5
Policy trainingπ0.5, multi-GPU
Experiment toolingWeights & Biases

Getting the data into the training pipeline

The conversion stage connected recorded demonstrations to the dataset representation used for learning. I then prepared the 142-episode, 34,587-frame training set and computed preprocessing statistics from training data only.

Recorded garment demonstrations
  → data conversion
  → training-set preparation
  → train-only statistics
  → multi-GPU π0.5 training
  → inference bring-up

Those are separate stages for a reason. Dataset conversion determines what the learner receives. The statistics determine how numerical inputs are represented. Training then depends on both being consistent with the inference path.

Why train-only statistics matter

Preprocessing is part of the learned system. If statistics are computed over held-out examples as well as training examples, information from evaluation has already entered the transform. Keeping that calculation on training data preserves a cleaner separation between fitting the system and evaluating it.

This is especially easy to lose track of when a dataset contains many correlated frames from relatively few episodes. The episode count and the frame count describe different things: 34,587 frames do not represent 34,587 independent demonstrations.

Two representations, two different experiments

The project changed representation over time. The July pipeline used Cartesian-relative poses with absolute grippers. The August OpenPI pipeline stored absolute joint positions and applied the relative-action transform inside model preprocessing. Combining their settings would produce a pipeline that looked plausible but meant something different.

Keep the experiment lineage with the dataset
StageJulyAugust configuration
Dataset142 training episodes / 34,587 frames168 episodes / 195,560 frames
Representation16D Cartesian-relative poses and grippers14D absolute joints and grippers
Policy timeline10 Hz converted data30 Hz
Learning implementationLeRobot / PyTorchOfficial OpenPI / JAX

The August figures identify a later converted dataset and training configuration. They are not an extension of the July frame count, and neither dataset size is a measure of physical folding performance.

The action contract

In the August dataset, each arm contributes six joint angles and one gripper position. The joint angles use radians; the grippers use metres. The 14 real dimensions are padded to the model’s 32-dimensional input/output space.

left:  [q0, q1, q2, q3, q4, q5, gripper]
right: [q0, q1, q2, q3, q4, q5, gripper]

Raw dataset: absolute joint targets
Model transform: twelve arm joints → current-state deltas
                 two grippers     → remain absolute
Model output: inverse transform → absolute robot targets

The action horizon was 50 steps. At 30 Hz, that is roughly 1.67 seconds of predicted motion. The horizon describes what the policy predicts; it does not establish how many actions were actually executed before replanning.

A bug that changed what the model was learning

One of the important July fixes was preventing relative actions from being transformed twice. The data already contained relative Cartesian targets. Applying another relative-action transform changed the targets again. Training loss could still be finite, but it was no longer optimizing the intended robot commands.

The July 16 update also records stopping a run that had included validation episodes and rebuilding the intended training split. That made preflight checks part of the workflow: inspect the actual dataset, verify the split, and trace the action transform before starting another long run.

Training and inference

I worked on multi-GPU π0.5 training and inference setup across these iterations. That last step matters: a checkpoint is only one artifact. The observation representation, preprocessing, and expected action interface must still agree at deployment.

The work formed part of a broader robotics/software internship integrating physical hardware, perception, data processing, and simulation tools. For this project, the concrete deliverable was the garment-learning pipeline.

Getting back to the arms

The August notes include an inference interface for choosing checkpoints, adjusting inference parameters, and surfacing errors. The August 12 record includes unsuccessful physical tests and notes that there were multiple causes. Getting a server to return an action, getting the arms to move, and completing a fold are three separate milestones.

Evaluation boundary

The dataset figures above describe the training material, not a measured folding success rate. The video above documents one successful rollout. It does not establish a success rate across garments or initial conditions. A quantitative evaluation would need the garment set, starting-state distribution, number of trials, completion criteria, and intervention policy to make its numbers interpretable.

Related work: diffusion-policy pick and place

I also helped with a separate team project training pick-and-place behavior with diffusion policy. My role was a supporting contribution; the policy was not my own project. These examples belong to that team’s work.

Cup manipulation · team work I helped with.
Fruit into a bowl · team work I helped with.

These clips show a different robot and task from the Piper shirt-folding experiment. They are not part of its evaluation.

← Back to the portfolioAsk me about this ↗