From 7b3d182dc9ee60b73de733b202ba0f82e8a189ef Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 3 Sep 2024 09:14:03 +0800 Subject: [PATCH] Fix hydrodynamics deprecation warning. (#2579) The warning message in the hydrodynamics added mass section is broken. Firstly, we probably should check for if any value was set on the added mass. Secondly, the message was mangled. Finally we downgraded the error to a warning as the error leads to users getting confused. Signed-off-by: Arjo Chakravarty --- src/systems/hydrodynamics/Hydrodynamics.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/systems/hydrodynamics/Hydrodynamics.cc b/src/systems/hydrodynamics/Hydrodynamics.cc index c3cd80e9c1..eed111deff 100644 --- a/src/systems/hydrodynamics/Hydrodynamics.cc +++ b/src/systems/hydrodynamics/Hydrodynamics.cc @@ -355,21 +355,22 @@ void Hydrodynamics::Configure( prefix += snameConventionVel[j]; this->dataPtr->Ma(i, j) = SdfParamDouble(_sdf, prefix, 0); addedMassSpecified = (std::abs(this->dataPtr->Ma(i, j)) > 1e-6) - && addedMassSpecified; + || addedMassSpecified; } } _sdf->Get("disable_coriolis", this->dataPtr->disableCoriolis, false); - _sdf->Get("disable_added_mass", this->dataPtr->disableAddedMass, false); - if (!this->dataPtr->disableAddedMass || addedMassSpecified) + _sdf->Get("disable_added_mass", + this->dataPtr->disableAddedMass, false); + if (!this->dataPtr->disableAddedMass && addedMassSpecified) { - gzerr << "The use of added mass through this plugin is deprecated and will" - << "be removed in Gazebo J* as this formulation has instabilities." - << " We recommend using the SDF `` tag based method" + gzwarn << "The use of added mass through this plugin is deprecated and " + << "will be removed in Gazebo J* as this formulation has instabilities. " + << "We recommend using the SDF `` tag based method " << "[http://sdformat.org/spec?ver=1.11&elem=link" << "#inertial_fluid_added_mass]" - << "To get rid of this warning we recommend setting" - << "` to true." + << "To get rid of this warning we recommend setting " + << "`` to true and updating your model" << std::endl; } // Create model object, to access convenient functions