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):
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)
obj = self.loadMesh(geometry_object)
msg = "The geometry object named " + + " is not supported by Pinocchio/MeshCat for vizualization."
warnings.warn(msg, category=UserWarning, stacklevel=2)
if obj is None:
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