Learning Quadruped Locomotion Using Differentiable Simulation

Yunlong Song, Sangbae Kim, Davide Scaramuzza

TL;DR

This paper introduces a novel differentiable simulation framework that enables quadruped robots to learn complex locomotion skills in minutes, even without massive parallelization. By combining a smooth, simplified surrogate model for gradient backpropagation with a high-fidelity non-differentiable simulator for accurate state alignment, the approach bridges the gap between analytical gradients and chaotic contact dynamics, achieving successful zero-shot sim-to-real transfer on a physical robot.

What Problem Does This Paper Address?

Legged locomotion control is traditionally dominated by model-free Reinforcement Learning (RL) combined with massively parallelized simulation. RL relies on zeroth-order gradient estimates (sampling trajectories to see what works), which suffer from high variance and require millions of data points to find stable policies.

Differentiable simulation promises a better way: computing exact first-order analytical gradients directly through the physics equations, leading to faster and more stable training. However, legged robots involve discontinuous contact dynamics (feet hitting and leaving the ground), which create a chaotic optimization landscape. In these scenarios, standard first-order gradients frequently vanish, explode, or get trapped in poor local minima, limiting the practical use of differentiable simulation to simple, non-contact tasks.

Methods

The authors propose a hybrid framework that bypasses the need to differentiate through messy contact discontinuities by decoupling the robot's dynamics:

  1. Surrogate Dynamics Model: Instead of simulating whole-body dynamics, they model the robot's main body using Single Rigid-Body Dynamics (SRBD). This provides a smooth, continuous representation where ground reaction forces act as control inputs, yielding well-behaved gradients for Backpropagation Through Time (BPTT).
  2. State Alignment: To prevent the simplified SRBD model from drifting away from reality, they run a high-fidelity, non-differentiable simulator (IsaacGym) in parallel to handle complex contact mechanics. At each step, the true state from IsaacGym resets the state in the differentiable simulator. Crucially, this alignment step is detached from the computational graph, ensuring backpropagation only sees the smooth gradients of the surrogate model.
  3. Short-Horizon Training: Trajectories are truncated into short segments (e.g., 24 steps) to mitigate gradient explosion and vanishing issues during BPTT.
  4. Differentiable Loss Function: A smooth cost function penalizes velocity tracking errors, body height deviations, excessive angular velocity, and large control actions.
System overview of the proposed framework, decoupling joint and floating base spaces and aligning states with IsaacGym.

Datasets

Not discussed in the paper. The method was evaluated entirely within custom simulation environments built using PyTorch, CUDA, and IsaacGym, and validated via zero-shot sim-to-real transfer on a physical Mini Cheetah quadruped robot.

Key Insights and Ideas

  • You don't need perfect differentiable physics: Differentiating through complex contact mechanics is an open, incredibly difficult challenge. This paper shows that using a simplified model for gradients and a precise, non-differentiable model for forward states gives you the best of both worlds: smooth gradients and realistic physics.
  • Extreme Sample Efficiency: First-order gradients provide such a clear direction for optimization that a single robot can learn to walk in minutes without any parallelization—a feat impossible for standard model-free RL.
  • The Terminal Penalty Catch-22: In RL, giving a massive negative reward for falling down (a non-differentiable step function) is highly effective. In differentiable simulation, the gradient of a constant penalty is zero, meaning it provides no learning signal. Therefore, differentiable simulation requires carefully designed continuous cost functions to avoid bad behaviors.

Key Results

  • Toy Problem (Double Integrator): The proposed method (DiffSim) matched the mathematically optimal Linear Quadratic Regulator (LQR) controller and vastly outperformed PPO in convergence speed and sample efficiency.
  • Single-Robot Learning: Trained with just one simulated robot (24 data points per iteration), DiffSim successfully learned a stable walking policy within 1,000 iterations (minutes). PPO completely failed under these data-starved conditions.
  • Challenging Terrains & Diverse Gaits: When scaled up on GPUs, DiffSim trained policies to master trot, pace, bound, and gallop gaits across rough terrain. It achieved high rewards using only 64 parallel robots, whereas PPO required 1,024 robots to achieve comparable performance.
Training progress comparison on a toy double integrator problem.
  • Sim-to-Real: The trained policy transferred directly to a physical Mini Cheetah robot without any fine-tuning, successfully handling rough and deformable terrains.

Limitations and Future Work

  • Heuristic Dependency: The framework currently relies on a predefined gait schedule and the Raibert heuristic to plan foot placement and contact sequences. It cannot automatically discover novel gaits or foot placements purely from velocity tracking loss.
  • Reward Engineering: Because it cannot exploit non-differentiable terminal rewards (like survival bonuses), designing the continuous loss function requires significant domain expertise.
  • Generalization: The pipeline is highly tailored to quadruped locomotion and requires engineering effort to adapt to other robotic forms or tasks, such as manipulation or vision-based control.

Summary updated

BibTeX
@inproceedings{song2024learning,
  author = {Yunlong Song and Sangbae Kim and Davide Scaramuzza},
  title = {{Learning Quadruped Locomotion Using Differentiable Simulation}},
  booktitle = {Conference on Robot Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=XopATjibyz},
}
Figure