Differentiable Hydrodynamics for Whole-Body MPC of Underwater Robots

Hefan Wang, Yvan Petillot, Carlos MastalliarXiv 2026 · arXiv

TL;DR

This paper introduces a differentiable hydrodynamic model that enables real-time, whole-body Model Predictive Control (MPC) for underwater vehicle-manipulator systems (UVMS). By using spherical harmonics to represent complex fluid forces and providing closed-form derivatives, the authors allow a robot's controller to "feel" and exploit directional water resistance and fluid inertia during complex maneuvers.

What Problem Does This Paper Address?

Controlling an underwater robot with a robotic arm is a nightmare of coupled dynamics. When the arm moves, it pushes against the water, creating reaction forces that jostle the vehicle. Conversely, the vehicle's motion changes the fluid flow around the arm.

To coordinate these motions effectively—a process called whole-body control—the robot's brain needs to predict how water will resist its movements. While Computational Fluid Dynamics (CFD) can simulate these forces with high precision, it is far too slow for the millisecond-level decision-making required by MPC. Most current controllers settle for oversimplified "diagonal" damping models that ignore how resistance changes with direction or how different components of motion (like surging and pitching) interact.

The authors bridge this gap: they want the accuracy of CFD with the speed of an analytical model that a gradient-based optimizer can use.

Methods

The authors propose a three-stage pipeline to bring high-fidelity hydrodynamics into the control loop:

  1. Offline CFD Sampling: They run a suite of CFD simulations (using OpenFOAM) on the robot's geometry across 64 different directions for steady translation and rotation, plus oscillatory tests to identify "added mass" (the inertia of the water the robot must push out of its way).
  2. Differentiable Analytical Model: Instead of a lookup table, they fit this data using Spherical Harmonics (SH). This creates a smooth, continuous field representing forces and moments. Crucially, they derive closed-form Jacobians (derivatives) for this model. This allows the MPC solver to understand not just what the current force is, but how that force will change if the robot slightly adjusts its trajectory.
  3. Whole-Body MPC: These hydrodynamics are integrated into a multibody dynamics engine (Pinocchio) and an optimal control solver (Crocoddyl). The system optimizes thruster forces and joint torques simultaneously over a receding horizon.
Fig. 1. From CFD to whole-body MPC. Offline CFD samples forces and moments during steady translation/rotation and isolates acceleration loads through oscillation. Analytical hydrodynamics fits spherical fields and an inertia matrix with closed-form derivatives. Whole-body MPC predicts multibody motion from these loads; FDDP uses their Jacobians to coordinate thrusters and joints along the tool reference, applying the first control before replanning. Curves and actuation are schematic; matrix entries are 𝐴𝑎𝑏/√𝐴𝑎𝑎𝐴𝑏𝑏for the six components. Video: https://youtu.be/oX3EtKuudBg.

Datasets

The study uses a simulated BlueROV2 Heavy equipped with a Reach Alpha 5 manipulator.

  • Training Data: Generated via OpenFOAM 13 (RANS k-ω SST model) with 2.55 million cells for steady cases.
  • Evaluation Environment: The Stonefish marine simulator, which provides an independent physics engine to test the controller's robustness against model-plant mismatch.

Key Insights and Ideas

  • Direction Matters: The robot isn't a sphere; it has different drag profiles depending on whether it's moving forward, sideways, or rotating. The spherical harmonic model captures these "directional resistance" nuances that diagonal models miss.
  • Differentiability is the "Secret Sauce": Gradient-based optimizers (like FDDP) are much more efficient when they have exact analytical derivatives. The authors show that their analytical Jacobians are not only more accurate but also significantly faster than the standard "finite difference" method (calculating derivatives by nudging the state and re-evaluating).
  • Motion Allocation: Because the optimizer understands the hydrodynamics, it can decide to use the vehicle to "reach" for a target if the arm's motion would create too much drag or exceed torque limits. It treats water forces as part of the system dynamics to be exploited, rather than just external disturbances to be rejected.

Key Results

  • Computational Efficiency: The analytical hydrodynamic kernel evaluates in 2.27 µs, compared to 7.28 µs for central finite differences. More importantly, it avoids the numerical sensitivity issues inherent in choosing a "step size" for finite differences.
  • Prediction Accuracy: The model achieved approximately 10% error on held-out CFD test directions for steady-load fields and below 2.2% error for added-inertia responses.
  • Tracking Performance: In the Stonefish simulator, the whole-body MPC tracked a complex 108-second helical trajectory with a 7.80 mm RMS position error.
  • Thrust Savings: Using a directional drag model reduced the total "thrust impulse" (energy expenditure) by 7.9% compared to a simpler isotropic model during a rest-to-rest reaching task.
Comparison of runtime and derivative accuracy between the proposed analytical method and standard finite differences.

Limitations and Future Work

  • Geometry Specificity: The CFD sampling must be re-run for every new robot shape. While the authors suggest this could be automated, it remains a significant pre-processing step.
  • Lumped Buoyancy: The current model approximates buoyancy at a single fixed center for the whole system, which might lose accuracy for very large or heavy manipulators where the center of buoyancy shifts significantly with joint configuration.
  • Static Environment: The model assumes a uniform current. Future work could extend this to handle more complex, spatially varying flows or the "wall effect" when operating near the seafloor or structures.

Summary updated

Abstract

Underwater vehicle-manipulator systems distribute actuation across thrusters and joint motors. Whole-body model predictive control (MPC), rather than separate vehicle and arm controllers, can coordinate both to extend the workspace and exploit the system's full kinematic capability. Doing so, however, requires a hydrodynamic model and derivatives throughout the prediction horizon. Computational fluid dynamics (CFD) captures geometry-dependent forces and moments for such a model, but is too expensive to evaluate online. We present a differentiable analytical hydrodynamic model combining smooth spherical-harmonic force and moment fields with a coupled added-inertia matrix identified from CFD. It compactly represents velocity and acceleration-dependent loads and provides their derivatives in closed form. These derivatives are propagated through free-floating vehicle--manipulator dynamics for whole-body trajectory optimization and receding-horizon control, jointly optimizing thruster forces and joint torques for reaching and continuous tracking. Held-out CFD tests validate the principal translational-force and rotational-moment fields and the added-inertia response. The analytical Jacobians evaluate faster and avoid the step-size sensitivity of central finite differences. Closed-loop Stonefish experiments demonstrate whole-body MPC in an independent marine simulator. By making geometry-dependent hydrodynamics directly available to gradient-based control, the model incorporates water forces and their sensitivities into motion allocation between the vehicle and arm, rather than treating them only as disturbances.
BibTeX
@misc{wang2026differentiable,
  author = {Hefan Wang and Yvan Petillot and Carlos Mastalli},
  title = {{Differentiable Hydrodynamics for Whole-Body MPC of Underwater Robots}},
  year = {2026},
  eprint = {2611.25373},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.25373},
}
Figure