gz_waves: FFT backend - Part 4/4#885
Conversation
3253aa3 to
c9ba107
Compare
f4a163e to
4d50173
Compare
c9ba107 to
aa40214
Compare
7df415e to
3a1f9b0
Compare
aa40214 to
c14f9f6
Compare
8025d64 to
b5c9223
Compare
509839f to
85be063
Compare
b5c9223 to
e88d3bb
Compare
85be063 to
e1af261
Compare
|
Hi @caguero, this looks good. I'm in the process of building this to test on macOS under Gazebo Jetty. May have an issue with missing metal shaders, but will let you know if I can get it running. I see in the code you've benchmarked against vrx/gz_waves_rendering/src/systems/Ogre2HeightMapBridge.cc Lines 101 to 103 in e88d3bb Appreciate asv_wave_sims GPL license is a problem for vrx, but an acknowledgement would be nice. |
e1af261 to
8d6502e
Compare
e88d3bb to
6c48906
Compare
8d6502e to
e513a4d
Compare
6c48906 to
09df94e
Compare
|
I was not able to run the example. I suspect that we have a build environment issue. @caguero - It would be good to provide the details of the build environment you expect folks to use. Here is what I pieced together from the jazzy release.... First, modify open_water.sdf to use SDF version 1.11 vice 1.12 Then.... Then in container... This runs without error, but Gazebo hangs: So, would appreciate instructions to reproduce the intended dev environment. |
09df94e to
11ca4b6
Compare
…I registrar Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
… FFT the default in open_water.sdf Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
Make the FFT engine build on the rebased stack and match its conventions: - ParticleVelocity/Normal return gz::math::Vector3d (the IWaveField interface is now gz::math); Eigen stays internal to EncinoWaves and the grid accessors. - std::cerr/std::cout -> gzerr/gzmsg (wire gz-common into the engine target). - Members switch to gz-style this->member (no trailing underscore). - Wire gz-math/gz-common into CMake + package.xml. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Agüero <caguero@honurobotics.com>
…ence) ParticleVelocity was a zero stub, so buoyancy/drag saw still water under the FFT backend. EncinoWaves exposes no velocity field or public spectral coefficients, so compute the Eulerian water velocity as the time derivative of the displacement field (∂Dx/∂t, ∂Dy/∂t, ∂η/∂t): each Update propagates a scratch state at t+dt and finite-differences it into velocity grids that ParticleVelocity bilinear-samples. Adds two tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Agüero <caguero@honurobotics.com>
Drop the retired "backend" / "wave model" terms in comments and Doxygen in favour of "engine" / "wave field engine", matching the vocabulary settled in the PR1 review. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
11ca4b6 to
f26cb6d
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
27f20c0 to
e5228b5
Compare
|
@srmainwaring thanks Rhys. Added an acknowledgement crediting asv_wave_sim's displacement-map approach at the top of |
|
@bsb808, the supported platform is ROS Lyrical with Gazebo Jetty (our target, and currently the most modern stable ROS and Gazebo combination). I documented the local prerequisites in |
|
@caguero I have a patched version of this PR running on macOS using Metal shaders. It is working fairly well. There are some hardcoded changes that need to be dynamic depending on the choice of platform and render engine.
The patches to this PR for macOS are here: https://github.com/srmainwaring/vrx/tree/prs/waves-04-fft-metal The On macOS the vrx project is built in a Pixi workspace (target is osx-arm64). I now use these exclusively for ROS and Gazebo development on macOS. If you are interested the Details[workspace]
channels = [
"https://prefix.dev/ardupilot",
"https://prefix.dev/robostack-jazzy",
"conda-forge"]
name = "gz-jetty-vrx"
platforms = ["osx-arm64"]
version = "0.1.0"
[activation]
scripts = [".pixi/envs/default/setup.sh"]
[activation.env]
GZ_IP = "127.0.0.1"
GZ_PARTITION = "jetty"
GZ_VERSION = "jetty"
# vrx
#GZ_SIM_RESOURCE_PATH = "$GZ_SIM_RESOURCE_PATH:$PIXI_PROJECT_ROOT/workspace/src/vrx"
#GZ_SIM_SYSTEM_PLUGIN_PATH = "$GZ_SIM_SYSTEM_PLUGIN_PATH:$PIXI_PROJECT_ROOT/workspace/src/vrx"
[dependencies]
# build essentials
cmake = "<4"
colcon-common-extensions = ">=0.3.0,<0.4"
compilers = ">=1.11.0,<2"
ninja = ">=1.13.2,<2"
python = ">=3.12.13,<3.13"
# utiltities
gh = ">=2.92.0,<3"
git = ">=2.53.0,<3"
tree = ">=2.3.2,<3"
# gz-* dependencies from conda-forge
#assimp = ">=6.0.5,<7"
bullet-cpp = ">=3.25,<4"
cli11 = ">=2.6.2,<3"
cppcheck = ">=2.20.1,<3"
cppzmq = ">=4.11.0,<5"
dartsim-cpp = ">=6.16.7,<7"
eigen = ">=3.4.0,<5"
ffmpeg = ">=8.0.1,<9" # jazzy
#ffmpeg = ">=8.1.1,<9" # kilted
freeimage = ">=3.18.0,<4"
jsoncpp = ">=1.9.6,<2"
libabseil = ">=20250512.1,<20250513" # jazzy
#libabseil = ">=20260107.1,<20260108" # kilted
libarchive = ">=3.8.7,<4"
libcurl = ">=8.20.0,<9"
libcxx = ">=22.1.4,<23"
libgdal = ">=3.12.2,<4" # jazzy
#libgdal = ">=3.12.4,<4" # kilted
libgdal-core = ">=3.12.2,<4" # jazzy
#libgdal-core = ">=3.12.4,<4" # kilted
libode = ">=0.16.6,<0.17"
# ros2-distro-mutex >=0.14.0,<0.15.0a0
libprotobuf = "==6.31.1" # jazzy
#libprotobuf = "==6.33.5" # kilted
libsqlite = ">=3.53.1,<4"
libzenohc = ">=1.9.0,<2"
libzip = ">=1.11.2,<2"
ogre = ">=1.10.12.1,<2"
ogre-next = ">=2.3.3,<3"
pkg-config = ">=0.29.2,<0.30"
pybind11 = ">=3.0.3,<4"
#qt6-main = ">=6.11.0,<7"
spdlog = ">=1.17.0,<2"
tinyxml2 = ">=11.0.0,<12"
zeromq = ">=4.3.5,<5"
#urdfdom = ">=5.1.2,<6"
#urdfdom_headers = ">=2.1.2,<3"
yaml = ">=0.2.5,<0.3"
ruby = ">=4.0.2,<5"
swig = ">=4.4.1,<5"
# ardupilot
blas = { version = "*", build = "accelerate" }
ros2-distro-mutex = { version = ">=0.14.0,<0.15", build = "jazzy_*" }
ros-jazzy-gz-sim-vendor = ">=0.4.4,<0.5"
# robostack-jazzy
ros-jazzy-ament-cmake-auto = ">=2.5.5,<3"
ros-jazzy-desktop = ">=0.11.0,<0.12"
ros-jazzy-sdformat-urdf = { version=">=1.0.2,<2", build="*jetty*" }
ros-jazzy-ros-gz-interfaces = { version=">=1.0.19,<2", build="*jetty*" }
ros-jazzy-ros-gz-bridge = { version=">=1.0.19,<2", build="*jetty*" }
ros-jazzy-ros-gz-image = { version=">=1.0.19,<2", build="*jetty*" }
ros-jazzy-ros-gz-sim = { version=">=1.0.19,<2", build="*jetty*" }
ros-jazzy-rviz-default-plugins = { version=">=14.1.19,<15", build="*jetty*" }
ros-jazzy-xacro = ">=2.1.1,<3"
# jazzy
# pixi add "protobuf>=6.31.1,<7"
# pixi add "gz-sim [version='10.*', build='*protobuf6311*']"
gz-sim = { version = "10.*", build = "*protobuf631*_2*" }
gz-sensors = ">=10.0.0,<11"
gz-gui = ">=10.0.0,<11"
gz-transport = ">=15.0.2,<16"
gz-rendering = ">=10.0.1,<11"
gz-physics = ">=9.2.0,<10"
gz-fuel-tools = ">=11.0.0,<12"
sdformat = ">=16.0.1,<17"
gz-msgs = ">=12.0.1,<13"
gz-common = ">=7.1.1,<8"
gz-plugin = ">=4.0.0,<5"
gz-math = ">=9.1.0,<10"
gz-utils = ">=4.0.0,<5"
gz-tools = ">=2.0.3,<3"
gz-cmake = ">=5.1.0,<6" |
…ajor grids directly Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
…Gerstner chop) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
…onfigure changes grid_size Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
…per-tick FFT cost Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
…ption safety) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
|
I was able to successfully run the example with the docker env from #889 I think it will be important to verify the model - HonuRobotics/encinowaves#4 I did get a few run time warnings: and |
|
CC says the warnings are cosmetic, do nott affect behavior, and the fix lives upstream in gz-sim's visual-plugin loader, not here. It's a well-known Gazebo quirk for any visual plugin that carries parameters. Good enough for me! |
bsb808
left a comment
There was a problem hiding this comment.
I left a few small comments/suggestions, but no showstoppers.
Merge when ready.
| /// \brief Bilinear sample of `_grid` at the given world (x, y), wrapping | ||
| /// queries outside the tile to its periodic image. | ||
| /// \param[in] _grid The grid to sample. | ||
| /// \param[in] _x World x coordinate [m]. |
There was a problem hiding this comment.
Might be worth mentioning the coordinate convention. Is the world coordinate frame consistent with REP 103 - i.e., is it ENU?
| @@ -0,0 +1,487 @@ | |||
| /* | |||
There was a problem hiding this comment.
I ran the test with....
colcon test --packages-select gz_waves_provider_fft --merge-install
colcon test-result --verbose
Result
Summary: 31 tests, 0 errors, 0 failures, 5 skipped
Is this the expected result? Is the skipped tests expected?



Fourth in the series. Adds the second wave engine, the FFT spectral backend built on the EncinoWaves library, and wires it into the visual and the demo world as a selectable alternative to Gerstner.
How to test it?
What this PR adds
FFTWaveSimulation,libgz-waves-provider-fft) — a plainIWaveFieldbacked by EncinoWaves (TMA/JONSWAP/PM spectra + directional spreading + dispersion).MakeFFTWaveField()is its factory.gz-sim-waves-fft-system) — aWavesSystemBasesubclass that builds the FFT engine and writes theWavefieldcomponent. Its doc block documents the full parameter surface and the<sea_state>precedence rules.gz-sim-waves-fft-gui) — registers the"fft"factory in the GUI soWaterVisualcan rebuild a private FFT engine; same bare, no-ISystem, static-init form as the Gerstner registrar.test/fft_test.cc, 18 tests).gz-sim-waves-fft-guito thewater_surfacemodel (next to the Gerstner registrar) and offers FFT as a commented alternative inopen_water.sdf. Gerstner stays the active default — flip by commenting the Gerstner<plugin>and uncommenting the FFT one.