Abstract
We present a fast and feature-complete differentiable physics engine, Nimble (nimblephysics.org), that supports Lagrangian dynamics and hard contact constraints for articulated rigid body simulation. Our differentiable physics engine offers a complete set of features that are typically only available in non-differentiable physics simulators commonly used by robotics applications. We solve contact constraints precisely using linear complementarity problems (LCPs). We present efficient and novel analytical gradients through the LCP formulation of inelastic contact that exploit the sparsity of the LCP solution. We support complex contact geometry, and gradients approximating continuous-time elastic collision. We also introduce a novel method to compute complementarity-aware gradients that help downstream optimization tasks avoid stalling in saddle points. We show that an implementation of this combination in an existing physics engine (DART) is capable of a 87x single-core speedup over finite-differencing in computing analytical Jacobians for a single timestep, while preserving all the expressiveness of original DART.
Introduction
In the field of robotics, tasks such as control policy design and system identification are fundamentally optimization problems. Efficiently solving these problems requires accurate gradients. Historically, researchers have struggled to find a balance between expressiveness (simulating high-DOF robots), accuracy (handling hard physical constraints), and differentiability. Traditional engines like DART or MuJoCo require finite differencing—a process of perturbing the simulation thousands of times—which is computationally expensive and numerically unstable. Nimble addresses these challenges by providing a high-performance differentiable engine that brings the speed of analytical gradients to complex, articulated robots.
Methodology
Nimble is developed as a differentiable extension of the DART physics engine, incorporating several technical innovations to handle the discontinuities of contact physics.
Analytical LCP Differentiation
Physics engines typically resolve contacts through Linear Complementarity Problems (LCPs). Nimble derives analytical gradients directly through this formulation. A key optimization is the exploitation of sparsity: since most potential contact points are inactive at any given time, Nimble focuses only on "clamping" (active) contacts, significantly reducing computational overhead.
Complementarity-Aware Gradients
Standard analytical gradients can be "short-sighted" in contact scenarios, often returning zero when a robot is resting on a surface. Nimble introduces a complementarity-aware heuristic that looks ahead to potential contact breaks, providing useful gradients that guide optimizers out of saddle points, such as enabling a drone to learn to lift off from the ground.
Geometric and Elastic Gradients
Nimble supports symbolic gradients for collision geometry, favoring analytical primitives (like spheres) over meshes to provide more stable gradient information. Additionally, it employs a continuous-time approximation for elastic collisions to smooth the gradients of discrete-time bounces.
Experimental Results
Nimble was benchmarked using several standardized robotic environments, including the 32-DOF Atlas humanoid and the 2D Half Cheetah.
Performance and Optimization
The engine achieved a 87.8x speedup in computing analytical Jacobians for the Atlas humanoid compared to central finite differencing. This efficiency allowed for the optimization of complex trajectories, such as dynamic jumping for the Atlas robot and successful takeoff for resting drones—tasks where standard gradient methods often fail.
Conclusion and Future Work
Nimble demonstrates that analytical gradients, when combined with sparsity-aware LCP differentiation and complementarity-aware heuristics, can drastically accelerate robotics optimization. Future work will focus on differentiating through geometric parameters and friction coefficients to enable automated robot design, as well as improving scaling for extremely high-DOF systems.
Summary updated