From daaf51895f9a7214b3fb103c34c64688f1128c7b Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Mon, 9 Sep 2024 13:04:15 -0700 Subject: [PATCH 1/8] Update added-mass of lrauv model and remove added mass definitions from examples Fixes #2575 Since, we have decided to deprecate added mass in the hydrodynamics plugin in favour of Rigid Bodies, we should update our examples to avoid the warning. TODO: Update maritime tutorials and migration guide. Signed-off-by: Arjo Chakravarty --- examples/worlds/acoustic_comms_demo.sdf | 24 +++--------------------- examples/worlds/auv_controls.sdf | 8 +------- examples/worlds/dvl_world.sdf | 12 ++---------- examples/worlds/lrauv_control_demo.sdf | 8 +------- examples/worlds/multi_lrauv_race.sdf | 25 +++---------------------- test/worlds/bottomless_pit.sdf | 2 +- test/worlds/flat_seabed.sdf | 2 +- test/worlds/underwater_currents.sdf | 2 +- 8 files changed, 13 insertions(+), 70 deletions(-) diff --git a/examples/worlds/acoustic_comms_demo.sdf b/examples/worlds/acoustic_comms_demo.sdf index 6e1be4c4b9..d14a61e818 100644 --- a/examples/worlds/acoustic_comms_demo.sdf +++ b/examples/worlds/acoustic_comms_demo.sdf @@ -71,7 +71,7 @@ 0 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 @@ -172,7 +166,7 @@ 15 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic triton @@ -250,12 +244,6 @@ filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 @@ -274,7 +262,7 @@ -15 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic daphne @@ -352,12 +340,6 @@ filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 diff --git a/examples/worlds/auv_controls.sdf b/examples/worlds/auv_controls.sdf index 18914a6629..fec1dfa9b4 100644 --- a/examples/worlds/auv_controls.sdf +++ b/examples/worlds/auv_controls.sdf @@ -71,7 +71,7 @@ 0 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI%20Tethys%20LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 diff --git a/examples/worlds/dvl_world.sdf b/examples/worlds/dvl_world.sdf index 0b599a3cb4..68aa5f114c 100644 --- a/examples/worlds/dvl_world.sdf +++ b/examples/worlds/dvl_world.sdf @@ -134,12 +134,11 @@ - 0 0 -80 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic - + U base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 - -6.2282 0 -601.27 0 diff --git a/examples/worlds/lrauv_control_demo.sdf b/examples/worlds/lrauv_control_demo.sdf index 56e3900b2b..258836d5f3 100644 --- a/examples/worlds/lrauv_control_demo.sdf +++ b/examples/worlds/lrauv_control_demo.sdf @@ -175,7 +175,7 @@ 0 0 1 0 0 0 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 diff --git a/examples/worlds/multi_lrauv_race.sdf b/examples/worlds/multi_lrauv_race.sdf index 902d89111a..d2aad170e9 100644 --- a/examples/worlds/multi_lrauv_race.sdf +++ b/examples/worlds/multi_lrauv_race.sdf @@ -59,7 +59,7 @@ 0 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 @@ -152,7 +146,7 @@ 5 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic triton @@ -222,13 +216,6 @@ filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 - -6.2282 0 -601.27 0 @@ -246,7 +233,7 @@ -5 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic daphne @@ -316,12 +303,6 @@ filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 diff --git a/test/worlds/bottomless_pit.sdf b/test/worlds/bottomless_pit.sdf index e08820eb3a..1a8fde7162 100644 --- a/test/worlds/bottomless_pit.sdf +++ b/test/worlds/bottomless_pit.sdf @@ -69,7 +69,7 @@ 0 0 -80 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic 0 0 -80 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic 0 0 -0.5 0 0 1.57 - https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV + https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic Date: Mon, 9 Sep 2024 13:27:25 -0700 Subject: [PATCH 2/8] Update Migration guide Signed-off-by: Arjo Chakravarty --- Migration.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Migration.md b/Migration.md index 4f6632b474..b6cd731352 100644 --- a/Migration.md +++ b/Migration.md @@ -23,6 +23,10 @@ release will remove the deprecated code. `gz::sim::systems::kPostPhysicsSensorPriority` constant to ensure that its `Update` phase executes after `Physics::Update` and before systems with default priority. + * **Deprecated** + + In the Hydrodynamics system, added mass has been deprecated in favour of + the builtin sdformat `` tag that offers better stability + guarantees. ## Gazebo Sim 7.x to 8.0 * **Deprecated** From 6e00f7125c944fc82b7e5f8aa9281abf5ac35377 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Wed, 11 Sep 2024 09:03:53 -0700 Subject: [PATCH 3/8] Fixed remaining tutorials Signed-off-by: Arjo Chakravarty --- tutorials/adding_system_plugins.md | 6 -- .../theory_hydrodynamics/buoyant_cylinder.sdf | 14 +-- .../underwater_vehicles/buoyant_lrauv.sdf | 11 +-- .../underwater_vehicles/my_lrauv/model.sdf | 25 ++++++ .../migration_hydrodynamics_addedmass.md | 85 +++++++++++++++++++ tutorials/surface_vehicles.md | 3 - tutorials/theory_hydrodynamics.md | 13 +-- tutorials/underwater_vehicles.md | 6 -- 8 files changed, 123 insertions(+), 40 deletions(-) create mode 100644 tutorials/migration_hydrodynamics_addedmass.md diff --git a/tutorials/adding_system_plugins.md b/tutorials/adding_system_plugins.md index 8cfa596b63..21bef1cfba 100644 --- a/tutorials/adding_system_plugins.md +++ b/tutorials/adding_system_plugins.md @@ -103,12 +103,6 @@ Uncomment the following block from `buoyant_turtle.sdf`: filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - -0.04876161 - -1.26324739 - -1.26324739 - 0 - -0.3346 - -0.3346 -0.62282 -5 -60.127 diff --git a/tutorials/files/theory_hydrodynamics/buoyant_cylinder.sdf b/tutorials/files/theory_hydrodynamics/buoyant_cylinder.sdf index 1fac04516b..ddd7fda05e 100644 --- a/tutorials/files/theory_hydrodynamics/buoyant_cylinder.sdf +++ b/tutorials/files/theory_hydrodynamics/buoyant_cylinder.sdf @@ -291,6 +291,14 @@ 0 0.61250000000000006 + + 0.04876161 + 1.26324739 + 1.26324739 + 0 + 0.3346 + 0.3346 + @@ -329,12 +337,6 @@ filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - -0.04876161 - -1.26324739 - -1.26324739 - 0 - -0.3346 - -0.3346 -0.62282 -5 -60.127 diff --git a/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf b/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf index e9f40fcbc0..4f1e33ceb6 100644 --- a/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf +++ b/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf @@ -271,16 +271,10 @@ - - + diff --git a/tutorials/files/underwater_vehicles/my_lrauv/model.sdf b/tutorials/files/underwater_vehicles/my_lrauv/model.sdf index 55d2e36b26..c22d00494c 100644 --- a/tutorials/files/underwater_vehicles/my_lrauv/model.sdf +++ b/tutorials/files/underwater_vehicles/my_lrauv/model.sdf @@ -60,7 +60,32 @@ -0.0000000006729 0.0002633558262 + + 4.876161 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 126.324739 + 0.0 + 0.0 + 0.0 + 0.0 + 126.324739 + 0.0 + 0.0 + 0.0 + 0.1916 + 33.46 + 0.0 + 0.0 + 33.46 + 0.0 + + + diff --git a/tutorials/migration_hydrodynamics_addedmass.md b/tutorials/migration_hydrodynamics_addedmass.md new file mode 100644 index 0000000000..96a7dab323 --- /dev/null +++ b/tutorials/migration_hydrodynamics_addedmass.md @@ -0,0 +1,85 @@ +# Migrating Added Mass from the Hydrodynamics to the Fluid Added Mass tag + +Historically, we used the specify added mass in the parameters of the hydrodynamics plugin. +Starting with GazeboIonic, we have deprecated that in favour of using the SDF `` tag directly. This guarantees better numerical stability. That being said, in order to actually simulate added mass your underlying physics engine must be able to support the added mass tag. So far that only includes the DART physics engine. + +# Example migration + +Given an example plugin config: +``` + + base_link + -4.876161 + -126.324739 + -126.324739 + 0 + -33.46 + -33.46 + -6.2282 + 0 + -601.27 + 0 + -601.27 + 0 + -0.1916 + 0 + -632.698957 + 0 + -632.698957 + 0 + +``` + +In your model file under the link's inertial tag add the parameters like so: +``` + + + + + + + 147.8671 + + 3.000000 + 0 + 0 + 41.980233 + 0 + 41.980233 + + + 4.876161 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 126.324739 + 0.0 + 0.0 + 0.0 + 0.0 + 126.324739 + 0.0 + 0.0 + 0.0 + 0.1916 + 33.46 + 0.0 + 0.0 + 33.46 + 0.0 + + + ... + +``` + +Finally get rid of all the parameters with `Dot` in the plugin defintition. + + +# Parameter mappings + +The hydrodynamics plugin traditionally uses `` format. Whereas the added mass is specified in the SDFormat file as ``. So for instance `` becomes ``. diff --git a/tutorials/surface_vehicles.md b/tutorials/surface_vehicles.md index a89186a502..0a4ab4d140 100644 --- a/tutorials/surface_vehicles.md +++ b/tutorials/surface_vehicles.md @@ -235,9 +235,6 @@ hydrodynamics. filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - 0.0 - 0.0 - 0.0 -51.3 -72.4 -40.0 diff --git a/tutorials/theory_hydrodynamics.md b/tutorials/theory_hydrodynamics.md index d2e3deb47d..9885a52f5a 100644 --- a/tutorials/theory_hydrodynamics.md +++ b/tutorials/theory_hydrodynamics.md @@ -50,12 +50,6 @@ The next table summarizes all the available SDF parameters. Parameter | Description ------------------| ------------- - | Added mass in surge - | Added mass in sway - | Added mass in heave - | Added mass in roll - | Added mass in pitch - | Added mass in yaw | Quadratic drag in surge | Linear drag in surge | Quadratic drag in sway @@ -70,10 +64,9 @@ Parameter | Description | Linear drag in yaw | Default ocean current vector -**Note about added mass**: SDFormat also supports added mass natively. Until we -deprecate the added mass parameters of this plugin, do not set the added mass -parameters in both places, choose one (either in this plugin or under -`` of your link). + +For added mass we recommend setting the added mass directly on the +link via SDF. This can be done via the sdformat [`fluid_added_mass`](http://sdformat.org/spec?ver=1.11&elem=link#inertial_fluid_added_mass) tag. # A simple example diff --git a/tutorials/underwater_vehicles.md b/tutorials/underwater_vehicles.md index 1efcd90aef..e486ae2b2c 100644 --- a/tutorials/underwater_vehicles.md +++ b/tutorials/underwater_vehicles.md @@ -203,12 +203,6 @@ Uncomment the following block from `buoyant_lrauv.sdf` to enable hydrodynamics. filename="gz-sim-hydrodynamics-system" name="gz::sim::systems::Hydrodynamics"> base_link - -4.876161 - -126.324739 - -126.324739 - 0 - -33.46 - -33.46 -6.2282 0 -601.27 From 0998be2685c1a08ec11c9629a1e88d245649e18c Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Fri, 13 Sep 2024 09:31:45 -0700 Subject: [PATCH 4/8] Revert DVL tests I'm reverting DVL tests as they never considered added mass. Adding added mass changes the expected velocities. Signed-off-by: Arjo Chakravarty --- test/worlds/bottomless_pit.sdf | 2 +- test/worlds/flat_seabed.sdf | 2 +- test/worlds/underwater_currents.sdf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/worlds/bottomless_pit.sdf b/test/worlds/bottomless_pit.sdf index 1a8fde7162..e08820eb3a 100644 --- a/test/worlds/bottomless_pit.sdf +++ b/test/worlds/bottomless_pit.sdf @@ -69,7 +69,7 @@ 0 0 -80 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV 0 0 -80 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV 0 0 -0.5 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV Date: Fri, 20 Sep 2024 10:09:46 +0800 Subject: [PATCH 5/8] Move model to Open Robotics ownership Signed-off-by: Arjo Chakravarty --- examples/worlds/acoustic_comms_demo.sdf | 6 +++--- examples/worlds/auv_controls.sdf | 2 +- examples/worlds/dvl_world.sdf | 2 +- examples/worlds/lrauv_control_demo.sdf | 2 +- examples/worlds/multi_lrauv_race.sdf | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/worlds/acoustic_comms_demo.sdf b/examples/worlds/acoustic_comms_demo.sdf index d14a61e818..9db0b7460e 100644 --- a/examples/worlds/acoustic_comms_demo.sdf +++ b/examples/worlds/acoustic_comms_demo.sdf @@ -71,7 +71,7 @@ 0 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic 15 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic triton @@ -262,7 +262,7 @@ -15 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic daphne diff --git a/examples/worlds/auv_controls.sdf b/examples/worlds/auv_controls.sdf index fec1dfa9b4..45f39d8958 100644 --- a/examples/worlds/auv_controls.sdf +++ b/examples/worlds/auv_controls.sdf @@ -71,7 +71,7 @@ 0 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic 0 0 -80 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic U 0 0 1 0 0 0 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic 0 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic 5 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic triton @@ -233,7 +233,7 @@ -5 0 1 0 0 1.57 - https://fuel.gazebosim.org/1.0/arjo129/models/LRAUV-PostIonic + https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic daphne From 75949607325b0c022d7f092225be57b01f008bf7 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Fri, 11 Oct 2024 07:47:16 +0800 Subject: [PATCH 6/8] Style Signed-off-by: Arjo Chakravarty --- include/gz/sim/components/Model.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gz/sim/components/Model.hh b/include/gz/sim/components/Model.hh index decd6776ed..d7d2663852 100644 --- a/include/gz/sim/components/Model.hh +++ b/include/gz/sim/components/Model.hh @@ -71,13 +71,13 @@ namespace serializers << std::endl; warned = true; } - skip = true; + return _out; } } _out << "" << "" - << (skip ? std::string() : modelElem->ToString("")) + << modelElem->ToString("") << ""; return _out; } From 6a235ee810b5e6f857309caf8a0e7af2f3ae23dc Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 29 Oct 2024 09:51:05 +0800 Subject: [PATCH 7/8] Address PR errors Signed-off-by: Arjo Chakravarty --- tutorials/files/underwater_vehicles/buoyant_lrauv.sdf | 4 ++-- tutorials/migration_hydrodynamics_addedmass.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf b/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf index 4f1e33ceb6..07d4ff23d3 100644 --- a/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf +++ b/tutorials/files/underwater_vehicles/buoyant_lrauv.sdf @@ -271,7 +271,7 @@ - base_link @@ -287,7 +287,7 @@ 0 -632.698957 0 - + --> diff --git a/tutorials/migration_hydrodynamics_addedmass.md b/tutorials/migration_hydrodynamics_addedmass.md index 96a7dab323..889c553c4b 100644 --- a/tutorials/migration_hydrodynamics_addedmass.md +++ b/tutorials/migration_hydrodynamics_addedmass.md @@ -1,7 +1,7 @@ # Migrating Added Mass from the Hydrodynamics to the Fluid Added Mass tag Historically, we used the specify added mass in the parameters of the hydrodynamics plugin. -Starting with GazeboIonic, we have deprecated that in favour of using the SDF `` tag directly. This guarantees better numerical stability. That being said, in order to actually simulate added mass your underlying physics engine must be able to support the added mass tag. So far that only includes the DART physics engine. +Starting with Gazebo Ionic, we have deprecated that in favour of using the SDF `` tag directly. This guarantees better numerical stability. That being said, in order to actually simulate added mass your underlying physics engine must be able to support the added mass tag. So far that only includes the DART physics engine. # Example migration From 678a7527d23edb40b7a04c0515b7f401e9a08319 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 29 Oct 2024 09:53:59 +0800 Subject: [PATCH 8/8] Remove strayt character Signed-off-by: Arjo Chakravarty --- examples/worlds/dvl_world.sdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/worlds/dvl_world.sdf b/examples/worlds/dvl_world.sdf index 3cca9e4f4c..5369129c01 100644 --- a/examples/worlds/dvl_world.sdf +++ b/examples/worlds/dvl_world.sdf @@ -138,7 +138,7 @@ 0 0 -80 0 0 1.57 https://fuel.gazebosim.org/1.0/OpenRobotics/models/LRAUV Post-Ionic - U +