Skip to content

Commit 4748d80

Browse files
committed
handle DAE files (#30)
1 parent 8d829a4 commit 4748d80

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

env.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies:
2020
- numpy
2121
- ninja # nvdiffast build
2222
- opencv-python
23+
- pycollada # used for visual meshes
2324
- pyvista
2425
- pytorch-kinematics
2526
- rich

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ requires-python = ">=3.10"
1414
dependencies = [
1515
"faiss-gpu",
1616
"huggingface_hub",
17+
"pycollada",
1718
"pytest",
1819
"pytorch-kinematics",
1920
"pyvista",

roboreg/differentiable/structs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def _populate_meshes(
7373
# load mesh
7474
m = self._load_mesh(mesh_path)
7575

76+
if isinstance(m, trimesh.Scene):
77+
m = m.dump(concatenate=True)
78+
7679
# populate mesh vertex count
7780
self._per_mesh_vertex_count[mesh_name] = len(m.vertices)
7881

test/differentiable/test_structs.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212

1313
def test_torch_mesh_container() -> None:
14+
# test load simple meshes
1415
torch_robot_mesh = TorchMeshContainer(
1516
mesh_paths={
1617
"link_0": "test/data/lbr_med7/mesh/link_0.stl",
@@ -23,6 +24,19 @@ def test_torch_mesh_container() -> None:
2324
print(torch_robot_mesh.lower_face_index_lookup)
2425
print(torch_robot_mesh.upper_face_index_lookup)
2526

27+
# test load visual meshes
28+
torch_robot_mesh = TorchMeshContainer(
29+
mesh_paths={
30+
"link_0": "test/data/lbr_med7/mesh/link_0.dae",
31+
"link_1": "test/data/lbr_med7/mesh/link_1.dae",
32+
}
33+
)
34+
print(torch_robot_mesh.per_mesh_vertex_count)
35+
print(torch_robot_mesh.lower_vertex_index_lookup)
36+
print(torch_robot_mesh.upper_vertex_index_lookup)
37+
print(torch_robot_mesh.lower_face_index_lookup)
38+
print(torch_robot_mesh.upper_face_index_lookup)
39+
2640

2741
def test_batched_camera() -> None:
2842
device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -137,6 +151,6 @@ def test_batched_virtual_camera() -> None:
137151

138152

139153
if __name__ == "__main__":
140-
# test_torch_mesh_container()
141-
test_batched_camera()
154+
test_torch_mesh_container()
155+
# test_batched_camera()
142156
# test_batched_virtual_camera()

0 commit comments

Comments
 (0)