Skip to content

Commit

Permalink
Cone: set inertial center of mass Z = -L/4
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored and bperseghetti committed May 23, 2024
1 parent ec0f10f commit 8f77c6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Cone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ std::optional<gz::math::Inertiald> Cone::CalculateInertial(double _density)
{
gz::math::Inertiald coneInertial;
coneInertial.SetMassMatrix(coneMassMatrix.value());
coneInertial.SetPose({0, 0, -0.25 * this->dataPtr->cone.Length(), 0, 0, 0});
return std::make_optional(coneInertial);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cone_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ TEST(DOMCone, CalculateInertial)

gz::math::Inertiald expectedInertial;
expectedInertial.SetMassMatrix(expectedMassMat);
expectedInertial.SetPose(gz::math::Pose3d::Zero);
expectedInertial.SetPose({0, 0, -l / 4.0, 0, 0, 0});

auto coneInertial = cone.CalculateInertial(density);
EXPECT_EQ(cone.Shape().Mat().Density(), density);
Expand Down

0 comments on commit 8f77c6a

Please sign in to comment.