2 import pinocchio
as pin
6 return geom1.ngeoms == geom2.ngeoms
8 @unittest.skipUnless(pin.WITH_URDFDOM,
"Needs URDFDOM")
12 self.
current_file = os.path.dirname(str(os.path.abspath(__file__)))
18 hint_list = [self.
mesh_path,
"wrong/hint"]
19 expected_mesh_path = os.path.join(self.
model_dir,
'romeo_description/meshes/V1/collision/LHipPitch.dae')
21 model = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
22 collision_model = pin.buildGeomFromUrdf(model, self.
model_path, pin.GeometryType.COLLISION, hint_list)
24 col = collision_model.geometryObjects[1]
25 self.assertEqual(os.path.normpath(col.meshPath), os.path.normpath(expected_mesh_path))
30 model = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
31 collision_model_ref = pin.buildGeomFromUrdf(model, self.
model_path, pin.GeometryType.COLLISION, hint_list)
33 collision_model_self = pin.GeometryModel()
34 pin.buildGeomFromUrdf(model, self.
model_path, pin.GeometryType.COLLISION, collision_model_self, hint_list)
35 self.assertTrue(
checkGeom(collision_model_ref, collision_model_self))
37 collision_model_self = pin.GeometryModel()
38 pin.buildGeomFromUrdf(model, self.
model_path, pin.GeometryType.COLLISION, collision_model_self, self.
mesh_path)
39 self.assertTrue(
checkGeom(collision_model_ref, collision_model_self))
41 hint_vec = pin.StdVec_StdString()
44 collision_model_self = pin.GeometryModel()
45 pin.buildGeomFromUrdf(model, self.
model_path, pin.GeometryType.COLLISION, collision_model_self, hint_vec)
46 self.assertTrue(
checkGeom(collision_model_ref, collision_model_self))
50 hint_list = [self.
mesh_path,
"wrong/hint"]
51 expected_collision_path = os.path.join(self.
model_dir,
'romeo_description/meshes/V1/collision/LHipPitch.dae')
52 expected_visual_path = os.path.join(self.
model_dir,
'romeo_description/meshes/V1/visual/LHipPitch.dae')
54 model = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
56 collision_model = pin.buildGeomFromUrdf(model, self.
model_path, pin.GeometryType.COLLISION, hint_list)
57 col = collision_model.geometryObjects[1]
58 self.assertEqual(os.path.normpath(col.meshPath), os.path.normpath(expected_collision_path))
60 visual_model = pin.buildGeomFromUrdf(model, self.
model_path, pin.GeometryType.VISUAL, hint_list)
61 vis = visual_model.geometryObjects[1]
62 self.assertEqual(os.path.normpath(vis.meshPath), os.path.normpath(expected_visual_path))
64 model_2, collision_model_2, visual_model_2 = pin.buildModelsFromUrdf(self.
model_path, hint_list, pin.JointModelFreeFlyer())
66 self.assertEqual(model,model_2)
68 col_2 = collision_model_2.geometryObjects[1]
69 self.assertEqual(os.path.normpath(col_2.meshPath), os.path.normpath(expected_collision_path))
71 vis_2 = visual_model_2.geometryObjects[1]
72 self.assertEqual(os.path.normpath(vis_2.meshPath), os.path.normpath(expected_visual_path))
74 model_c, collision_model_c = pin.buildModelsFromUrdf(self.
model_path, hint_list, pin.JointModelFreeFlyer(), geometry_types=pin.GeometryType.COLLISION)
76 self.assertEqual(model,model_c)
78 col_c = collision_model_c.geometryObjects[1]
79 self.assertEqual(os.path.normpath(col_c.meshPath), os.path.normpath(expected_collision_path))
81 model_v, visual_model_v = pin.buildModelsFromUrdf(self.
model_path, hint_list, pin.JointModelFreeFlyer(), geometry_types=pin.GeometryType.VISUAL)
83 self.assertEqual(model,model_v)
85 vis_v = visual_model_v.geometryObjects[1]
86 self.assertEqual(os.path.normpath(vis_v.meshPath), os.path.normpath(expected_visual_path))
89 model = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
91 hint_list = [self.
mesh_path,
"wrong/hint"]
92 pin.buildGeomFromUrdf(model, self.
model_path, hint_list, pin.GeometryType.COLLISION)
94 hint_vec = pin.StdVec_StdString()
96 pin.buildGeomFromUrdf(model, self.
model_path, hint_vec, pin.GeometryType.COLLISION)
100 if pin.WITH_HPP_FCL_BINDINGS:
101 pin.buildGeomFromUrdf(model, self.
model_path, hint_list, pin.GeometryType.COLLISION, pin.hppfcl.MeshLoader())
102 pin.buildGeomFromUrdf(model, self.
model_path, hint_vec, pin.GeometryType.COLLISION, pin.hppfcl.MeshLoader())
103 pin.buildGeomFromUrdf(model, self.
model_path, self.
mesh_path, pin.GeometryType.COLLISION, pin.hppfcl.MeshLoader())
105 if __name__ ==
'__main__':
def test_deprecated_signatures(self)
def test_multi_load(self)
def checkGeom(geom1, geom2)