Combining physics and deep learning to learn continuous-time dynamics models

Michael Lutter, Jan Peters

TL;DR

This paper introduces Deep Lagrangian Networks (DeLaN), a novel approach that combines deep learning with physics principles (Lagrangian mechanics) to create more robust and interpretable continuous-time dynamics models for robots. By enforcing physical laws like energy conservation, DeLaN models outperform traditional black-box deep learning methods in accuracy and generalization, enabling better real-time control of physical systems.

What Problem Does This Paper Address?

Robotics heavily relies on accurate models of system dynamics to plan and control robot movements. Traditionally, these models were either hand-engineered (requiring extensive domain expertise and being labor-intensive) or learned using black-box deep learning approaches. While deep learning offers flexibility and can learn complex patterns, these black-box models often lack physical plausibility, can overfit to training data, and fail to generalize well to unseen scenarios. This is particularly problematic for learning dynamics models, where violating fundamental physical laws can lead to unpredictable and potentially damaging behaviors. The paper aims to bridge this gap by developing a model learning framework that leverages existing physics knowledge to create more reliable and interpretable dynamics models.

Methods

The core contribution is the Deep Lagrangian Networks (DeLaN) framework. DeLaN integrates deep neural networks with Lagrangian mechanics. Instead of learning dynamics directly, DeLaN uses two neural networks to parameterize the system's kinetic and potential energy. The parameters of these networks are then learned by minimizing the residual of the Euler-Lagrange differential equation, which is a fundamental equation in classical mechanics. This approach inherently enforces physical laws, ensuring that the learned models conserve energy and are physically plausible.

Key aspects of the method include:

  • Physics-Inspired Architecture: The network architecture is guided by Lagrangian mechanics, specifically the formulation $L = T - V$, where $T$ is kinetic energy and $V$ is potential energy.
  • Energy Conservation: By minimizing the Euler-Lagrange equation, the learned models are guaranteed to conserve energy, a crucial property for long-term prediction accuracy.
  • Interpretable Models: DeLaN models allow for the decomposition of forces (inertial, Coriolis, gravitational), providing insights into the system's behavior, unlike black-box models.
  • Unified Forward, Inverse, and Energy Models: The same learned parameters can be used to derive forward (predicting next state), inverse (predicting control input), and energy models, ensuring consistency.
  • Positive-Definite Mass Matrix: A specific technique is used to ensure the predicted mass matrix is positive definite, preventing numerical instabilities.

The paper also discusses Hamiltonian Neural Networks (HNN) as a related approach, which uses Hamiltonian mechanics instead of Lagrangian mechanics.

Datasets

The paper uses several datasets for training and evaluation:

  • Simulated Systems:
    • Two-link pendulum (simulated using Bullet)
    • Cartpole (simulated)
    • Furuta pendulum (simulated)
  • Physical Systems:
    • Cartpole (manufactured by Quanser)
    • Furuta pendulum (manufactured by Quanser)
    • Barrett WAM (4-DOF robot)
  • Character Dataset: A dataset of trajectories from drawing characters, used for evaluating performance on smaller, potentially less uniform state spaces. This dataset was originally introduced by Williams et al. (2008) and is available in the UCI Machine Learning Repository.
  • Uniform Dataset: A large dataset (100k samples) spanning the state domain uniformly.

Key Insights and Ideas

  • Physics as a Regularizer: The paper demonstrates that incorporating physics principles into deep learning acts as a powerful regularizer, preventing overfitting and leading to better generalization, especially in scenarios with limited or noisy data.
  • Energy Conservation is Key for Long-Term Prediction: Models that conserve energy (like DeLaN) show significantly better long-term prediction accuracy and stability compared to models that do not, as seen in the forward model rollouts.
  • Structured vs. Black-Box Physics-Inspired Models: Structured physics-inspired models (where kinetic and potential energy are predicted separately) generally outperform their black-box counterparts (where a single network predicts the entire Lagrangian/Hamiltonian). This is attributed to better numerical stability and avoiding issues with singular Hessians.
  • Interpretability Enables Better Control: The ability to decompose forces and understand system energy allows for more sophisticated control strategies, like energy control, which is not feasible with standard black-box models.
  • Real-World Applicability Despite Imperfections: DeLaN can learn effective dynamics models even when the physical system violates some assumptions of the underlying physics (e.g., non-rigid bodies, cable drives), showcasing its robustness.

Key Results

  • Inverse Model Accuracy: Physics-inspired networks (DeLaN and HNN) achieved lower Mean Squared Error (MSE) than feed-forward deep networks on both large and small datasets for inverse dynamics prediction. Structured variants performed slightly better than black-box ones.
  • Forward Model Performance: Physics-inspired networks also outperformed feed-forward networks in forward model prediction, with structured models showing significantly better performance and longer valid prediction times (VPT) on the uniform dataset, especially compared to black-box physics-inspired models which sometimes diverged.
  • Torque Decomposition: All physics-inspired models learned a good decomposition of inertial, Coriolis, and gravitational torques, with structured models showing an advantage over black-box ones for inertial and Coriolis torques.
  • Control Performance:
    • Inverse Dynamics Control: On physical systems, DeLaN achieved comparable tracking error to system identification, outperforming the feed-forward network in generalization to higher velocities.
  • Energy Control: DeLaN was the first model learning approach to successfully apply energy control for swinging up under-actuated systems (Cartpole and Furuta pendulum) on physical hardware, a task not possible with standard black-box models.

Limitations and Future Work

  • Contact Handling: Current physics-inspired networks are limited to articulated rigid bodies without contact. Extending them to handle contact-rich scenarios is a significant open challenge.
  • Observation Requirements: The methods typically require observing generalized coordinates (position, velocity, momentum) and forces. Handling systems with arbitrary or partial observations (e.g., only images) is another major open problem.
  • Generalization to Unknown Physics: While DeLaN can handle deviations from ideal physics (e.g., non-rigid bodies), it still relies on a known underlying physics prior. Learning dynamics where the fundamental physics is unknown is a future direction.
  • Numerical Stability: Black-box physics-inspired models can suffer from numerical instability due to singular Hessians, which structured models mitigate. Further research into robust parameterizations is needed.
  • Latent Space Learning: Approaches using variational autoencoders to learn latent spaces for generalized coordinates are promising but require further development to match the performance of standard deep networks.

Summary updated

BibTeX
@article{lutter2021combining,
  author = {Michael Lutter and Jan Peters},
  title = {{Combining physics and deep learning to learn continuous-time dynamics models}},
  journal = {Int. J. Robotics Res.},
  year = {2021},
  doi = {10.1177/02783649231169492},
}
Figure