Skip to content

Commit

Permalink
Improve mass error message
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>
  • Loading branch information
j-rivero committed Sep 26, 2022
1 parent d007f34 commit 1d755ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/parser_urdf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2626,8 +2626,9 @@ void CreateSDF(TiXmlElement *_root,
if (_link->inertial && ignition::math::equal(_link->inertial->mass, 0.0))
{
_DisplayDbgOrWarning(std::string("urdf2sdf: link[" + _link->name)
+ "] has mass equal to 0.0, ["
+ "] children links ignored.\n", _enable_new_warnings);
+ "] has a mass considered zero ["
+ std::to_string(_link->inertial->mass) +
+ "].It is ignored.\n", _enable_new_warnings);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/parser_urdf_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ TEST(URDFParser, EnableNewWarnings)
<< " </geometry>"
<< " </visual>"
<< " <inertial>"
<< " <mass value=\"0.0000001\" />"
<< " <mass value=\"0.000001\" />"
<< " <origin xyz=\"0 0 0\" />"
<< " <inertia ixx=\"0.001\" ixy=\"0.0\" ixz=\"0.0\""
<< " iyy=\"0.001\" iyz=\"0.0\""
Expand All @@ -400,7 +400,7 @@ TEST(URDFParser, EnableNewWarnings)
ASSERT_NO_THROW(parser_.InitModelDoc(&doc));
// Check warning message
EXPECT_NE(
std::string::npos, buffer.str().find("] has mass equal to 0.0"))
std::string::npos, buffer.str().find("] has a mass considered zero ["))
<< buffer.str();
}
}
Expand Down

0 comments on commit 1d755ae

Please sign in to comment.