Skip to content

Commit

Permalink
Merge pull request #2147 from stephane-caron/fix/meshcat_no_collision
Browse files Browse the repository at this point in the history
Don't iterate on collision geometries when undefined
  • Loading branch information
jorisv authored Feb 2, 2024
2 parents 654563f + 1f5755a commit d7c4b8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Fixed
- Remove a lot of warnings ([#2139](https://github.com/stack-of-tasks/pinocchio/pull/2139))
- `MeshcatVisualizer` doesn't crash anymore when there is no collision model defined ([#2147](https://github.com/stack-of-tasks/pinocchio/pull/2147))

### Added
- Add `examples/floating-base-velocity-viewer.py` to visualize floating base velocity [#2143](https://github.com/stack-of-tasks/pinocchio/pull/2143)
Expand Down
10 changes: 6 additions & 4 deletions bindings/python/pinocchio/visualize/meshcat_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,16 @@ def loadViewerModel(self, rootNodeName="pinocchio", color=None):
# Collisions
self.viewerCollisionGroupName = self.viewerRootNodeName + "/" + "collisions"

for collision in self.collision_model.geometryObjects:
self.loadViewerGeometryObject(collision, pin.GeometryType.COLLISION, color)
if self.collision_model is not None:
for collision in self.collision_model.geometryObjects:
self.loadViewerGeometryObject(collision, pin.GeometryType.COLLISION, color)
self.displayCollisions(False)

# Visuals
self.viewerVisualGroupName = self.viewerRootNodeName + "/" + "visuals"
for visual in self.visual_model.geometryObjects:
self.loadViewerGeometryObject(visual, pin.GeometryType.VISUAL, color)
if self.visual_model is not None:
for visual in self.visual_model.geometryObjects:
self.loadViewerGeometryObject(visual, pin.GeometryType.VISUAL, color)
self.displayVisuals(True)

# Frames
Expand Down

0 comments on commit d7c4b8c

Please sign in to comment.