Diffusion Policy: UR5e pick-and-place (MuJoCo simulation)

A Diffusion Policy that picks up a 3 cm cube and places it on a green target disc, controlling a simulated UR5e arm with a Robotiq Hand-E gripper in MuJoCo. It acts from two RGB cameras (exterior and wrist) plus the joint state, and was trained with LeRobot on demonstrations from a scripted motion-planning expert.

Exterior camera Wrist camera
exterior camera wrist camera

Simulation only. This policy was trained and evaluated in MuJoCo and has not been tested on a real robot.

Results

20 evaluation episodes (seeds 1000–1019) in the same simulated scene, with a random cube pose and a random target each episode:

Run Success Steps to success (25 Hz) Placement error
Seeded (reproducible) 19 / 20 (95 %) mean 464 (18.5 s) median 0.2 cm, max 1.1 cm
Diffusion noise not seeded 16 / 20 (80 %) mean 463 (18.5 s) median 0.1 cm, max 0.7 cm

Over both runs: 35 / 40 (88 %). An episode succeeds when the cube rests inside the 6 cm target disc with the gripper open for 0.5 s, within 700 steps (28 s). The failures were a slow grasp that ran out of time, and an occasional stall above the cube.

Task

Robot UR5e + Robotiq Hand-E (simulated)
Object 3 cm cube, random position (x ∈ [0.42, 0.68] m, y ∈ [−0.35, 0.35] m) and random yaw
Goal Green disc (radius 6 cm), random position at least 15 cm from the cube
Control rate 25 Hz

Inputs & Outputs

Inputs

Feature Type Shape Meaning
observation.images.cam_exterior VISUAL (3, 240, 320) Fixed camera framing the table
observation.images.cam_wrist VISUAL (3, 240, 320) Camera on the gripper
observation.state STATE (7,) 6 measured joint angles (rad) + measured finger opening (0 open … 255 closed)

Outputs

Feature Type Shape Meaning
action ACTION (7,) Absolute joint targets for the 6 joints (rad) + gripper command (0 / 255)

Training

Trained for 100,000 steps on a single NVIDIA B200 GPU.

Setting Value
Observation steps 2
Action horizon / executed steps 64 (2.56 s) / 32 (1.28 s)
Vision backbone ResNet-18 (ImageNet-pretrained), separate encoder per camera, spatial softmax
Image crop 216×288, random during training
Denoiser 1-D conditional U-Net (512 / 1024 / 2048), ~278 M parameters
Noise scheduler DDPM, 100 timesteps, ε-prediction
Optimiser Adam, lr 1e-4, cosine schedule with 500 warm-up steps
Batch size / steps 128 / 100,000
Precision bf16 mixed precision
Seed 1000
LeRobot version 0.7.0

The training data comes from a scripted expert (inverse kinematics + RRT* motion planning). It deliberately arrives slightly off-centre above the cube and the target, then corrects, so the policy learns to recover from small positioning errors. See the GitHub README for details.

How to use

The policy needs the MuJoCo scene from the GitHub repo:

git clone https://github.com/matto24/lerobot_diffusion_pick_place
cd lerobot_diffusion_pick_place
uv sync

# Evaluate headless (downloads this policy from the Hub)
uv run python pick_place_lerobot/eval_policy.py --num-episodes 20 --headless

# Watch it in the MuJoCo viewer (macOS: mjpython)
uv run mjpython pick_place_lerobot/eval_policy.py --num-episodes 5

In your own code:

from lerobot.policies import make_pre_post_processors
from lerobot.policies.diffusion.modeling_diffusion import DiffusionPolicy

policy = DiffusionPolicy.from_pretrained("MattoTT/diffusion_ur5e_pick_place_v3")
preprocessor, postprocessor = make_pre_post_processors(
    policy_cfg=policy.config, pretrained_path="MattoTT/diffusion_ur5e_pick_place_v3"
)
# observation: both camera images as (1, 3, 240, 320) floats in [0, 1] and the state as (1, 7);
# see pick_place_lerobot/eval_policy.py for building it from the simulator.
action = postprocessor(policy.select_action(preprocessor(observation)))

Limitations

  • Simulation only, with one scene, one table, fixed lighting and fixed camera placement.
  • One object (a 3 cm cube) and one target type.
  • The cameras are rendered without noise or blur, so the policy is unlikely to transfer to a real robot as is.

Citation

@inproceedings{chi2023diffusionpolicy,
    title     = {Diffusion Policy: Visuomotor Policy Learning via Action Diffusion},
    author    = {Chi, Cheng and Feng, Siyuan and Du, Yilun and Xu, Zhenjia and Cousineau, Eric and Burchfiel, Benjamin and Song, Shuran},
    booktitle = {Proceedings of Robotics: Science and Systems (RSS)},
    year      = {2023}
}

@misc{cadene2024lerobot,
    author = {Cadene, Remi and Alibert, Simon and Soare, Alexander and Gallouedec, Quentin and Zouitine, Adil and Palma, Steven and Kooijmans, Pepijn and Aractingi, Michel and Shukor, Mustafa and Aubakirova, Dana and Russi, Martino and Capuano, Francesco and Pascal, Caroline and Choghari, Jade and Moss, Jess and Wolf, Thomas},
    title = {LeRobot: State-of-the-art Machine Learning for Real-World Robotics in Pytorch},
    howpublished = "\url{https://github.com/huggingface/lerobot}",
    year = {2024}
}
Downloads last month
24
Safetensors
Model size
0.3B params
Tensor type
F32
·
Video Preview
loading

Dataset used to train MattoTT/diffusion_ur5e_pick_place_v3

Paper for MattoTT/diffusion_ur5e_pick_place_v3