From c000b3b9bd69bca53a3b6ceffee1064a5dd8e3e9 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Mon, 2 Sep 2024 15:27:04 +0800 Subject: [PATCH] Fix hydrodynamics deprecation warning. 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