Introduction
Bridging the "sim-to-real" gap remains a primary challenge in robotics. While simulators are essential for planning and control, they often function as black boxes, providing outputs without exposing the underlying gradients necessary for optimization. This paper presents a fully differentiable rigid-body physics simulator designed to learn environmental physical properties—such as mass and link lengths—through direct observation. By integrating physics-based equations with gradient-based optimization, the authors propose an adaptive controller capable of tuning its internal model in real-time to match real-world dynamics.
Methodology
The simulator is built upon the Articulated Body Algorithm (ABA), an $O(n)$ approach for calculating the accelerations of connected rigid bodies. The central contribution of this work is the evaluation of four distinct methods for calculating gradients through the physics engine:
- Numerical Differentiation: A baseline "brute force" method involving small parameter perturbations.
- Automatic Differentiation (AD): Utilizing the Stan Math C++ library to track operations and backpropagate.
- Local Sensitivity Analysis (Coupled ODE): Augmenting physics equations to track state changes relative to parameters during simulation.
- Adjoint Sensitivity Analysis: Solving a separate adjoint differential equation backward in time to compute gradients efficiently.
These gradients enable an Adaptive Model Predictive Control (MPC) loop. The system observes the results of its actions in a "real" environment (simulated via MuJoCo), calculates the error relative to its internal model, and uses the gradients to update physical parameters like mass and center of mass before the next planning step.
Experimental Setup
The framework was evaluated across several robotics benchmarks, moving beyond static datasets to dynamic environments:
- n-link Compound Pendulums: Benchmarking gradient method scaling up to 100 links.
- 4-DOF Robot Arm: Optimizing Denavit-Hartenberg (DH) parameters for path following.
- DeepMind Control Suite: Using MuJoCo as the ground truth for cartpole and double-cartpole experiments.
Results and Discussion
A critical finding involves the "tape" problem in standard Reverse-Mode AD. While popular in deep learning, AD is memory-intensive for physics simulations because it records every intermediate operation over thousands of time steps. In contrast, Adjoint and Coupled ODE methods maintain a constant memory footprint, making them significantly more efficient for complex systems.
Key performance metrics include:
- Scaling Efficiency: Adjoint and Coupled methods scaled gracefully to a 100-link pendulum, whereas standard AD became prohibitively slow as time steps increased.
- Rapid Parameter Recovery: In cartpole tasks, the adaptive MPC inferred correct physical parameters from fewer than 100 transition samples.
- Control Performance: The inferred models were accurate enough to successfully execute complex "swing-up" maneuvers for both single and double cartpoles.
By treating physics as an inductive bias, the system avoids the need to learn fundamental laws from scratch, resulting in superior sample efficiency compared to pure deep learning approaches.
Conclusion and Future Work
While the current simulator excels at modeling fixed-joint systems, it does not yet account for non-penetrative contact dynamics, such as collisions and friction. Differentiating through the Linear Complementarity Problem (LCP) required for contacts remains a significant area for future research. Additionally, while "sim-to-sim" results are promising, future iterations will focus on applying these differentiable models to physical hardware characterized by sensor noise and complex real-world friction.
Summary updated