Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Haosulab ManiSkill Link

From Leeroopedia
Knowledge Sources
Domains Robotics, Simulation, Articulated Bodies
Last Updated 2026-02-15 08:00 GMT

Overview

Concrete tool for managing batched articulation links across parallel simulation environments.

Description

The Link dataclass wraps physx.PhysxArticulationLinkComponent objects, providing a batched interface to query poses, velocities, and collision geometry for links within articulated bodies.

Key attributes:

  • articulation -- Reference to the parent Articulation (None for merged/view links).
  • name -- The shared name of this link across sub-scenes.
  • joint -- The ArticulationJoint for which this link is the child.
  • meshes -- Dictionary mapping user-defined mesh group names (e.g., "handle") to lists of trimesh objects for each managed link.
  • merged -- Whether this link is a result of Link.merge().

Key capabilities:

  • Pose and velocity: Inherited from PhysxRigidBodyComponentStruct, provides batched pose, linear/angular velocity access.
  • Collision meshes: get_collision_meshes() returns collision geometry as trimesh objects.
  • Visual meshes: generate_mesh() creates visual meshes by combining render shape geometry with poses.
  • Bounding boxes: bbox cached property computes axis-aligned bounding boxes for all managed links.
  • Merge: Link.merge() combines multiple Link objects into a single batched struct for uniform operations.

The class factory create() constructs Link objects from raw physx link components.

Usage

Link objects are accessed through their parent Articulation's links list or links_map dictionary. They are used to query end-effector poses, compute contact forces, and access collision geometry for reward computation.

Code Reference

Source Location

Signature

@dataclass
class Link(PhysxRigidBodyComponentStruct[physx.PhysxArticulationLinkComponent]):
    articulation: Articulation = None
    name: str = None
    joint: ArticulationJoint = None
    meshes: dict[str, list[trimesh.Trimesh]] = field(default_factory=dict)
    merged: bool = False

    @classmethod
    def create(
        cls,
        physx_links: list[physx.PhysxArticulationLinkComponent],
        scene: ManiSkillScene,
        scene_idxs: torch.Tensor,
    ) -> "Link": ...

    @classmethod
    def merge(cls, links: list["Link"], name: str = None) -> "Link": ...

    def get_collision_meshes(self) -> list[trimesh.Trimesh]: ...

Import

from mani_skill.utils.structs.link import Link

I/O Contract

Inputs

Name Type Required Description
physx_links list[PhysxArticulationLinkComponent] Yes Raw physx link components
scene ManiSkillScene Yes The parent scene
scene_idxs torch.Tensor Yes Sub-scene index mapping

Outputs

Name Type Description
pose Pose Batched world-frame pose of the links
meshes dict[str, list[trimesh.Trimesh]] User-defined mesh groups

Usage Examples

Basic Usage

# Access a specific link from a robot articulation
robot = env.agent.robot
ee_link = robot.links_map["gripper_link"]

# Get the end-effector pose across all parallel envs
ee_pose = ee_link.pose  # Pose with .p (N, 3) and .q (N, 4)

# Merge multiple links for batch contact force computation
merged_links = Link.merge([link_a, link_b], name="contact_links")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment