Skip to content

[Bug]: collisionPairMapping of a GeometryModel is not updated when removeGeometryObject is called #2846

@joao-pm-santos96

Description

@joao-pm-santos96

🐞 Bug

Hello all,

I've stumbled upon a unexpected situation. When I remove a geometry object of a GeometryModel using removeGeometryObject, the shape (and values) of the GeometryModel collisionPairMapping is not updated. ALso, there is no way I can recompute/reset it.

Is there anything I am missing?

Reproduction steps

import pinocchio as pin

model = pin.buildSampleModelManipulator()
geometry_model = pin.buildSampleGeometryModelManipulator(model)
geometry_model.addAllCollisionPairs()

print(f"Original ngeoms: {geometry_model.ngeoms}")
print(f"Original #collision_pairs: {len(geometry_model.collisionPairs)}")
print(
    f"Original shape of collisionPairMapping: {geometry_model.collisionPairMapping.shape}"
)


geometry_model.removeGeometryObject(geometry_model.geometryObjects[-1].name)

print(" ")
print(f"Modified ngeoms: {geometry_model.ngeoms}")
print(f"Modified #collision_pairs: {len(geometry_model.collisionPairs)}")
print(
    f"Modified shape of collisionPairMapping: {geometry_model.collisionPairMapping.shape}"
)

Relevant log output / Error message

Original ngeoms: 6
Original #collision_pairs: 14
Original shape of collisionPairMapping: (6, 6)

Modified ngeoms: 5
Modified #collision_pairs: 9
Modified shape of collisionPairMapping: (6, 6)

System Info

OS: Ubuntu 24.04
Package Manager: Pixi
Pinocchio version: 3.9.0

Checklist

  • I have checked that all my packages are installed from the same package manager (conda-forge, Nix, PyPI, robotpkg, ROS, ...)
  • I have checked that there is no similar issue/discussion in the repo
  • I have provided a minimal and working example to reproduce the bug
  • I have used Markdown code blocks for both code and stack traces/compiler errors.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions