Skip to content

Commit

Permalink
Update MeshBuilder test
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Jun 10, 2024
1 parent 4c6194c commit 80151c8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_meshbuilder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import tempfile

import numpy as np
import pytest
import trimesh

from rod.builder.primitives import MeshBuilder
Expand All @@ -20,11 +21,18 @@ def test_builder_creation():

builder = MeshBuilder(
name="test_mesh",
mesh_path=fp.name,
mesh_uri=fp.name,
mass=1.0,
scale=np.array([1.0, 1.0, 1.0]),
)

# Check that the builder can build a correct link.
# Note that the URI is not valid since it's a temporary file.
link = builder.build_link().add_inertial().add_visual().add_collision().build()
assert link.collision is not None
assert link.collision.geometry.mesh is not None
assert link.collision.geometry.mesh.scale == pytest.approx([1, 1, 1])

assert (
builder.mesh.vertices.shape == mesh.vertices.shape
), f"{builder.mesh.vertices.shape} != {mesh.vertices.shape}"
Expand Down Expand Up @@ -56,7 +64,7 @@ def test_builder_creation_custom_mesh():

builder = MeshBuilder(
name="test_mesh",
mesh_path=fp.name,
mesh_uri=fp.name,
mass=1.0,
scale=np.array([1.0, 1.0, 1.0]),
)
Expand Down

0 comments on commit 80151c8

Please sign in to comment.