Skip to content

Commit

Permalink
Linear potential wave-body model demo (#70)
Browse files Browse the repository at this point in the history
* Wave Body: Add linear potential wave-body model

Ellipsoid Buoy: add model for an ellipsoid buoy

- Add test model for hydrodynamics models.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: add plugin for testing linear wave-body interaction models

- Initial version of plugin with hydrostatic restoring forces.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: update linear wave-body interaction model

- add contributions to moments from hydrostatic equilibrium term (centre of buoyancy).

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: update linear wave-body interaction model

- update comments and disable debug output

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: update models for testing linear wave-body interaction model

- set wave amplitudes to zero and compare the two hydrostatic models

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: add hydro data file and load into plugin

- Add BEM hydro data .hdf5 file for ellipsoid (generated by capytaine / bemio)
- Add dependency on Eigen. HDF5 and HighFive to read data file (HighFive should be cloned into to workspace)

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: use loaded hydro data in calculations

- Store loaded hydro data in a struct and replace hardcoded data.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: use loaded hydro data in calculations

- Clean up.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: load remaining hydro data

- Complete loading of all hydro data (except for state space model data)
- Load routines can be factored out and consolidated (2nd pass)

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: split update into contributions by force type

- Split out hydrostatic force calculation.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: add parameter for hydro data file

- Add parameter <hydrodata> for specifying HDF5 file.
- Move model specific config under model folder.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: document the hydrostatics calculation

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: use waterplane origin as reference point for displacements

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: add radiation damping test case

- Update variable labelling for pose and vectors
- Add radiation damping test case example (hardcoded)

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: add parameters to control which forces are calculated

- Add flags to control which force contributions are included
- Format hdf5 file reader
- Make hydrostatics forces switchable

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: add force control parameters to ellipsoid example

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: initial version of radiation added mass force

- Reorganise code to enable switching forces on / off
- Outline added mass calculation

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: updated version of radiation added mass force

- Investigate a couple of methods - both approaches to capture acceleration in the force contribution are unstable.
- Alternative methods is to use the SetFluidAddedMass method of the inertial.
- This can be set on the component attached to the link entity in the plugin config, and this appears to propagate to the physics engine.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: replace hardcoded added mass override with parameters

- Allow the added mass and radiation damping to be set in parameters
- Remove added mass calculation from update and set inertial in config
- Add example parameters to demo world

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body: replace hardcoded radiation damping override with parameters

- Allow the radiation damping to be set in parameters

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave-Body:

- Add aliases for Vector6d and Matrix6d
- Add gravity calculation to use instead of global physics engine gravity when enabling added mass
- Update added mass calculation to use gazebosim/gz-physics#384

Signed-off-by: Rhys Mainwaring <[email protected]>

Fluid added mass: update added mass example

- Clean and symmetrise matrix

Signed-off-by: Rhys Mainwaring <[email protected]>

Fluid added mass: add code to symmetrise added mass (disabled)

Signed-off-by: Rhys Mainwaring <[email protected]>

Fluid added mass: add flags for additional debug info

Signed-off-by: Rhys Mainwaring <[email protected]>

Fluid added mass: cleanup

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Excitation: add parameters for constant coefficient overrides

- Add parameters for storing wave excitation force coefficients
- Add template specialisation to read Eigen::Vector6d
- Add example data to sdf model
- Remove stale code for added mass adjustments from class declaration

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Excitation: implement excitation force for regular waves

- Add overrides for wave period, height and phase
- Update documentation describing added mass calculation
- Implement constant coefficient excitation calculation for regular waves
- Update wave model to used trochoids with steepness = 0 (direction not implemented for sinusoids)
- Rename elements for wave excitation force components

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Excitation: correct buoyancy moment calculation

- Correct the buoyancy moment calculation for larger displacements.
- Add missing parameter read for the flag to enable / disable the excitation force

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Excitation: implement excitation Froude-Krylov and scattering force components

- Add example coefficients for excitation Froude-Krylove and scattering components.
- Read parameters in Config.
- Implement force calculations for new components.
- Initialise vectors and matrices to zero.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Excitation: rename variables using Kane/monogram notation

- Rename pose, vectors using Kane/monogram notation described in the Drake docs.
- Fix gravity calculation.
- Factor out common link state updates.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: update example model and add notes

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: add force publishers

- Publish force and torque if enabled
- Add parameters to enable force publishing
- Update launch script to enable ROS bridge for forces

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: configure buoy example to use all forces

- Set initial position to origin for linear potential model example
- Update document with references

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: refactor flags and publishers

- Group flags into structs to reduce clutter.
- Move debug flags into their own SDF element.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: refactor hydro coefficient overrides

- Group coefficients into structs to reduce clutter.
- Reorganise hydro coefficient elements in SDF.
- Move waves and sim environment params into separate structs.
- Add override for hydrostatic linear restoring.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: add geometry overrides

- Add section for geometry overrides.
- Rename the initial pose the body waterplane.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body Tests: add wave models for test cases

- Add regular wave models with different periods and amplitudes.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: fix geometry overrides

- Fix issue with parsing SDF and ensure SDF example valid.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: use waves test model

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: revert waves.sdf to original

- Move ellipsoid test to new world file.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: add world for ellipsoid test case

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body Tests: add spheroid test case

- Add spheroid for added mass Test1a

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body Tests: update spheroid test case

- Add ROS launch file for tests.
- Update BEM coeffs from WEC-Sim example

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: improve overrides - 1

- Rename hydro coefficient class.
- Handle override for hydrostatic restoring.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: improve overrides - 2

- Move HDF5 reader to separate function.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Excitation: fix error in torque calculation

- Fix indexing error in torque lookup.
- Shorten spatial force names.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body Hydrostatics: update treatment of CoB offset from CoM

- Use the initial offset of the CoB from CoM in updates - tricky as CoB is dynamic but linear model appears to rely on this being at initial position.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: improve overrides - 3

- Refactor duplicated code in array read functions.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: improve overrides - 4

- Refactor SDF element names.
- Change <hydrodata> to <hdf5_file> as the element is a file name.
- Move <waves> up a level.
- Change <environment> to <simulation_parameters>
- Shorten <force_publishers> to <publishers>

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: improve overrides - 5

- Add notes on model and WEC-Sim data structures and modelling.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: improve overrides - 6

- Name refactoring - preparation for introducing new structs for data that will be used in updates.

Signed-off-by: Rhys Mainwaring <[email protected]>

Wave Body: improve overrides - 7

- Add improved handling of overrides.
- Remove all override decision making from update loops.
- Add separate data structure to contain the hydro force coefficients used in the update loop.
- Document the load and override policy.

Signed-off-by: Rhys Mainwaring <[email protected]>

* ROS: add a project to publish gazebo messages to ros2

Signed-off-by: Rhys Mainwaring <[email protected]>

ROS: add node to publish body response labelled using maritime conventions

- Add body_response_publisher
- Update launch file

Signed-off-by: Rhys Mainwaring <[email protected]>

ROS: update README

Signed-off-by: Rhys Mainwaring <[email protected]>

ROS: correct topic name for excitation force

Signed-off-by: Rhys Mainwaring <[email protected]>

Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Dec 8, 2022
1 parent b4f7d10 commit 0ed9437
Show file tree
Hide file tree
Showing 12 changed files with 488 additions and 194 deletions.
4 changes: 4 additions & 0 deletions gz-waves-models/world_models/regular_waves/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<static>0</static>
<update_rate>30</update_rate>
<wave>
<!-- <algorithm>trochoid</algorithm>
<steepness>0</steepness> -->
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>2.0</amplitude>
Expand Down Expand Up @@ -44,6 +46,8 @@
<tiles_x>0 0</tiles_x>
<tiles_y>0 0</tiles_y>
<wave>
<!-- <algorithm>trochoid</algorithm>
<steepness>0</steepness> -->
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>2.0</amplitude>
Expand Down
19 changes: 19 additions & 0 deletions gz-waves-models/world_models/regular_waves_6s_0m/model.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

<?xml version='1.0'?>
<model>
<name>Regular Waves 6s 0m</name>
<version>1.0</version>
<sdf version='1.6'>model.sdf</sdf>

<author>
<name>Rhys Mainwaring</name>
<email>[email protected]</email>
</author>

<description>
Monochromatic surface waves T=6s, A=0m.
This model uses the materials from the `waves`
model to prevent duplicating the large mesh files.
</description>
</model>

61 changes: 61 additions & 0 deletions gz-waves-models/world_models/regular_waves_6s_0m/model.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version='1.0' ?>
<sdf version="1.6">
<model name="regular_waves_6s_0m">
<static>true</static>
<plugin
filename="gz-waves1-waves-model-system"
name="gz::sim::systems::WavesModel">
<static>0</static>
<update_rate>30</update_rate>
<wave>
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>0.0</amplitude>
<period>6.0</period>
<direction>1 0</direction>
</wave>
</plugin>
<link name="base_link">
<visual name="visual">
<geometry>
<mesh>
<uri>models://waves/materials/mesh_L256m_N256.dae</uri>
</mesh>
</geometry>
<material>
<ambient>0.0 0.05 0.8 0.92</ambient>
<diffuse>0.0 0.1 0.7 0.92</diffuse>
<specular>0.7 0.7 0.7 0.92</specular>
<pbr>
<metal>
<albedo_map>models://waves/materials/water.jpg</albedo_map>
<normal_map>models://waves/materials/wave_normals.dds</normal_map>
<environment_map>models://waves/materials/skybox_lowres.dds</environment_map>
<roughness>0.3</roughness>
<metalness>0.1</metalness>
</metal>
</pbr>
</material>
<plugin
filename="gz-waves1-waves-visual-system"
name="gz::sim::systems::WavesVisual">
<static>0</static>
<mesh_deformation_method>DYNAMIC_GEOMETRY</mesh_deformation_method>
<tiles_x>0 0</tiles_x>
<tiles_y>0 0</tiles_y>
<wave>
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>0.0</amplitude>
<period>6.0</period>
<direction>1 0</direction>
</wave>
<shader language="metal">
<vertex>models://waves/materials/waves_vs.metal</vertex>
<fragment>models://waves/materials/waves_fs.metal</fragment>
</shader>
</plugin>
</visual>
</link>
</model>
</sdf>
19 changes: 19 additions & 0 deletions gz-waves-models/world_models/regular_waves_6s_1m/model.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

<?xml version='1.0'?>
<model>
<name>Regular Waves 6s 1m</name>
<version>1.0</version>
<sdf version='1.6'>model.sdf</sdf>

<author>
<name>Rhys Mainwaring</name>
<email>[email protected]</email>
</author>

<description>
Monochromatic surface waves T=6s, A=1m.
This model uses the materials from the `waves`
model to prevent duplicating the large mesh files.
</description>
</model>

61 changes: 61 additions & 0 deletions gz-waves-models/world_models/regular_waves_6s_1m/model.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version='1.0' ?>
<sdf version="1.6">
<model name="regular_waves_6s_1m">
<static>true</static>
<plugin
filename="gz-waves1-waves-model-system"
name="gz::sim::systems::WavesModel">
<static>0</static>
<update_rate>30</update_rate>
<wave>
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>1.0</amplitude>
<period>6.0</period>
<direction>1 0</direction>
</wave>
</plugin>
<link name="base_link">
<visual name="visual">
<geometry>
<mesh>
<uri>models://waves/materials/mesh_L256m_N256.dae</uri>
</mesh>
</geometry>
<material>
<ambient>0.0 0.05 0.8 0.92</ambient>
<diffuse>0.0 0.1 0.7 0.92</diffuse>
<specular>0.7 0.7 0.7 0.92</specular>
<pbr>
<metal>
<albedo_map>models://waves/materials/water.jpg</albedo_map>
<normal_map>models://waves/materials/wave_normals.dds</normal_map>
<environment_map>models://waves/materials/skybox_lowres.dds</environment_map>
<roughness>0.3</roughness>
<metalness>0.1</metalness>
</metal>
</pbr>
</material>
<plugin
filename="gz-waves1-waves-visual-system"
name="gz::sim::systems::WavesVisual">
<static>0</static>
<mesh_deformation_method>DYNAMIC_GEOMETRY</mesh_deformation_method>
<tiles_x>0 0</tiles_x>
<tiles_y>0 0</tiles_y>
<wave>
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>1.0</amplitude>
<period>6.0</period>
<direction>1 0</direction>
</wave>
<shader language="metal">
<vertex>models://waves/materials/waves_vs.metal</vertex>
<fragment>models://waves/materials/waves_fs.metal</fragment>
</shader>
</plugin>
</visual>
</link>
</model>
</sdf>
19 changes: 19 additions & 0 deletions gz-waves-models/world_models/regular_waves_8s_1m/model.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

<?xml version='1.0'?>
<model>
<name>Regular Waves 8s 1m</name>
<version>1.0</version>
<sdf version='1.6'>model.sdf</sdf>

<author>
<name>Rhys Mainwaring</name>
<email>[email protected]</email>
</author>

<description>
Monochromatic surface waves T=8s, A=1m.
This model uses the materials from the `waves`
model to prevent duplicating the large mesh files.
</description>
</model>

61 changes: 61 additions & 0 deletions gz-waves-models/world_models/regular_waves_8s_1m/model.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version='1.0' ?>
<sdf version="1.6">
<model name="regular_waves_8s_1m">
<static>true</static>
<plugin
filename="gz-waves1-waves-model-system"
name="gz::sim::systems::WavesModel">
<static>0</static>
<update_rate>30</update_rate>
<wave>
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>1.0</amplitude>
<period>8.0</period>
<direction>1 0</direction>
</wave>
</plugin>
<link name="base_link">
<visual name="visual">
<geometry>
<mesh>
<uri>models://waves/materials/mesh_L256m_N256.dae</uri>
</mesh>
</geometry>
<material>
<ambient>0.0 0.05 0.8 0.92</ambient>
<diffuse>0.0 0.1 0.7 0.92</diffuse>
<specular>0.7 0.7 0.7 0.92</specular>
<pbr>
<metal>
<albedo_map>models://waves/materials/water.jpg</albedo_map>
<normal_map>models://waves/materials/wave_normals.dds</normal_map>
<environment_map>models://waves/materials/skybox_lowres.dds</environment_map>
<roughness>0.3</roughness>
<metalness>0.1</metalness>
</metal>
</pbr>
</material>
<plugin
filename="gz-waves1-waves-visual-system"
name="gz::sim::systems::WavesVisual">
<static>0</static>
<mesh_deformation_method>DYNAMIC_GEOMETRY</mesh_deformation_method>
<tiles_x>0 0</tiles_x>
<tiles_y>0 0</tiles_y>
<wave>
<algorithm>sinusoid</algorithm>
<number>1</number>
<amplitude>1.0</amplitude>
<period>8.0</period>
<direction>1 0</direction>
</wave>
<shader language="metal">
<vertex>models://waves/materials/waves_vs.metal</vertex>
<fragment>models://waves/materials/waves_fs.metal</fragment>
</shader>
</plugin>
</visual>
</link>
</model>
</sdf>
Loading

0 comments on commit 0ed9437

Please sign in to comment.