Skip to content

Commit

Permalink
Added warning for overwritting of user given inertial value sif auto …
Browse files Browse the repository at this point in the history
…is true

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
  • Loading branch information
jasmeet0915 committed Aug 17, 2023
1 parent 80e321c commit e3041e4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/Link.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,26 @@ Errors Link::Load(ElementPtr _sdf, const ParserConfig &_config)
{
sdf::ElementPtr inertialElem = _sdf->GetElement("inertial");

if (inertialElem->Get<bool>("auto"))
{
// If auto is to true but user has still provided
// inertial values
if (inertialElem->HasElement("pose") ||
inertialElem->HasElement("mass") ||
inertialElem->HasElement("inertia"))
{
Error err(
ErrorCode::WARNING,
"Inertial was used with auto=true for link, " +
this->dataPtr->name + " but user defined inertial values were found. "
"They would be overwritten by computed ones."
);
enforceConfigurablePolicyCondition(
_config.WarningsPolicy(), err, errors);
}
}
// If auto is set to false or not specified
if (!inertialElem->Get<bool>("auto"))
else
{
if (inertialElem->HasElement("pose"))
loadPose(inertialElem->GetElement("pose"), inertiaPose, inertiaFrame);
Expand Down

0 comments on commit e3041e4

Please sign in to comment.