2 import pinocchio
as pin
5 @unittest.skipUnless(pin.WITH_HPP_FCL,
"Needs HPP-FCL")
9 self.
model = pin.buildSampleModelHumanoid()
13 col = self.collision_model.geometryObjects[0]
14 self.assertTrue(col.name ==
'rleg_shoulder_object')
15 col.name =
'new_collision_name' 16 self.assertTrue(col.name ==
'new_collision_name')
19 col = self.collision_model.geometryObjects[0]
20 self.assertTrue(col.parentJoint == 2)
22 self.assertTrue(col.parentJoint == 3)
25 m = pin.SE3.Identity()
26 new_m = pin.SE3.Random()
27 col = self.collision_model.geometryObjects[0]
28 self.assertTrue(np.allclose(col.placement.homogeneous,m.homogeneous))
30 self.assertTrue(np.allclose(col.placement.homogeneous , new_m.homogeneous))
33 col = self.collision_model.geometryObjects[0]
34 self.assertTrue(col.meshPath
is not None)
37 scale = np.array([1.,2.,3.])
39 for obj
in self.collision_model.geometryObjects:
40 self.assertTrue(obj.meshScale[0] == scale[0])
41 self.assertTrue(obj.meshScale[1] == scale[1])
42 self.assertTrue(obj.meshScale[2] == scale[2])
46 vec = np.array([scale]*3)
48 for obj
in self.collision_model.geometryObjects:
49 self.assertTrue(np.allclose(obj.meshScale, vec))
52 collision_data = self.collision_model.createData()
53 self.assertEqual(len(collision_data.oMg), self.collision_model.ngeoms)
56 collision_data = self.collision_model.createData()
58 self.assertEqual(len(collision_data.oMg), self.collision_model.ngeoms)
61 self.assertTrue(self.model.check(data_2))
62 self.assertEqual(len(collision_data_2.oMg), self.collision_model.ngeoms)
65 collision_model_copy = self.collision_model.copy()
66 self.assertEqual(self.collision_model.ngeoms,collision_model_copy.ngeoms)
68 collision_data = self.collision_model.createData()
69 collision_data_copy = collision_data.copy()
70 self.assertEqual(len(collision_data.oMg),len(collision_data_copy.oMg))
72 if __name__ ==
'__main__':
def test_create_data(self)
def test_parent_get_set(self)
def test_name_get_set(self)
def test_placement_get_set(self)
def test_create_datas(self)
def test_meshpath_get(self)
def test_scalar_scale(self)