Verified Commit 24dbede8 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

python/meshcat: fix loading of BVH model

BVH models should be loaded in a raw manner after checking if they are not related to a specific file
parent 6f977ef6
Pipeline #15217 failed with stage
in 144 minutes and 2 seconds
......@@ -134,6 +134,17 @@ class MeshcatVisualizer(BaseVisualizer):
return obj
def isMesh(self, geometry_object):
""" Check whether the geometry object contains a Mesh supported by MeshCat """
if geometry_object.meshPath == "":
return False
_, file_extension = os.path.splitext(geometry_object.meshPath)
if file_extension.lower() in [".dae", ".obj", ".stl"]:
return True
return False
def loadMesh(self, geometry_object):
import meshcat.geometry
......@@ -168,10 +179,14 @@ class MeshcatVisualizer(BaseVisualizer):
try:
if WITH_HPP_FCL_BINDINGS and isinstance(geometry_object.geometry, hppfcl.ShapeBase):
obj = self.loadPrimitive(geometry_object)
elif self.isMesh(geometry_object):
obj = self.loadMesh(geometry_object)
elif WITH_HPP_FCL_BINDINGS and isinstance(geometry_object.geometry, hppfcl.BVHModelBase):
obj = loadBVH(geometry_object.geometry)
else:
obj = self.loadMesh(geometry_object)
msg = "The geometry object named " + geometry_object.name + " is not supported by Pinocchio/MeshCat for vizualization."
warnings.warn(msg, category=UserWarning, stacklevel=2)
return
if obj is None:
return
except Exception as e:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment