Physics-based sonar preview
The physics-based sonar preview simulates echoes from an underwater scene and displays their intensity by range and bearing. The images below show an exploratory experiment recorded with a dedicated sensor configuration. Reproducing it requires the matching sonar provider and sensor settings.
Runtime and sensor selection
The built-in Sensors panel can display a JPEG preview of a supported sonar image. This is a display image, not a replacement for raw acoustic data. See When the image has not appeared yet.
For an available typed-image preview, the Sensors panel shows the original topic; its information (i) tooltip shows the preview topic and explains compression and preservation of the original message; see When the image has not appeared yet.
Here, “original” means the sensor_msgs/Image before JPEG preview conversion; a sonar Image can already be a visualization. Acoustic observations use the separate marine_acoustic_msgs/ProjectedSonarImage message. The tooltip does not establish acoustic accuracy.
Open Workspace → Custom robots → Build vehicle and check Forward multibeam availability. Provider required means the host needs a compatible acoustic plugin. When available, select the sensor, save its mount and rate, then start a world with that vehicle. Topics and frames follow the saved sensor manifest.
A native package can include a verified provider matched to its selected engine. If that provider is missing or fails validation, multibeam remains unavailable; vehicles that do not use it can still start. Native sonar also requires a camera in the composed scene. The installed workspace normally supplies its observer camera, so a sonar-only robot payload does not require an extra robot camera. A custom scene using native sonar with neither an observer camera nor a standard camera is rejected before Gazebo starts. Provider availability is separate from mission readiness and control validation.
A multibeam image, single Ping range, DVL velocity and SLAM map are different outputs. See Optional sensors and providers and the POSIM sonar documentation for runtime requirements. The comparison recording does not establish availability of every sonar or SLAM feature in an installed app.
Acoustic processing catalogue
- Ray geometry → range and surface normal
Gazebo samples the scene within the horizontal/vertical fan. Mount pose, angular sampling and visibility masks determine which surfaces contribute.
- Scattering → complex frequency response
The point-scattering model combines range, surface orientation, reflectivity, propagation attenuation and phase. Stochastic terms produce speckle.
- Beam correction → range transform
Beam correction mixes the frequency responses; the configured frequency window and FFT processing form range samples. Range bins must match the transform length and sound-speed/bandwidth calibration.
- Raw acoustic observation → display
Publish range/beam intensity with metadata, then apply presentation gain and fan projection. Ray-geometry points are a separate output.
| Technology | Concrete implementation | Interpretation |
|---|---|---|
| Geometry sampling | Gazebo ray rendering and the provider's spherical ray geometry; the application adapter derives surface normals from a local neighbourhood of valid points. | Scene geometry and sampling density limit features. RGB lighting is not acoustic reflectivity. |
| Point scattering | Surface reflectivity/orientation, two-way propagation attenuation and per-frequency phase contribute to a complex return. | A physically motivated approximation; it does not solve the full acoustic wave equation around the scene. |
| WGPU backscatter | Rust hosts WGSL compute kernels. Backscatter accumulation, fixed-point-to-float conversion, beam-correction matrix multiplication and FFT/readback form the GPU pipeline. | WGPU can use compatible NVIDIA or non-NVIDIA adapters. Availability and throughput depend on the actual driver, adapter and render environment. |
| Frequency/range processing | Windowing controls range sidelobes. The WGPU implementation supports exact transform lengths, including a Bluestein path for non-power-of-two sizes. | The number of displayed pixels is not independent range resolution. Preserve frequency sampling, bandwidth, sound speed and bin metadata. |
| Presentation | Display gain, colour map and range/bearing or metric-fan projection visualize the acoustic observation. | Save raw intensity as well as display settings when comparing targets; brightness alone is not calibrated target strength. |
| Geometry point cloud | Ray intersections can be bridged as PointCloud2 for geometric debugging. |
It is not a set of reconstructed acoustic detections and is not a SLAM map. |
Compute backends and parameters
GPU qualification also requires evidence of the actual discrete or integrated adapter. A WGPU backend name or software Vulkan renderer alone does not confirm hardware GPU execution.
In the Linux container, CPU and CUDA require separate measured qualification for the same source, libraries and image. Explicit CPU selection does not probe the GPU. Automatic selection accepts only a qualified GPU whose live UUID, driver and runtime match its evidence; it never silently falls back to CPU. The live GPU query has a 10-second timeout. Missing, mismatched or unsupported GPU evidence leaves sonar unavailable. WGPU is not available through this container qualification path. The Gazebo child uses the verified backend and canonical library paths.
Image qualification and local-device qualification are separate. A GPU UUID recorded on the release test machine does not qualify another computer. Before CUDA sonar is allowed on a different GPU, a local probe must run in the same immutable engine image and verify the actual device, driver/runtime identity, finite acoustic frames, a moving target and loaded-library hashes. Evidence is valid only for that image and device configuration; changing the image or driver requires rechecking. The installed NVIDIA driver version is checked separately from the CUDA driver-API and runtime versions; a CUDA API number is not the installed driver version.
The container permits qualified legacy-grid CPU/CUDA readout only. The built-in BlueROV2 uses this mode. Custom physicalReadout (positive receiveBeamWidth) is rejected before simulator launch, on CPU as well as CUDA; the original model is not rewritten or silently converted to legacy-grid. Native Mac has a separate provider qualification path.
Local container GPU qualification currently supports NVIDIA/CUDA only. AMD/Intel WGPU qualification is not implemented, and detecting Vulkan alone does not confirm sonar acceleration. The current probe requires one visible NVIDIA GPU; selecting among multiple NVIDIA GPUs is not supported. An unverified configuration does not mean the computer has no GPU: use explicit Software (CPU), or resolve the configuration and repeat preparation.
On Windows, local CUDA qualification requires the default WSL2 kernel, the local Docker Desktop Linux engine and exactly one physical NVIDIA GPU. The physical GPU and CUDA device must report the same UUID.
The selected provider source is POSIM v1.0.1 (3e000044). A usable sensor requires a provider qualified for the actual host, engine and backend. Linux container qualification is separate from native macOS; upstream v1.0.1 does not support native macOS. A custom Mac build alone does not establish provider availability.
CPU computation depends on the acoustic readout. With physicalReadout (positive receiveBeamWidth), it computes complex frequency returns, applies the window and pressure-response matrix, then uses OpenCV row-wise DFT for range readout. The legacy-grid CPU path accumulates rays directly into range bins and applies its window and beam correction; it is not the WGPU spectral FFT calculation. Record the readout mode as well as the backend when comparing results.
The raw dB output floors zero or sub-threshold amplitude at 1e-10 (−200 dB); larger amplitudes are unchanged. This numerical floor is not a measured noise floor. NaN and infinite observations remain invalid. Identical stationary inputs can produce identical legacy CPU frames; require fresh timestamps and response to a controlled scene change rather than pixel changes alone.
The upstream compute factory supports auto, wgpu, cuda and cpu. auto tries CUDA, WGPU and CPU in that order. Explicit GPU selection requires successful initialization. WGPU uses Metal on native macOS and Vulkan on Linux; CPU selects acoustic computation on the CPU. All paths still require Gazebo rendering for scene sampling. A Linux container on a Mac does not inherit native Metal access.
| Parameter | Effect and dependency |
|---|---|
| Horizontal beams, vertical rays, angular limits | Set fan coverage and angular sampling. More vertical rays sample elevation; the resulting 2D intensity image still combines elevation contributions. |
sonarFreq, bandwidth, soundSpeed |
Carrier frequency in Hz, bandwidth in Hz and assumed sound speed in m/s control the propagation/range calculation. |
Ray min/max, maxDistance |
Geometric sampling and acoustic processing range must agree. |
raySkips |
Reduces the rays used by acoustic processing, trading sampling for computation. |
sourceLevel, reflectivity, attenuation |
Set source/scene contributions to the model. They require calibration before interpreting output as a particular physical instrument. |
| Frequency window | Tapers sampled frequency content to control sidelobes; retained in the provider/application processing configuration. |
sensorGain, display mode |
Change presentation. Retain them when comparing exported images. |
update_rate, logging |
Request measurement cadence and diagnostic recording; neither guarantees achieved sensor Hz. |
frameName, topic names, visibility mask |
Define the observation frame, message routes and contributing scene geometry. |
Imaging multibeam sonar gives the application's initial fan, rate and range. Build-time backend support and runtime selection must both be recorded. The provider log reports the selected backend; a repository's existence or a GPU brand alone does not establish a working sensor.
The public provider implementation contains the C++ Gazebo sensor and Rust/WGPU library. WWW-POSIM adds model composition, provider compatibility checks and geometry/window/display adaptations. The application uses the selected v1.0.1 provider source with its recorded adaptation patch and compatibility checks.
Reading the observation
Raw marine_acoustic_msgs/ProjectedSonarImage carries the acoustic observation; sensor_msgs/Image is its display form. A straight wall can curve on a bearing-versus-range plot because slant range changes with bearing. A metric fan uses a different projection. Neither 2D view uniquely resolves height within the vertical fan. Mount attitude, bottom returns, surface-normal estimation and multipath-like artifacts can also affect appearance.
Keep the scene, final sensor SDF, provider/backend, acquisition time, vehicle pose, raw observation and gain/window settings together. The following controlled-removal comparison illustrates response changes; it does not establish general detection performance.
Three objects and their sonar returns
A BlueROV2 held position underwater while three physical objects were removed one at a time. The reference camera was mounted beside the sonar. The seabed and other background geometry remained in the scene.
The horizontal axis is bearing in degrees; the vertical axis is slant range in metres. Warmer colours in the lower plots indicate a stronger median return before removal. Each plot uses a short window of recorded sensor frames. Changes near the nominal locations are consistent with the removals, but the seabed, pose changes, speckle and processing artifacts also affect the image. This experiment alone does not uniquely identify each return or establish detection accuracy.
The recording used a custom 60° vertical fan tilted 20° down, a 0–15 m display and disabled surface reflections. These settings were chosen for the experiment and differ from the usual sensor configuration. The vehicle held position, but moved slightly; the comparison was not registered to a fixed pose.