Differentiable Optimal Control via Differential Dynamic Programming

Traiko Dinev, Carlos Mastalli, Vladimir Ivan, Steve Tonneau, Sethu VijayakumararXiv 2022 · DOI

Presented at IROS 2022, this research addresses a core challenge in robotics: the efficient optimization of a robot's physical design and its underlying cost functions. The authors, from the University of Edinburgh and Heriot-Watt University, propose a mathematically exact and computationally efficient framework for Differentiable Optimal Control.

The Challenge of Bi-Level Optimization

In robotics, we frequently encounter "bi-level" optimization problems. These include co-design, where we seek the optimal physical parameters (like link lengths) to minimize energy consumption during a task, and imitation learning, where we attempt to find the cost function weights that best replicate a demonstrated human trajectory.

Solving these problems requires calculating the gradient of the entire optimal control problem—essentially determining how the final optimal trajectory shifts when a design parameter is tweaked. Existing methods often fall short:

  • Automatic Differentiation (AD): While accurate, "unrolling" every solver iteration is extremely slow and memory-intensive.
  • Iterative Linear Quadratic Regulator (iLQR): This popular "1.5-order" solver ignores second-order dynamics derivatives. While effective for pathfinding, it often produces incorrect gradients for the outer optimization loop, leading to divergence.

Methodology: Sensitivity Analysis via DDP

The researchers propose combining Sensitivity Analysis (SA) with Differential Dynamic Programming (DDP). The key insight is that while a simpler solver can find a trajectory, calculating analytical derivatives of that trajectory requires second-order dynamics terms (Hessians).

The computational workflow for Differentiable DDP, integrating Julia-based derivatives with the Crocoddyl solver.

The workflow involves three main steps:

  1. Solve the Control Problem: Find the optimal motion using a standard solver (DDP or iLQR).
  2. The DDP Pass: Execute a single backward pass using second-order DDP terms to differentiate through the Karush-Kuhn-Tucker (KKT) optimality conditions.
  3. Chain Rule: Use these analytical derivatives to update design parameters via gradient descent.

By utilizing SA instead of unrolling AD, the method avoids tracking intermediate solver steps, requiring only the final converged solution to compute the gradient.

Experimental Results and the "1.5-Order" Trap

The method was evaluated on three systems: a simple pendulum, a double pendulum, and a 7-DOF Kinova Gen3 arm. A critical finding was the failure of iLQR-based gradients in complex scenarios. In the double pendulum experiment, iLQR gradients had the wrong sign in 18% of cases, making optimization impossible.

Comparison of gradients computed via iLQR, DDP, and AutoDiff. While they match for simple systems (left), iLQR fails significantly on more complex dynamics (right).

Key results include:

  • Precision: The DDP-SA method matched ground-truth Automatic Differentiation with near-zero error (1e-15), whereas iLQR gradients exhibited errors up to 1e5.
  • Co-Design Success: In the Kinova arm experiment, iLQR-based optimization diverged immediately. In contrast, DDP gradients converged to the global optimum in fewer than 5 iterations. The resulting design was physically intuitive, placing the end-effector on a plane that allowed the goal to be reached via a simple, energy-efficient base rotation.

Conclusion and Future Work

This work demonstrates that decoupling the solver used for motion from the second-order terms needed for differentiation allows for fast, stable robot co-design. While the second-order backward pass is more expensive than a standard iLQR pass, it provides the accuracy necessary for complex optimization. Future research will focus on developing more efficient analytical libraries for rigid-body dynamics Hessians to enable real-time system identification.

Summary updated

BibTeX
@misc{dinev2022differentiable,
  author = {Traiko Dinev and Carlos Mastalli and Vladimir Ivan and Steve Tonneau and Sethu Vijayakumar},
  title = {{Differentiable Optimal Control via Differential Dynamic Programming}},
  year = {2022},
  eprint = {2209.01117},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2209.01117},
}
Figure