Skip to content

Commit

Permalink
Merge pull request #965 from ignitionrobotics/merge_9_12
Browse files Browse the repository at this point in the history
Merge 9 -> 12
  • Loading branch information
scpeters authored Apr 12, 2022
2 parents a0b022d + 54310d0 commit c1afd7f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/ign.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ extern "C" SDFORMAT_VISIBLE int cmdInertialStats(
if (!errors.empty())
{
std::cerr << errors << std::endl;
return -1;
}

if (root.WorldCount() > 0)
Expand Down Expand Up @@ -348,7 +347,7 @@ extern "C" SDFORMAT_VISIBLE int cmdInertialStats(
ss << totalInertial.Moi();

std::string s;
auto maxLength = 0u;
size_t maxLength = 0u;
std::vector<std::string> moiVector;
while ( std::getline(ss, s, ' ' ) )
{
Expand All @@ -361,10 +360,10 @@ extern "C" SDFORMAT_VISIBLE int cmdInertialStats(

for (int i = 0; i < 9; i++)
{
int spacePadding = maxLength - moiVector[i].size();
size_t spacePadding = maxLength - moiVector[i].size();
// Print the matrix element
std::cout << moiVector[i];
for (int j = 0; j < spacePadding; j++)
for (size_t j = 0; j < spacePadding; j++)
{
std::cout << " ";
}
Expand Down
16 changes: 15 additions & 1 deletion src/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,21 @@ TEST(inertial_stats, IGN_UTILS_TEST_DISABLED_ON_WIN32(SDF))
}

expectedOutput =
"Error Code 18: Msg: A link named link has invalid inertia.\n\n";
"Error Code 18: Msg: A link named link has invalid inertia.\n\n"
"Inertial statistics for model: model\n"
"---\n"
"Total mass of the model: 0\n"
"---\n"
"Centre of mass in model frame: \n"
"X: 0\n"
"Y: 0\n"
"Z: 0\n"
"---\n"
"Moment of inertia matrix: \n"
"0 0 0 \n"
"0 0 0 \n"
"0 0 0 \n"
"---\n";

// Check an invalid SDF file by passing the absolute path
{
Expand Down

0 comments on commit c1afd7f

Please sign in to comment.