Abstract: Building differentiable simulations of physical processes has recently received an increasing amount of attention. Specifically, some efforts develop differentiable robotic physics engines motivated by the computational benefits of merging rigid body simulations with modern differentiable machine learning libraries. Here, we present a library that focuses on the ability to combine data driven methods with analytical rigid body computations. More concretely, our library Differentiable Robot Models implements both differentiable and learnable models of the kinematics and dynamics of robots in Pytorch. The source-code is available at https://github.com/facebookresearch/differentiable-robot-model
Introduction
In traditional robotics, precise analytical models—often defined via Unified Robot Description Format (URDF) files—are used to describe how a robot moves. Conversely, modern AI relies on data-driven neural networks. A significant "gap" exists between these worlds: traditional physics engines are often black boxes, making it difficult to differentiate through them to understand how small changes in joint torque affect task performance.
While some differentiable physics engines exist, they often focus on entire environments (simulating collisions and external objects). This work focuses specifically on the robot model itself, creating a tool that allows researchers to use analytical models as ground truth within Reinforcement Learning (RL), identify unknown physical parameters from observation data, and create hybrid models that combine the laws of physics with the flexibility of neural networks.
Methods
The differentiable-robot-model library works by parsing a URDF file and translating its kinematic tree into a PyTorch computation graph. This allows the robot's physical properties to be treated as standard tensors within a deep learning pipeline.
Core Technical Components
- Spatial Vector Notation: The underlying mathematical framework used to represent velocities and forces.
- Differentiable Algorithms: The library implements standard robotics algorithms as differentiable operations, including the Recursive Newton Euler (RNEA) for inverse dynamics, the Composite Rigid Body Algorithm (CRBA) for the inertia matrix, and the Articulated Body Algorithm (ABA) for forward dynamics.
- Learnable Parameters: Users can wrap specific parameters in a
torch.nn.Module. For instance, a link's mass can be defined as aPositiveScalarto be learned from data, or a small neural network can be integrated to predict complex friction effects.
Validation and Robot Models
The library was validated using several widely-used industrial and research robot models to ensure broad applicability:
- Kuka iiwa (7-DOF arm)
- Franka Panda (7-DOF arm)
- Fetch arm (Mobile manipulator arm)
- Allegro Hand (Four-fingered robotic hand)
The authors verified that the computations in the library are identical to those produced by Bullet, a standard commercial-grade physics engine, ensuring physical correctness while gaining differentiability.
Key Insights
Selective Learnability
A primary advantage of this approach is that researchers do not have to learn a model from scratch. By keeping 90% of the model as "known physics" and only making uncertain parts (like payload mass) learnable, the system becomes significantly more data-efficient than pure neural network approaches.
The "CNN of Robot Motion"
The authors suggest that by implementing analytical models in a deep learning framework, researchers can more easily search for specialized neural architectures—essentially looking for the robotics equivalent of what the Convolutional Neural Network (CNN) achieved for computer vision.
Seamless Integration
Because the models are standard torch.nn.Module objects, they can be plugged into any existing PyTorch workflow, including hardware controllers and trajectory optimizers, leveraging GPU acceleration and automatic differentiation out of the box.
Results and Limitations
The library successfully demonstrates a "Learning Loop" where a robot can identify its own physical parameters from motion data by minimizing the error between predicted and observed accelerations using the Adam optimizer. It successfully propagates gradients from the output (e.g., end-effector position) back to the inputs or parameters.
Limitations: * Scope: The library focuses on internal kinematics and dynamics rather than complex environmental interactions like soft-body contact physics. * Kinematic Trees: The current implementation is optimized for robots described as kinematic trees and does not yet support closed loops (e.g., parallel linkages).
Future work envisions this library as a foundation for more sophisticated model-based reinforcement learning and as a teaching tool for core robotics concepts.
Summary updated