diff --git a/python/test/pyLink_TEST.py b/python/test/pyLink_TEST.py index 154b085b9..f8b910d08 100644 --- a/python/test/pyLink_TEST.py +++ b/python/test/pyLink_TEST.py @@ -482,7 +482,7 @@ def test_resolveauto_inertialsWithMultipleCollisions(self): self.assertEqual(Vector3d(2.013513, 2.013513, 0.72603), link.inertial().mass_matrix().diagonal_moments()) - def test_inertial_values_given_with_auto_set_to_true(self): + def test_resolveauto_inertialsWithMass(self): sdf = "" + \ "" + \ " " + \ @@ -519,6 +519,47 @@ def test_inertial_values_given_with_auto_set_to_true(self): root.resolve_auto_inertials(errors, sdfParserConfig) self.assertEqual(len(errors), 0) + self.assertEqual(4.0, link.inertial().mass_matrix().mass()) + self.assertEqual(Pose3d.ZERO, link.inertial().pose()) + self.assertEqual(Vector3d(0.66666, 0.66666, 0.66666), + link.inertial().mass_matrix().diagonal_moments()) + + def test_inertial_values_given_with_auto_set_to_true(self): + sdf = "" + \ + "" + \ + " " + \ + " " + \ + " " + \ + " 1 1 1 2 2 2" + \ + " " + \ + " 1" + \ + " 1" + \ + " 1" + \ + " " + \ + " " + \ + " " + \ + " 2.0" + \ + " " + \ + " " + \ + " 1 1 1" + \ + " " + \ + " " + \ + " " + \ + " " + \ + " " + \ + " " + + root = Root() + sdfParserConfig = ParserConfig() + errors = root.load_sdf_string(sdf, sdfParserConfig) + self.assertEqual(errors, None) + + model = root.model() + link = model.link_by_index(0) + errors = [] + root.resolve_auto_inertials(errors, sdfParserConfig) + self.assertEqual(len(errors), 0) + self.assertNotEqual(4.0, link.inertial().mass_matrix().mass()) self.assertEqual(Pose3d.ZERO, link.inertial().pose()) self.assertEqual(Vector3d(0.33333, 0.33333, 0.33333),