Skip to content

Commit

Permalink
Modifies test for new method
Browse files Browse the repository at this point in the history
Signed-off-by: Voldivh <[email protected]>
  • Loading branch information
Voldivh committed Oct 27, 2023
1 parent 7151c65 commit 5f10700
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/test/link_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def on_pre_udpate_cb(_info, _ecm):
self.assertEqual(Vector3d(), link.world_linear_acceleration(_ecm))
self.assertEqual(Vector3d(), link.world_angular_acceleration(_ecm))
# World Inertia Matrix Test
self.assertEqual(Matrix3d(1,0,0,0,1,0,0,0,1), link.world_inertia_matrix(_ecm))
self.assertEqual(Matrix3d(1, 0, 0, 0, 1, 0, 0, 0, 1), link.world_inertia_matrix(_ecm))
# World Kinetic Energy Test
self.assertEqual(0, link.world_kinetic_energy(_ecm))
link.enable_velocity_checks(_ecm, False)
Expand Down
12 changes: 9 additions & 3 deletions test/integration/link.cc
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,19 @@ TEST_F(LinkIntegrationTest, LinkInertia)

math::MassMatrix3d linkMassMatrix(10.0, {0.4, 0.4, 0.4}, {0.02, 0.02, 0.02});
math::Pose3d linkWorldPose;
linkWorldPose.Set(0.0, 0.1, 0.2, 0.0, GZ_PI_4, GZ_PI_2);
math::Inertiald linkInertial{linkMassMatrix, linkWorldPose};
linkWorldPose.Set(1.0, 0.0, 0.0, 0, 0, GZ_PI_4);
// This is the pose of the inertia frame relative to its parent link frame
math::Pose3d inertiaPose;
inertiaPose.Set(1.0, 2.0, 3.0, 0, GZ_PI_2, 0);

math::Inertiald linkInertial{linkMassMatrix, inertiaPose};

ecm.CreateComponent(eLink, components::WorldPose(linkWorldPose));
ecm.CreateComponent(eLink, components::Inertial(linkInertial));

ASSERT_TRUE(link.WorldInertial(ecm));
EXPECT_EQ(10.0, link.WorldInertial(ecm).value().MassMatrix().Mass());
EXPECT_EQ(linkWorldPose, link.WorldInertial(ecm).value().Pose());
EXPECT_EQ(linkWorldPose * inertiaPose, link.WorldInertial(ecm).value().Pose());
}

//////////////////////////////////////////////////
Expand Down

0 comments on commit 5f10700

Please sign in to comment.