---
title: 'Stonefish Simulator: Marine Robotics Simulation'
url: https://www.emergentmind.com/topics/stonefish-simulator
type: topic
---

# Stonefish Simulator: Marine Robotics Simulation

Stonefish Simulator is a high-fidelity, open-source simulation platform for underwater and surface marine robotics, engineered to support research in hydrodynamics, perception, planning, control, digital-twin integration, and synthetic dataset generation. Combining a modular architecture with advanced physics, sensor simulation, and automated annotation toolchains, Stonefish addresses the acute need for cost-effective, reproducible, and scalable environments, especially where real-world experimentation is constrained by logistics, risk, or safety [2502.11887][2504.06245]. The simulator is compatible with both ROS1 and ROS2, and its capabilities extend from classical rigid-body hydrodynamic modeling to differentiable simulation for soft robots and synthetic benchmarking for event-based and SNN-driven perception tasks.

## 1. Architecture and Software Stack

Stonefish is organized as a C++ core library enabling modular integration of physics, rendering, sensors, actuators, and environment modifiers [2504.06245][2502.11887]. The primary components are:

- **Core Simulation Kernel**: Loads scenario definitions via XML/SDF, handling vehicle URDFs, environment assets, and plugin parameters.
- **Physics Engine**: Built atop Bullet Physics and extended for underwater use (buoyancy, added mass, nonlinear drag, material interactions).
- **Rendering Pipeline**: GPU-accelerated OpenGL renders water optics (absorption, caustics, turbidity) and vision-based sensor outputs.
- **Plugin Framework**: Standardized interface for sensors (acoustic, optical, inertial), actuators (thrusters, robotic arms), and environmental modifiers (currents, seafloor, obstacles) [2502.11887].
- **Middleware Layer**: stonefish_ros1 and stonefish_ros2 bridges provide bidirectional communication with ROS, streaming simulated sensor data to topics and receiving control commands [2408.02277].

External integration supports MATLAB/Simulink via ROS or custom bindings for closed-loop hardware-in-the-loop or real-time digital twin operation [2408.02277].

## 2. Physical and Hydrodynamic Modeling

The Stonefish simulation framework implements complete 6-DOF rigid-body hydrodynamics following Fossen’s marine robotics conventions [2504.06245][2601.01106]:

\[
(M_{RB} + M_A)\,\dot{v} + (C_{RB}(v) + C_A(v))\,v + D(v)\,v + g(\eta) = \tau_{thruster} + \tau_{external}
\]

- **$M_{RB}$**: Rigid-body inertia matrix
- **$M_A$**: Added mass (fluid acceleration)
- **$C_{RB}, C_A$**: Coriolis and centripetal matrices (for body and fluid)
- **$D(v)$**: Nonlinear damping (configurable drag, per-mesh or per-link)
- **$g(\eta)$**: Restoring forces (buoyancy and gravity), includes depth-dependent compression for hadal scenarios [2601.01106]
- **$\tau_{thruster}$, $\tau_{external}$**: Generalized forces from thrusters and exogenous forces

Hydrodynamic coefficients–including drag, added mass, friction–are supplied by scenario config for precise matching to physical prototypes, and per-triangle drag calculation enables mesh-level refinement [2502.11887].

**Thruster models** range from simple quadratic ( $T = K_T n|n|$ ) to physically accurate tabulation or manufacturer curve fitting, supporting zero/first-order actuator dynamics, Yoerger, and Bessa thruster physics [2502.11887]. For tethered platforms, Stonefish incorporates a lumped-mass cable model with spring-damper joints to capture realistic sag, drag, and tension transmission.

## 3. Sensor Suite and Measurement Models

Stonefish provides an extensible, high-fidelity sensor simulation suite, each with explicit noise modeling and true-to-life dynamics [2504.06245][2502.11887][2505.13309]:

| Sensor Type          | Physical Fidelity       | Key Features                 |
|----------------------|------------------------|------------------------------|
| Acoustic (Sonar, DVL)| GPU beam-forming, noise, occlusion, speckle | Structured returns, SNR matched to Gemini datasets |
| Event-based Camera   | DVS log-luminance with per-pixel event generation | Asynchronous event streams, thresholds, refractory periods |
| Optical Cameras      | Pinhole + distortion, caustics, turbidity | Sync with vehicle pose; photorealism for sim2real |
| Thermal              | Per-object and environmental blackbody/radiative transfer | Screen-space shaders, temperature maps |
| Inertial, Navigation | IMU (random walk, Gauss–Markov), DVL, magnetometer, pressure | Realistic bias, colored noise, sensor dropout support planned |

The **event-based camera** module replicates log-intensity DVS operation, emitting events at pixel $(x, y)$ when $|\Delta \log I| > C_\pm$ [2505.13309][2502.11887]. Synchronization with ground-truth optical flow and ray-tracing underlies event-driven perception and SNN evaluation workflows.

## 4. Scenario and Environment Generation

Stonefish supports procedural and user-defined environment generation at high spatial and visual fidelity:

