Skip to content

Get Collision Model

SUMMARY

Get Collision Model returns the pinocchio.GeometryModel populated from the URDF's <collision> tags - simplified primitives (boxes, cylinders, capsules, decimated meshes) optimized for fast queries with hpp-fcl. Use it for self-collision checks, environment-collision checks, or to feed a custom motion planner that consumes Pinocchio geometry.

SUPPORTED ROBOTS

Available on all supported manipulators.

The Skill

python
collision_model = robot.get_collision_model()

The Code

python
"""
Read the Pinocchio collision geometry model for the Synapse SDK.

``get_collision_model`` returns the Python Pinocchio ``GeometryModel``
populated with the robot's collision geometries from the URDF. 

Universal Robots (UR10e) is used here purely for illustration. It supports all robots.

Usage:
    python get_collision_model.py
"""

from loguru import logger

from telekinesis.synapse.robots.manipulators import universal_robots


def main():
    """Read the Pinocchio collision geometry model and log a summary."""

    # Create the robot (no connect required — runs on the kinematic model)
    robot = universal_robots.UniversalRobotsUR10E()

    # Read the Pinocchio collision GeometryModel
    collision_model = robot.get_collision_model()
    
    logger.info(f"Number of collision geometries: {len(collision_model.geometryObjects)}")
    logger.info(f"Number of collision pairs: {len(collision_model.collisionPairs)}")


if __name__ == "__main__":
    main()

The Explanation of the Code

python
from telekinesis.synapse.robots.manipulators import universal_robots

robot = universal_robots.UniversalRobotsUR10E()

Create the robot. UR10e is used here for illustration; the same pattern works for every supported brand. No connect() is required - runs against the kinematic model.

python
collision_model = robot.get_collision_model()

Return the pinocchio.GeometryModel built from the URDF's <collision> tags. The model is built lazily on first access and cached on the robot, so subsequent calls return the same instance.

python
logger.info(f"Number of collision geometries: {len(collision_model.geometryObjects)}")
logger.info(f"Number of collision pairs: {len(collision_model.collisionPairs)}")

Inspect the model directly via Pinocchio: geometryObjects lists each collision primitive, and collisionPairs lists the pairs that will be tested by pin.computeCollisions.

Return Value

TypeDescription
pinocchio.GeometryModelCollision GeometryModel built from the URDF's <collision> declarations. Built lazily on first access and cached on the robot.

Where to Use the Skill

  • Self-collision checks - Add collision pairs and run pin.computeCollisions to validate candidate joint configurations.
  • Environment-collision checks - Attach static obstacles to the collision model for whole-scene checks.
  • Motion planning - Feed the collision model into a Pinocchio-aware planner.
  • Companion to Get Model and Get Visual Model when a library expects the full (model, collision_model, visual_model) triple.

When Not to Use the Skill