TL;DR
Dojo is a new differentiable physics engine for robotics that tackles the long-standing challenge of simulating hard contact accurately while providing smooth, analytic gradients for optimization. This is achieved through a novel primal-dual interior-point solver and a variational integrator, enabling more stable and efficient learning and planning for robots.
What Problem Does This Paper Address?
Robotics research, particularly in areas like reinforcement learning and trajectory optimization, heavily relies on physics simulators. However, existing simulators often struggle with a fundamental trade-off: either they provide stable and accurate simulations of hard contact (like robots hitting the ground), but produce non-smooth, discontinuous gradients that hinder optimization, or they offer smoother gradients but sacrifice simulation fidelity, leading to unrealistic behavior and a significant "sim-to-real" gap. This paper addresses the need for a physics engine that can deliver both accurate hard contact simulation and smooth, informative gradients, crucial for advancing learning-based robotics applications.
Methods
Dojo introduces several key innovations:
- Differentiable Hard Contact Model: It models hard contact and friction using a nonlinear complementarity problem (NCP) with second-order cones for friction. This is a more accurate representation than linearized friction cones used in some other simulators.
- Custom Primal-Dual Interior-Point Solver: To reliably solve the complex NCP for hard contact, Dojo employs a custom primal-dual interior-point solver. This solver is designed to handle cone constraints and quaternions efficiently.
- Implicit Differentiation for Gradients: Instead of relying on computationally expensive finite-difference methods or dealing with discontinuous gradients from autodifferentiation through a simulation rollout, Dojo leverages the implicit function theorem. By differentiating through the interior-point solver's solution, it obtains smooth, analytic gradients with respect to states, actions, and system parameters.
- Variational Integrator: For non-contact regimes, Dojo uses a variational integrator that conserves energy and momentum, contributing to simulation stability.
- Maximal-Coordinates Representation: The engine uses maximal coordinates, which can lead to larger but sparser systems of equations, enabling efficient solving, especially for open-chain mechanical systems.
Datasets
Not explicitly discussed in the paper as datasets for training. However, the paper mentions using a real-world dataset of trajectories collected by throwing a box on a table with different initial conditions for system identification experiments.
Key Insights and Ideas
- The "Sweet Spot" of Differentiability: The paper highlights that by tuning the central path parameter in their interior-point solver, they can achieve a user-tunable trade-off between simulation accuracy (low parameter value) and gradient smoothness (high parameter value). This allows for both precise simulations and informative gradients for optimization.
- Implicit Differentiation as a Gradient Powerhouse: The implicit function theorem, applied to the interior-point solver, proves to be a powerful tool for deriving analytic gradients. This bypasses the common issues of vanishing/exploding gradients and high computational cost associated with other methods.
- Hard Contact is Achievable with Smooth Gradients: Dojo demonstrates that it's possible to simulate hard contact with machine precision while still obtaining smooth gradients, a feat that has been a significant challenge in the field.
- Maximal Coordinates for Efficiency: The choice of maximal coordinates, while leading to larger systems, can be more efficient for certain types of robotic systems (like open chains) due to sparsity.
Key Results
- Stable Simulation at Low Sample Rates: Dojo demonstrates stable and accurate contact simulation even at sample rates as low as 20 Hz, outperforming other simulators in this regard.
- Accurate Contact Enforcement: Table II shows Dojo strictly enforcing no penetration for the Atlas drop experiment, while MuJoCo exhibits significant penetration.
- Efficient Gradient Computation: Dojo's implicit differentiation method is significantly faster than finite-difference methods, especially for complex systems. Table V shows Dojo's computation time for forward simulation plus gradient calculation is competitive with other differentiable simulators, often outperforming them.
- Improved Planning Performance: In planning experiments (Table III), Dojo successfully solved tasks that MuJoCo failed on, particularly those involving aerial maneuvers.
- Reduced Sample Complexity in Policy Optimization: Policy optimization experiments (Table VI) suggest that using Dojo's implicit gradients can lead to 5-10 times greater sample efficiency compared to gradient-free methods.
- Low Sim-to-Real Gap: Experiments with a UFactory xArm 6 robot for box pushing showed an average positional discrepancy of only 0.5 cm, indicating good sim-to-real transfer.
Limitations and Future Work
- Computational Cost: While Dojo offers advantages in gradient smoothness and simulation accuracy, its primal-dual interior-point solver can have a higher computational cost per time step compared to soft-contact models.
- Nonconvex Optimization: The underlying optimization problem is nonconvex, which could theoretically lead to poor local minima or convergence issues, though the authors state they haven't encountered this in practice.
- Collision Detection: The current implementation relies on a pre-existing collision detection module and supports only basic shapes (point, sphere, capsule). Future work includes supporting more complex geometries like convex primitives, curved surfaces, and triangular meshes.
- Adaptive Time Stepping: Implementing adaptive time stepping would allow for larger steps when possible and smaller steps during complex dynamics, further improving efficiency.
- Hardware Acceleration: Support for GPUs would significantly speed up simulation and optimization.
- Model Predictive Control Integration: Exploring the integration of Dojo into model predictive control frameworks is a promising future direction.
Summary updated