DiffuseLoco: Real-Time Legged Locomotion Control with Diffusion from Offline Datasets

Xiaoyu Huang, Yufeng Chi, Ruofeng Wang, Zhongyu Li, Xue Bin Peng, Sophia Shao, Borivoje Nikolic, Koushil Sreenath

TL;DR

DiffuseLoco trains a single, real-time diffusion policy directly on offline datasets to execute diverse and agile legged locomotion skills (such as trotting, pacing, hopping, and two-legged walking on a quadruped). By pairing a Transformer diffusion backbone with receding horizon control, delayed-input inference, and TensorRT acceleration, the authors achieve zero-shot real-world deployment at high control frequencies (30+ Hz) on an edge GPU mounted directly on the robot.

What Problem Does This Paper Address?

While large generative models trained on static, offline datasets have revolutionized computer vision, NLP, and robotic manipulation, legged locomotion has largely remained tethered to online reinforcement learning (RL).

Online RL methods struggle to scale to generalist, multi-skill policies within a single model. Balancing distinct reward functions or reference motions often leads to optimization instability or mode collapse (common in GAN-based approaches like AMP). Furthermore, legged robots are underactuated, inherently unstable dynamical systems requiring low-latency, high-frequency (≥30 Hz) feedback control—a regime where the iterative denoising process of diffusion models has traditionally been viewed as too slow.

Methods

DiffuseLoco reformulates multi-skill low-level locomotion as conditional sequence generation using Denoising Diffusion Probabilistic Models (DDPM):

[Offline Multi-Skill Data] 
       │
       ▼
[Transformer DDPM Policy] ──(Denoising conditioned on I/O history + Goal)──► Action Chunk (a_t:t+n)
       │
       ▼
[Receding Horizon Control] ──(Execute only immediate action a_t at 30+ Hz)

Key architectural and control design choices include:

  • Receding Horizon Control (RHC): The policy predicts an action chunk of $n$ future steps ($n=4$ or $8$) to ensure temporal consistency and reduce motor jitter, but only executes the immediate action $a_t$ before replanning.
  • Delayed-Input Pipeline: Diffusion inference takes 10–20 ms (a major fraction of a 30 Hz control cycle). To eliminate lag, the policy takes 1-step delayed observations ($s_{t-1}$) and actions ($a_{t-2}$) to predict current and future actions ($a_{t:t+n}$), allowing computation to run in parallel with execution.
  • Separated Attention Conditioning: Rather than concatenating inputs, a 6-layer Transformer decoder uses cross-attention with causal masks to separately attend to rapidly changing proprioceptive input/output history and static user goals (speed, height, heading).
  • Edge Inference Acceleration: Using ONNX and NVIDIA TensorRT, DiffuseLoco optimizes memory layouts and operator execution on an edge GPU (NVIDIA RTX 4060 Mobile), yielding a ~7× speedup over native PyTorch.

Datasets

DiffuseLoco trains purely on offline state-action-goal datasets without manual skill labeling:

  • Quadruped Dataset (Unitree Go1): 4 million transitions collected from diverse, single-skill RL policies:
  • Adversarial Motion Priors (AMP) for trotting and pacing.
  • Central Pattern Generator (CPG) guidance for hopping and bouncing.
  • Symmetry-augmented RL for agile bipedal walking.
  • Biped Dataset (Cassie): 10 million transitions from single-skill walking and running RL policies in MuJoCo simulation.
  • Data generation includes dynamics randomization (motor gains, payload, friction) to facilitate sim-to-real transfer.

Key Insights and Ideas

  • Diffusion avoids mode collapse across gaits: For identical forward velocity commands, DiffuseLoco can generate both trotting and pacing gaits. Unlike AMP (which overfits or collapses when arbitrating between multiple styles), the diffusion model captures the underlying multimodal distribution and sticks stably to one mode unless disrupted.
  • DDPM outperforms DDIM on fast dynamics: Popular fast samplers like DDIM reduce denoising iterations at the expense of sample fidelity. In unstable legged systems, these slight inaccuracies compound into drifting and falling. Standard DDPM proved far more stable in real-world hardware tests.
  • Emergent skill transitions: Even though the dataset contained zero transition data between distinct skills (e.g., hopping directly to bipedal walking), DiffuseLoco smoothly interpolates gait phases across switches by completing ongoing gait cycles before adapting foot placements.
  • Multi-skill data boosts general robustness: Ablations showed that training on all 5 skills improved stability over training exclusively on a single skill, likely because exposure to wider dynamical regimes improves generalization.

Key Results

  • Real-World Stability: DiffuseLoco achieved a 100% success/stability rate across all real-world commanded test trials (0.3, 0.5, 0.7 m/s forward speeds and turning). Baseline AMP and Transformer Behavior Cloning (TF) policies collapsed at higher speeds (0% and 40% stability at 0.7 m/s, respectively).
  • Velocity Tracking: DiffuseLoco reduced velocity error ($E_v$) at 0.7 m/s forward speed to 24.8%, compared to 55.0% for AMP with history and 39.4% for Transformer BC with RHC. Body angular velocity oscillation was reduced by 10.4%.
  • Onboard Edge Execution: On an onboard NVIDIA RTX 4060 Mobile GPU, the TensorRT-optimized 6.8M-parameter model ran 10 denoising steps at 116.5 Hz (up from 17.0 Hz in PyTorch), easily beating the 30 Hz real-time threshold.
  • Multi-Terrain Robustness: Successfully transferred zero-shot to bare concrete, gym mats, turf, and half-padded split-friction surfaces.

Limitations and Future Work

  • Sim-to-Real Gap for Complex Bipeds: The Cassie bipedal walking-to-running transition was validated only in MuJoCo simulation; deploying highly dynamic bipedal skills onto physical hardware requires tighter modeling.
  • Subpar Peak Robustness vs. Tuned Single-Skill RL: While vastly more versatile, DiffuseLoco’s raw disturbance rejection remains slightly lower than specialized single-skill RL controllers.
  • Reliance on Simulated Offline Data: Demonstrations were sourced from simulated RL policies rather than real-world teleoperation or human demonstration logs.
  • Future Directions: Integrating multi-robot morphologies, visual inputs, and language-conditioned instructions into a unified, generalist legged policy.

Summary updated

BibTeX
@inproceedings{huang2024diffuseloco,
  author = {Xiaoyu Huang and Yufeng Chi and Ruofeng Wang and Zhongyu Li and Xue Bin Peng and Sophia Shao and Borivoje Nikolic and Koushil Sreenath},
  title = {{DiffuseLoco: Real-Time Legged Locomotion Control with Diffusion from Offline Datasets}},
  booktitle = {Conference on Robot Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=nVJm2RdPDu},
}

Loading related content...

Figure