Skip to main content
Back

University of Girona Trains an Underwater Robot to Dock Itself With 90% Success

A PPO-trained policy pilots the Girona AUV into its dock using a Stonefish digital twin, transferring cleanly from simulation to a real test tank.

Pro

Paper, Full Access
  • University of Girona team trained a PPO policy to dock the Girona AUV using the Stonefish simulator.
  • Stonefish was adapted into a headless multiprocessing RL framework, cutting training latency versus ROS-based setups.
  • Reward combines distance, orientation, action smoothness, and adaptive collision penalties for soft docking.
  • Policy achieved over 90 percent success in simulation with randomized starting positions.
  • Sim-to-real transfer validated in a physical test tank without retraining.
  • Emergent behaviors included pitch-based braking and yaw oscillations to aid mechanical alignment with the dock.

Docking an autonomous underwater vehicle is one of the harder control problems in robotics. Currents shove the vehicle around, sensors are noisy, and the target is a small funnel a few meters wide. A new paper from the University of Girona shows that a deep reinforcement learning policy trained inside a high fidelity simulator can handle the whole approach and mating maneuver, then transfer to a real vehicle in a test tank without retraining.

Why classical controllers keep struggling

Underwater docking has historically been solved with hand tuned model based controllers. Those work when the ocean cooperates, but as prior work from the same group notes, docking an AUV under realistic conditions is difficult because traditional model-based controllers are often constrained by the complexity and variability of the ocean environment. Currents, sensor drift, and the non linear coupling between the vehicle's six degrees of freedom make it hard to write a controller that generalizes.

Reinforcement learning is an obvious alternative, but it comes with two well known headaches: training takes forever when the simulator runs in real time with graphics on, and policies that look great in simulation often fall apart on real hardware. This paper is essentially a recipe for beating both problems on a specific, useful task.

Turning Stonefish into an RL factory

The team built on Stonefish, an open source marine robotics simulator. Stonefish is an extensible underwater robotic simulator with a high-fidelity, ROS-compatible framework that accurately simulates autonomous underwater vehicle dynamics and sensor-rich platforms, and it already models buoyancy, collision detection, geometry-based hydrodynamics, rigid body dynamics, and light absorption and scattering to generate authentic underwater images.

The catch is that Stonefish, like most marine simulators, was not built for RL throughput. Earlier attempts integrated OpenAI Gym with Stonefish through a ROS interface, but communication through ROS has been proven to slow down training time. The authors ripped that out and adapted Stonefish into a multiprocessing RL framework that runs headless, so many simulated Girona AUVs can train in parallel without rendering overhead.

Stonefish simulator showing the Girona AUV in a 3D underwater environment

The policy and the reward that shapes it

The controller is a Proximal Policy Optimization (PPO) agent that outputs commands for all six degrees of freedom of the Girona 500 AUV, whose geometric model and material properties are used to ensure an accurate simulation of the vehicle's physical characteristics and forces. PPO is a policy gradient method that keeps updates small enough to stay stable, which matters when a bad step can slam a simulated vehicle into a dock.

The reward function is where most of the engineering hides. It combines four terms:

  • Distance to the docking target, pulling the vehicle in
  • Orientation alignment with the dock axis, so the AUV arrives pointing the right way
  • Action smoothness, penalizing jittery thruster commands
  • Adaptive collision penalties that scale with impact severity, encouraging soft contact rather than avoidance at all costs

Starting positions are randomized every episode, which forces the policy to generalize instead of memorizing a single approach corridor.

What actually happened in the water

In simulation, the agent achieved a success rate above 90 percent. More interesting is what showed up when the policy was moved to a physical test tank. The controller exhibited emergent behaviors the reward function never explicitly asked for: pitch based braking, where the vehicle tilts to use its own hull as a brake, and small yaw oscillations that appear to help mechanically align the nose with the docking funnel.

Multi-mission 3D trajectory plot showing six docking approaches converging on the target zone

Where this fits in the broader picture

Stonefish is becoming the de facto learning environment for marine robotics. It is already used for training and benchmarking RL agents for depth-keeping, target tracking, and visual servoing, using console mode for hardware-accelerated headless simulation. Docking is a natural next milestone because it is the operation that lets an AUV recharge, offload data, or hand off to a mothership without a human in the loop.

The limitations are honest ones. The physical validation happened in a test tank, not open ocean, so real currents, biofouling on sensors, and acoustic multipath in a cluttered seafloor are still open questions. Related work like MarineGym points out that simulators including Stonefish rely on CPU-based multiprocessing physics engines, which limits their efficiency in large-scale training data generation, so scaling this approach to much larger policies will likely need GPU accelerated physics.

The paper does not release code or trained weights publicly, which is worth flagging for anyone hoping to reproduce the setup on their own vehicle. Still, the recipe itself, headless multiprocessing Stonefish plus PPO plus a physics aware reward, is reproducible, and it is one of the cleaner sim to real demonstrations for AUV docking to date.