Table of Contents
Fetching ...

Dojo: A Differentiable Physics Engine for Robotics

Taylor A. Howell, Simon Le Cleac'h, Jan Brüdigam, Qianzhong Chen, Jiankai Sun, J. Zico Kolter, Mac Schwager, Zachary Manchester

TL;DR

Dojo tackles the need for stable, differentiable physics in robotics by coupling a nonlinear complementarity contact model with nonlinear friction cones to a custom primal-dual interior-point solver. Gradients are obtained via implicit differentiation of the solver, with a tunable central-path parameter that trades gradient smoothness for physical fidelity. Complemented by a variational integrator and maximal-coordinates dynamics, Dojo supports accurate forward simulation at low sample rates and provides informative gradients for trajectory optimization, policy learning, and system identification. Empirical results show robust sim-to-real transfer and competitive planning and learning performance, with open-source Julia implementation and Python bindings. Overall, Dojo advances differentiable robotics by delivering stable contact dynamics, high-fidelity friction modeling, and practical gradient information for optimization tasks.

Abstract

We present Dojo, a differentiable physics engine for robotics that prioritizes stable simulation, accurate contact physics, and differentiability with respect to states, actions, and system parameters. Dojo models hard contact and friction with a nonlinear complementarity problem with second-order cone constraints. We introduce a custom primal-dual interior-point method to solve the second order cone program for stable forward simulation over a broad range of sample rates. We obtain smooth gradient approximations with this solver through the implicit function theorem, giving gradients that are useful for downstream trajectory optimization, policy optimization, and system identification applications. Specifically, we propose to use the central path parameter threshold in the interior point solver as a user-tunable design parameter. A high value gives a smooth approximation to contact dynamics with smooth gradients for optimization and learning, while a low value gives precise simulation rollouts with hard contact. We demonstrate Dojo's differentiability in trajectory optimization, policy learning, and system identification examples. We also benchmark Dojo against MuJoCo, PyBullet, Drake, and Brax on a variety of robot models, and study the stability and simulation quality over a range of sample frequencies and accuracy tolerances. Finally, we evaluate the sim-to-real gap in hardware experiments with a Ufactory xArm 6 robot. Dojo is an open source project implemented in Julia with Python bindings, with code available at https://github.com/dojo-sim/Dojo.jl.

Dojo: A Differentiable Physics Engine for Robotics

TL;DR

Dojo tackles the need for stable, differentiable physics in robotics by coupling a nonlinear complementarity contact model with nonlinear friction cones to a custom primal-dual interior-point solver. Gradients are obtained via implicit differentiation of the solver, with a tunable central-path parameter that trades gradient smoothness for physical fidelity. Complemented by a variational integrator and maximal-coordinates dynamics, Dojo supports accurate forward simulation at low sample rates and provides informative gradients for trajectory optimization, policy learning, and system identification. Empirical results show robust sim-to-real transfer and competitive planning and learning performance, with open-source Julia implementation and Python bindings. Overall, Dojo advances differentiable robotics by delivering stable contact dynamics, high-fidelity friction modeling, and practical gradient information for optimization tasks.

Abstract

We present Dojo, a differentiable physics engine for robotics that prioritizes stable simulation, accurate contact physics, and differentiability with respect to states, actions, and system parameters. Dojo models hard contact and friction with a nonlinear complementarity problem with second-order cone constraints. We introduce a custom primal-dual interior-point method to solve the second order cone program for stable forward simulation over a broad range of sample rates. We obtain smooth gradient approximations with this solver through the implicit function theorem, giving gradients that are useful for downstream trajectory optimization, policy optimization, and system identification applications. Specifically, we propose to use the central path parameter threshold in the interior point solver as a user-tunable design parameter. A high value gives a smooth approximation to contact dynamics with smooth gradients for optimization and learning, while a low value gives precise simulation rollouts with hard contact. We demonstrate Dojo's differentiability in trajectory optimization, policy learning, and system identification examples. We also benchmark Dojo against MuJoCo, PyBullet, Drake, and Brax on a variety of robot models, and study the stability and simulation quality over a range of sample frequencies and accuracy tolerances. Finally, we evaluate the sim-to-real gap in hardware experiments with a Ufactory xArm 6 robot. Dojo is an open source project implemented in Julia with Python bindings, with code available at https://github.com/dojo-sim/Dojo.jl.
Paper Structure (35 sections, 50 equations, 12 figures, 6 tables, 2 algorithms)

This paper contains 35 sections, 50 equations, 12 figures, 6 tables, 2 algorithms.

Figures (12)

  • Figure 1: Atlas drop simulation. Dojo simulates this system with 403 maximal-coordinates states, 30 joint constraints, 36 inputs, and 8 contact points in real-time at 65 Hz. Dojo respects floor-feet penetration constraints to machine precision. Other simulators struggle to maintain the floor contact constraint, especially at low simulation rates.
  • Figure 2: Friction-cone comparison. Linearized double-parameterized (left) and nonlinear second-order (right) cones.
  • Figure 3: Graph structure for maximal-coordinates system with 4 bodies, 3 joints, and 3 points of contact.
  • Figure 4: Gradient and dynamics comparison between point-wise gradients (black), randomized-smoothing gradients suh2022bundled (orange, blue) and Dojo's analytic gradients (magenta). The dynamics for a box in the $XY$ plane that is resting on a flat surface and displaced an amount $\Delta$ by a force $f$ (top left). Randomized smoothing gradients (right column) are computed using $500$ samples with varying covariances $\Sigma$. Dojo's gradients (middle column) are computed for different values of central-path parameter $\kappa$. Compared to Dojo, the randomized smoothing method produces noisy derivatives that are many times more expensive to compute. Simulated dynamics comparisons were conducted using Dojo's results under varying values of the central-path parameter, $\kappa$. The dynamics involve a box of 1 kg mass resting on a flat surface in the $XY$ plane, displaced by a force $\Delta$ (top left). The applied force was gradually increased from 0 N to 20 N. Throughout the simulation process, considering two separate cases—one involving impact and the other involving friction—the maximum $\Delta x$ and $\Delta y$ differences between $\kappa = 1 \times 10^{-4}$ and $\kappa = 1 \times 10^{-8}$ were $1.52 \times 10^{-3}$ m and $2.56 \times 10^{-3}$ m, respectively.
  • Figure 5: Velocity drift resulting from friction-cone approximation. Comparison between a box sliding with approximate cones having four vertices implemented in MuJoCo (magenta) and Dojo (orange) versus MuJoCo's (black) and Dojo's (blue) and PyBullet's (green) nonlinear friction cones. Dojo's nonlinear friction cone gives the physically correct straight line motion, while linear friction-cone approximations lead to lateral drift. MuJoCo's nonlinear friction cone exhibits a minor rotational drift. PyBullet's nonlinear friction cone delivers correct straight line motion, but exerts greater friction force on the box leading to a shorter trajectory than Dojo and MuJoCo.
  • ...and 7 more figures