Skip to content

Get Visual Meshes Data

SUMMARY

Get Visual Meshes Data returns all of the robot's visual mesh data as a single composed dictionary keyed by link name. Each entry packs the raw NumPy arrays - vertices, triangle indices, per-vertex normals, per-vertex RGBA colors - along with the URDF <visual><origin> offset and declared material color, so any downstream renderer can be fed straight from this one call.

The Skill

python
meshes = robot.get_visual_meshes_data()

The Code

python
"""
Read per-link visual mesh data.

Supports Universal Robots (UR), Epson, and virtual.

Usage:
    python get_visual_meshes_data.py
"""

from loguru import logger

from telekinesis.synapse.robots.manipulators import universal_robots


def main():
    """Read per-link visual mesh data and log a summary per link."""

    #===================== Create Robot ==========================================
    robot = universal_robots.UniversalRobotsUR10E(name='UR10e')

    # ==================== Run Skill ============================================
    meshes = robot.get_visual_meshes_data()
    logger.info(f"Number of links: {len(meshes)}")

    # Log a shape summary per link (vertices / triangles / colors)
    for link_name, mesh in meshes.items():
        if mesh["vertices"] is None:
            logger.warning(f"{link_name}: no visual mesh")
            continue
        n_vertices = mesh["vertices"].shape[0]
        n_triangles = mesh["triangles"].shape[0]
        has_colors = mesh["vertex_colors"] is not None
        logger.success(
            f"{link_name}: vertices={n_vertices}, triangles={n_triangles}, "
            f"vertex_colors={has_colors}, mesh_origin={mesh['mesh_origin']}"
        )


if __name__ == "__main__":
    main()

Parameter Configuration

This skill takes no input parameters.

Returns

dict[str, dict] keyed by link name. Each entry has:

KeyTypeDescription
verticesnp.ndarray(N, 3) | NoneVertex positions in the mesh frame. None when the link has no usable mesh.
trianglesnp.ndarray(M, 3) | NoneTriangle indices into vertices.
vertex_normalsnp.ndarray(N, 3) | NoneSmooth per-vertex normals.
vertex_colorsnp.ndarray(N, 4) uint8 | NonePer-vertex RGBA, baked from .dae materials when available.
mesh_origin(xyz, rpy)URDF <visual><origin> offset (zero vectors when absent).
color[r, g, b] 0-255 | NoneRGB color from the URDF <material> tag.

Result is cached on the first call. Supported mesh formats: .dae, .stl, .obj, .ply.

Raises

ExceptionCondition
RuntimeErrorurdf_path or model_dir has not been set on the robot (the derived class does not have them)
ImportErrortrimesh is not installed. Install with pip install trimesh>=4.0 pycollada>=0.7

Where to Use the Skill

  • Visualization - Feed the arrays directly to any renderer expecting per-vertex arrays. Pair with Get Visual Mesh Transforms for the world poses.
  • Digital twin - Send geometry once at startup, then stream only updated link poses.
  • URDF auditing - Programmatically verify which links ship with visual meshes and what colors are declared.

When Not to Use the Skill

  • You only need link poses - call Get Link Transforms to skip mesh loading entirely.
  • Trimesh is not installed - the first call raises ImportError. Install with pip install trimesh>=4.0 pycollada>=0.7.