Investigating Lagrangian Neural Networks for Infinite Horizon Planning in Quadrupedal Locomotion

Prakrut Kotecha, Aditya Shirwatkar, Shishir KolathayaarXiv 2025 · DOI

Introduction

In the field of robotics, "planning" is the process of predicting a robot's future states based on its current configuration and intended actions. For quadrupedal robots, this is a high-stakes task. Traditional deep learning models, such as standard Multi-Layer Perceptrons (MLPs), often suffer from compounding errors. In these "black-box" models, a tiny prediction error in the first millisecond can snowball into a massive discrepancy over a few seconds, causing the planned trajectory to drift into physically impossible states.

While classical physics-based models provide the necessary accuracy, they are rigid, requiring precise manual tuning of parameters like limb mass and friction, and can be computationally prohibitive for real-time applications. This research explores a middle ground: Lagrangian Neural Networks (LNNs). These models learn from data like a neural network but are constrained to obey the fundamental laws of physics.

Conceptual comparison between standard neural networks and Lagrangian Neural Networks (LNNs). While standard NNs may produce physically inconsistent "dreams," LNNs are constrained by the equations of motion.

Methodology: Embedding Physics into Learning

The core innovation lies in the use of LNNs to learn the underlying Lagrangian of the system—the difference between kinetic and potential energy—rather than regressing future states directly. By doing so, the network inherently learns a mass matrix $\mathcal{M}(q)$ and a potential energy function $\mathcal{V}(q)$, ensuring that any predicted motion is derived from valid equations of motion.

Technical Innovations

  • Structured Inductive Bias: By forcing the network to output a positive-definite and symmetric mass matrix, the model is prevented from learning "shortcuts" that violate conservation laws.
  • Diagonalization for Real-Time Control: To address the computational cost of inverting mass matrices during inference, the researchers proposed a diagonalized representation. This optimization maintains physical interpretability while significantly boosting speed.
  • Inverse Dynamics (ID) Training: The authors experimented with training the model to predict torques from accelerations (inverse dynamics) while using forward dynamics for inference. This approach helps mitigate numerical instabilities often encountered during the training of second-order differential equation solvers.
  • PIP-Loco Integration: These LNN models were integrated into the "Dreamer" module of the PIP-Loco framework. This allows the robot to "imagine" future trajectories over an infinite horizon, optimizing its current actions based on physically consistent long-term predictions.

Experimental Setup

The researchers evaluated their approach using the Unitree Go1 quadruped robot within NVIDIA’s Isaac Gym simulator. This environment enabled high-throughput data collection. Training data was generated using a Proximal Policy Optimization (PPO) expert actor, providing a rich dataset of dynamic locomotion for the LNNs to learn and mimic.

Key Results and Discussion

The integration of physics-informed priors yielded dramatic improvements across several metrics:

  • Sample Efficiency: LNN-based models achieved target performance levels using 10x fewer samples than standard baseline neural networks (BNNs). The "inductive bias" allows the model to start with a structural understanding of gravity and inertia, focusing its learning only on the specific parameters of the robot.
  • Prediction Accuracy: The Forward LNN demonstrated an 85% reduction in prediction error compared to BNNs. As shown in the performance data, while BNN errors explode as the planning horizon increases, LNNs maintain stable, low-error trajectories.
  • Inference Speed: Through optimizations like Inverse Dynamics training and diagonalization, the researchers showed that these physics-informed models can reach control frequencies suitable for real-world deployment, bridging the gap between slow classical solvers and fast but inaccurate MLPs.
Prediction error over time steps. Standard Baseline NNs (green) show rapidly compounding errors, whereas LNN variants maintain significantly lower and more stable error rates over long horizons.

Limitations and Future Work

Despite the success, challenges remain. LNNs are still more computationally demanding than simple MLPs because they require solving equations of motion at every step. Additionally, as robot complexity increases (e.g., more joints), the number of learnable parameters in the physics layers scales, potentially leading to training bottlenecks.

Future research will focus on modifying Reinforcement Learning (RL) policies to output joint accelerations directly, better aligning the policy with the LNN's internal physics representation. The team also aims to refine inverse dynamics training to allow for direct deployment on hardware without requiring privileged acceleration data.

Summary updated

BibTeX
@misc{kotecha2025investigating,
  author = {Prakrut Kotecha and Aditya Shirwatkar and Shishir Kolathaya},
  title = {{Investigating Lagrangian Neural Networks for Infinite Horizon Planning in Quadrupedal Locomotion}},
  year = {2025},
  eprint = {2506.16079},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.16079},
}
Figure