- **Stonefish-Scenegen**: Procedural seabed generator, random placement of coral clusters, control over texture, scale, pose; reproducibility ensured via seed control [2505.13309].
- **Coral-Rich Scene Generation**: Clusters sampled on seabed mesh, poses aligned to surface normals, scaled $[s_{\min}, s_{\max}]$ per sample, full URDF/world export for simulation [2505.13309].
- **Stonefish-Boids**: Advanced agent-based modeling of fish schools, using alignment, cohesion, separation, and leader-following forces, enhanced with OctoMap-based obstacle avoidance for dynamic multi-agent scenes [2505.13309].
- **Dynamic Environment Features**: Turbidity shaders, caustics, particle systems, spatially- and temporally-varying currents modeled using Gauss–Markov processes [2504.06245], pump realistic light attenuation and visibility [2601.01106].

For digital-twin and applied autonomy, full vessel geometry import (via Blender), collision-mesh preprocessing, and real-time scenario synchronization via ROS parameter servers are supported [2408.02277].

## 5. Automated Annotation, Dataset Generation, and ML Integration

Stonefish includes real-time, GPU-accelerated data annotation and export designed for ML-based marine robotics [2502.11887][2505.13309]:

- **Semantic/Instance Segmentation**: On-the-fly label mask projection per visible mesh triangulation.
- **YOLO5/COCO Annotation**: 2D bounding box extraction via projected AABBs.
- **Point Cloud Labeling**: Ray-cast depth → PLY/PointCloud2, per-point labels embedded.
- **High-Throughput Exports**: Frames (PNG/EXR), flow maps, event data, HDF5-format for event streams (via eWiz) [2505.13309].
- **eWiz Library**: Facilitates event-data loading, encoding (event-count, Gaussian time-surface), augmentation, visualization, and built-in loss/metric calculation: Average Endpoint Error (AEE), Average Angular Error (AAE), outlier ratios [2505.13309].

These modules support advanced workflows, such as SNN training with spike-driven losses, robust sim2real transfer, and benchmarking of RL policies via OpenAI Gym or ROS interfaces [2502.11887][2505.13309].

## 6. Application Domains, Use-Cases, and Experimental Validation

Stonefish is employed across a spectrum of research and industrial scenarios:

- **Perception**: Sonar- and event-driven SLAM, DVS odometry, underwater object detection, and scene flow [2505.13309][2502.11887][2504.06245].
- **Control & Planning**: PID/MPC, world-frame navigation with drag, wave/current compensation, and multitiered manipulation (AUV–manipulator coordination with inverse kinematics + acceleration feed-forward) [2601.01106].
- **Digital Twin/Maritime Autonomy**: Figure-8 trajectory tracking, COLREGs navigation rule compliance, emission-driven optimization (ZEST) [2408.02277].
- **Reinforcement and Imitation Learning**: Training and benchmarking of RL agents for depth-keeping, target tracking, visual servoing, using console mode for hardware-accelerated headless simulation [2502.11887][2504.06245].
- **Soft Robotics**: Differentiable simulation of soft Stonefish robots (FEM pipeline, neural network thrust surrogate) for millimeter-accuracy actuation and design optimization [2109.14855].
- **Population Ecology**: Agent-based EPDTA population dynamics for stonefish stock simulation, scenario testing for fishery management, scaling with multiagent systems [1008.3303].

Reported metrics include sub-0.2 m tracking errors on survey tasks [2601.01106], event-driven perception models trained on eStonefish-scenes achieving direct AUV deployment, and RL convergence times (PPO reward > 95% in <2M steps) [2502.11887].

## 7. Limitations, Extensibility, and Future Enhancements

Stonefish’s principal strengths are its extensibility, fidelity (particularly in hydrodynamics and sensor simulation), ROS-centric integration, and its suitability for high-throughput, ML-driven workflow [2504.06245][2502.11887][2505.13309]. Limitations include computational cost with all plugins enabled, restriction to ROS1 as the primary interface (with ROS2 under development), use of lower-order current/wave models (external CFD required for very high turbulence), and abstraction of some manipulator and interaction physics (e.g., no explicit fluid–structure interaction or sensor fault injection yet) [2601.01106][2504.06245].

Planned and emerging features include:

- Integration of simulated sonar and structured-light vision into the onboard perception pipeline [2601.01106]
- Fault-injection modules for robust autonomy testing
- Advanced, multi-agent digital twin and persistent mapping capabilities
- Enhanced current modeling (spatially-varying, time-dependent) and FSI for close-proximity manipulation [2601.01106]
- Broader cross-platform API support and expanded documentation for community-driven extension [2502.11887]

Stonefish thus represents a state-of-the-art, research-grade marine robotics simulation environment encompassing the requirements of high-fidelity physics, advanced perception, robust autonomy validation, and rigorous, scalable dataset generation for the contemporary needs of the underwater robotics and marine research communities.

Source: https://www.emergentmind.com/topics/stonefish-simulator