3 from pathlib
import Path
5 import pinocchio
as pin
9 return geom1.ngeoms == geom2.ngeoms
12 @unittest.skipUnless(pin.WITH_URDFDOM,
"Needs URDFDOM")
21 hint_list = [self.
mesh_path,
"wrong/hint"]
22 expected_mesh_path = (
23 self.
model_dir /
"romeo_description/meshes/V1/collision/LHipPitch.dae"
26 model = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
27 collision_model = pin.buildGeomFromUrdf(
28 model, self.
model_path, pin.GeometryType.COLLISION, hint_list
31 col = collision_model.geometryObjects[1]
33 os.path.normpath(col.meshPath), os.path.normpath(expected_mesh_path)
39 model = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
40 collision_model_ref = pin.buildGeomFromUrdf(
41 model, self.
model_path, pin.GeometryType.COLLISION, hint_list
44 collision_model_self = pin.GeometryModel()
45 pin.buildGeomFromUrdf(
48 pin.GeometryType.COLLISION,
52 self.assertTrue(
checkGeom(collision_model_ref, collision_model_self))
54 collision_model_self = pin.GeometryModel()
55 pin.buildGeomFromUrdf(
58 pin.GeometryType.COLLISION,
62 self.assertTrue(
checkGeom(collision_model_ref, collision_model_self))
66 collision_model_self = pin.GeometryModel()
67 pin.buildGeomFromUrdf(
70 pin.GeometryType.COLLISION,
74 self.assertTrue(
checkGeom(collision_model_ref, collision_model_self))
77 hint_list = [self.
mesh_path,
"wrong/hint"]
78 expected_collision_path = (
79 self.
model_dir /
"romeo_description/meshes/V1/collision/LHipPitch.dae"
81 expected_visual_path = (
82 self.
model_dir /
"romeo_description/meshes/V1/visual/LHipPitch.dae"
85 model = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
87 collision_model = pin.buildGeomFromUrdf(
88 model, self.
model_path, pin.GeometryType.COLLISION, hint_list
90 col = collision_model.geometryObjects[1]
92 os.path.normpath(col.meshPath), os.path.normpath(expected_collision_path)
95 visual_model = pin.buildGeomFromUrdf(
96 model, self.
model_path, pin.GeometryType.VISUAL, hint_list
98 vis = visual_model.geometryObjects[1]
100 os.path.normpath(vis.meshPath), os.path.normpath(expected_visual_path)
103 model_2, collision_model_2, visual_model_2 = pin.buildModelsFromUrdf(
104 self.
model_path, hint_list, pin.JointModelFreeFlyer()
107 self.assertEqual(model, model_2)
109 col_2 = collision_model_2.geometryObjects[1]
111 os.path.normpath(col_2.meshPath), os.path.normpath(expected_collision_path)
114 vis_2 = visual_model_2.geometryObjects[1]
116 os.path.normpath(vis_2.meshPath), os.path.normpath(expected_visual_path)
119 model_c, collision_model_c = pin.buildModelsFromUrdf(
122 pin.JointModelFreeFlyer(),
123 geometry_types=pin.GeometryType.COLLISION,
126 self.assertEqual(model, model_c)
128 col_c = collision_model_c.geometryObjects[1]
130 os.path.normpath(col_c.meshPath), os.path.normpath(expected_collision_path)
133 model_v, visual_model_v = pin.buildModelsFromUrdf(
136 pin.JointModelFreeFlyer(),
137 geometry_types=pin.GeometryType.VISUAL,
140 self.assertEqual(model, model_v)
142 vis_v = visual_model_v.geometryObjects[1]
144 os.path.normpath(vis_v.meshPath), os.path.normpath(expected_visual_path)
148 if __name__ ==
"__main__":