|
25 | 25 | #include <gz/sim/Model.hh>
|
26 | 26 | #include <gz/sim/Entity.hh>
|
27 | 27 | #include <gz/sim/EntityComponentManager.hh>
|
| 28 | +#include <gz/sim/Util.hh> |
28 | 29 |
|
29 | 30 | #include <gz/sim/components/Inertial.hh>
|
30 | 31 | #include <gz/sim/components/Model.hh>
|
@@ -121,9 +122,11 @@ TEST(MeshInertiaCalculationTest, CylinderColladaMeshInertiaCalculation)
|
121 | 122 | EXPECT_TRUE(
|
122 | 123 | link.WorldInertiaMatrix(*ecm).value().Equal(inertiaMatrix, 0.005));
|
123 | 124 |
|
124 |
| - // Check the Inertial Pose and Link Pose |
125 |
| - EXPECT_EQ(link.WorldPose(*ecm).value(), gz::math::Pose3d::Zero); |
126 |
| - EXPECT_EQ(link.WorldInertialPose(*ecm).value(), gz::math::Pose3d::Zero); |
| 125 | + // Check the Inertial Pose and Link Pose. Their world poses should be the |
| 126 | + // same since the inertial pose relative to the link is zero. |
| 127 | + EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
| 128 | + EXPECT_EQ(link.WorldInertialPose(*ecm).value(), |
| 129 | + worldPose(linkEntity, *ecm) * gz::math::Pose3d::Zero); |
127 | 130 | }
|
128 | 131 |
|
129 | 132 | TEST(MeshInertiaCalculationTest,
|
@@ -200,10 +203,10 @@ TEST(MeshInertiaCalculationTest,
|
200 | 203 | link.WorldInertiaMatrix(*ecm).value().Equal(inertiaMatrix, 0.005));
|
201 | 204 |
|
202 | 205 | // Check the Inertial Pose and Link Pose
|
203 |
| - EXPECT_EQ(link.WorldPose(*ecm).value(), gz::math::Pose3d::Zero); |
| 206 | + EXPECT_EQ(link.WorldPose(*ecm).value(), worldPose(linkEntity, *ecm)); |
204 | 207 |
|
205 | 208 | // Since the height of cylinder is 2m and origin is at center of bottom face
|
206 | 209 | // the center of mass (inertial pose) will be 1m above the ground
|
207 | 210 | EXPECT_EQ(link.WorldInertialPose(*ecm).value(),
|
208 |
| - gz::math::Pose3d(0, 0, 1, 0, 0, 0)); |
| 211 | + worldPose(linkEntity, *ecm) * gz::math::Pose3d(0, 0, 1, 0, 0, 0)); |
209 | 212 | }
|
0 commit comments