Skip to content

Commit

Permalink
Fix hydrodynamics deprecation warning. (#2579)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
arjo129 authored Sep 3, 2024
1 parent 5a94050 commit 7b3d182
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/systems/hydrodynamics/Hydrodynamics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>("disable_coriolis", this->dataPtr->disableCoriolis, false);
_sdf->Get<bool>("disable_added_mass", this->dataPtr->disableAddedMass, false);
if (!this->dataPtr->disableAddedMass || addedMassSpecified)
_sdf->Get<bool>("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 `<fluid_added_mass>` 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 `<fluid_added_mass>` 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"
<< "`<disable_added_mass> to true."
<< "To get rid of this warning we recommend setting "
<< "`<disable_added_mass>` to true and updating your model"
<< std::endl;
}
// Create model object, to access convenient functions
Expand Down

0 comments on commit 7b3d182

Please sign in to comment.