Context-Aware Deep Lagrangian Networks for Model Predictive Control

Lucas Schulze, Jan Peters, Oleg Arenz

Abstract

This paper introduces CaDeLaC (Context-Aware Deep Lagrangian MPC), a framework designed to enable robotic systems to adapt to changing physical properties in real-time. By combining physics-informed Deep Lagrangian Networks (DeLaN) with a recurrent history encoder, the system identifies environmental context—such as unknown payload masses—online. This "grey-box" approach ensures physical plausibility while enabling rapid adaptation. Experimental results on a 7-DOF Franka Emika Panda robot demonstrate a 39% reduction in tracking error compared to standard baselines, showcasing robust zero-shot transfer from simulation to real-world hardware.

Introduction

In classical robotics, control strategies often rely on "white-box" physics models. While these models are highly effective in controlled environments, they struggle when physical properties change unexpectedly—for instance, when a robot arm picks up a tool of unknown mass or interacts with a payload at an unspecified position. Traditionally, engineers address this through System Identification (SysID) to update models online. However, existing methods often fall into two extremes: classical adaptive control, which requires heavy manual engineering and persistent excitation, or black-box neural networks, which require massive datasets and often ignore fundamental laws of physics like energy conservation.

CaDeLaC seeks a "grey-box" middle ground. It leverages the structure of physics-informed neural networks to maintain physical consistency while using a recurrent architecture to rapidly adapt to environmental shifts based on a short window of observations.

Methodology

Deep Lagrangian Networks (DeLaN)

The foundation of the framework is the Deep Lagrangian Network. Unlike standard multi-layer perceptrons (MLPs) that map inputs to outputs arbitrarily, DeLaN uses neural networks to represent the individual components of the Euler-Lagrange equations, specifically the inertia matrix and potential energy. This ensures that the learned model is physically plausible by design.

Residual Learning and Context-Awareness

To optimize performance and speed, CaDeLaC employs several core innovations:

  1. Residual Learning: Instead of learning the entire dynamics of the robot from scratch, the model focuses on the residual—the difference between a known "nominal" model and the actual observed forces. This allows for smaller, faster networks that only need to capture the unknown or changing elements of the system.
  2. Context-Awareness: The authors introduce a latent context variable ($z$) into the DeLaN. This variable represents the current environmental state, such as the mass and center of gravity of a payload.
  3. Online History Encoder: An LSTM (Long Short-Term Memory) network processes a short history of joint positions, velocities, and torques to estimate the latent context $z$ in real-time. This allows the system to "guess" the environmental parameters without explicit manual calibration.

MPC Integration

The context-aware model is integrated into a Model Predictive Control (MPC) loop. Before each control step, the LSTM updates the context $z$. The MPC then uses the resulting physics-consistent model to plan the optimal trajectory. Crucially, the context $z$ is held constant during the MPC's look-ahead horizon, imposing a prior belief that the laws of physics remain stable during the immediate execution of a move.

Experimental Setup

The framework was evaluated using a combination of simulation and physical hardware:

  • Simulation: 1.01 million samples were collected in the MuJoCo physics engine using a 7-DOF Franka Emika Panda robot. The training set encompassed 100 different payloads ranging from 0 to 4 kg at various positions.
  • Real-World Hardware: The system was tested zero-shot—trained entirely in simulation and deployed directly on a physical Franka Emika Panda. Tasks included high-speed trajectory tracking and pick-and-place operations with weights between 1 and 3 kg.

Results and Discussion

Torque and Tracking Accuracy

In simulation, CaDeLaC significantly reduced residual torque error across all seven joints compared to both the nominal model and an Extended Kalman Filter (EKF). On real hardware, the performance gains were even more pronounced. In pick-and-place tasks, CaDeLaC reduced end-effector tracking error by 39%. For comparison, a standard EKF-based baseline achieved only a 21% improvement.

Zero-Shot Robustness

The model successfully performed high-speed maneuvers near the robot's physical velocity limits on real hardware despite having no prior exposure to physical data. This suggests that the physics-informed inductive bias of the DeLaN architecture provides a powerful regularization effect, allowing the model to generalize the "physics" of the mismatch rather than just memorizing input-output mappings.

Limitations and Future Work

Despite its success, CaDeLaC introduces a computational overhead; the neural-network-backed MPC is approximately four times slower than a standard nominal MPC, though it remains within the 20ms window required for 50 Hz control. Additionally, the residual approach is dependent on a reasonably accurate nominal model; extreme discrepancies in the base model may hinder the residual network's performance.

Future research directions include applying this framework to more complex, underactuated systems such as humanoids and exploring the use of Reinforcement Learning to further optimize the history encoder's ability to identify context.

Summary updated

BibTeX
@inproceedings{schulze2025context,
  author = {Lucas Schulze and Jan Peters and Oleg Arenz},
  title = {{Context-Aware Deep Lagrangian Networks for Model Predictive Control}},
  booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems},
  year = {2025},
  doi = {10.1109/iros60139.2025.11246292},
}
Figure