Implementation:Haosulab ManiSkill URDFLoader
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Model Loading |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete tool for loading URDF (Unified Robot Description Format) files into ManiSkill with support for parallel environment building.
Description
The urdf_loader.py module provides the public URDFLoader class, which extends SAPIEN's URDFLoader with ManiSkill-specific parallelization, naming, and camera extraction support.
URDFLoader extends SapienURDFLoader with:
scene-- ManiSkillScene reference for parallel building.name-- Base name for loaded articulations and actors.disable_self_collisions-- Flag to disable self-collision between links.
parse() method:
- Calls the parent URDF parser to get articulation/actor builders and cameras.
- Assigns names based on the loader's
nameattribute. - Optionally disables self-collisions via collision group bit manipulation.
- Returns a
ParsedURDFDataTypedDict.
load() method:
- Parses the URDF, validates that only one articulation exists (throws exception for multi-object URDFs), builds across specified sub-scenes, and returns a single
Articulation. - Handles camera definitions embedded in the URDF by creating
RenderCameraComponentinstances and mounting them on the appropriate entities.
load_file_as_articulation_builder() -- Returns the raw ArticulationBuilder without building.
Usage
Primary interface for loading URDF robot models into ManiSkill environments. Used by robot agent classes during environment initialization.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/utils/building/urdf_loader.py
Signature
class ParsedURDFData(TypedDict):
articulation_builders: list[ArticulationBuilder]
actor_builders: list[ActorBuilder]
cameras: list[Any]
class URDFLoader(SapienURDFLoader):
scene: ManiSkillScene
name: str = None
disable_self_collisions: bool = False
def parse(self, urdf_file, srdf_file=None, package_dir=None) -> ParsedURDFData: ...
def load(self, urdf_file, srdf_file=None, package_dir=None, name=None, scene_idxs=None) -> Articulation: ...
def load_file_as_articulation_builder(self, urdf_file, srdf_file=None, package_dir=None) -> ArticulationBuilder: ...
Import
from mani_skill.utils.building.urdf_loader import URDFLoader
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| urdf_file | str | Yes | Path to the URDF file |
| srdf_file | str | No | SRDF file (defaults to .srdf alongside URDF) |
| package_dir | str | No | Base directory for resolving "package://" paths |
| name | str | No | Name for the loaded articulation |
| scene_idxs | list[int] | No | Sub-scene indices to build in |
Outputs
| Name | Type | Description |
|---|---|---|
| Articulation | Articulation | The loaded articulation |
Usage Examples
Basic Usage
from mani_skill.utils.building.urdf_loader import URDFLoader
loader = URDFLoader()
loader.scene = env.scene
loader.name = "panda"
articulation = loader.load(
"franka_description/panda.urdf",
package_dir="franka_description/"
)