[isaacsim.asset.importer.mjcf] MJCF Importer#

Version: 3.2.0

Core MJCF importer functionality - converts MuJoCo’s MJCF (MuJoCo XML Format) robot description files into Omniverse USD scenes. UI provided by isaacsim.asset.importer.mjcf.ui.

Preview

Enable Extension#

The extension can be enabled (if not already) in one of the following ways:

Define the next entry as an application argument from a terminal.

APP_SCRIPT.(sh|bat) --enable isaacsim.asset.importer.mjcf

Define the next entry under [dependencies] in an experience (.kit) file or an extension configuration (extension.toml) file.

[dependencies]
"isaacsim.asset.importer.mjcf" = {}

Open the Window > Extensions menu in a running application instance and search for isaacsim.asset.importer.mjcf. Then, toggle the enable control button if it is not already active.

MJCF Importer Extension [isaacsim.asset.importer.mjcf]#

MJCF Import Workflow#

Use the MJCF importer configuration and converter classes to import MJCF files into USD. Below is a sample demonstrating how to import the Ant MJCF included with this extension.

 1import omni.usd
 2from isaacsim.asset.importer.mjcf import MJCFImporter, MJCFImporterConfig
 3from isaacsim.asset.importer.utils import stage_utils
 4
 5# Get path to extension data:
 6ext_manager = omni.kit.app.get_app().get_extension_manager()
 7ext_id = ext_manager.get_enabled_extension_id("isaacsim.asset.importer.mjcf")
 8extension_path = ext_manager.get_extension_path(ext_id)
 9
10# setting up import configuration:
11config = MJCFImporterConfig(mjcf_path=extension_path + "/data/mjcf/nv_ant.xml")
12
13# import MJCF
14importer = MJCFImporter(config)
15output_path = importer.import_mjcf()
16
17# open the resulting USD for inspection
18stage = stage_utils.open_stage(output_path)
class MJCFImporter(
config: MJCFImporterConfig | None = None,
)#

MuJoCo MJCF to USD importer.

Uses mujoco-usd-converter to convert MJCF files to USD format.

Parameters:

config – Optional configuration for the import operation.

Example:

>>> from isaacsim.asset.importer.mjcf import MJCFImporter
>>> MJCFImporter()
<...>
import_mjcf(
config: MJCFImporterConfig | None = None,
) str#

Import an MJCF file and convert it to USD.

Parameters:

config – Optional configuration for the import operation. If not provided, the stored importer configuration will be used.

Returns:

Path to the generated USD file.

Raises:
  • ValueError – If the MJCF path is not configured.

  • FileNotFoundError – If the MJCF file does not exist at the given path.

Example:

>>> from isaacsim.asset.importer.mjcf import MJCFImporter, MJCFImporterConfig

>>> importer = MJCFImporter()
>>> config = MJCFImporterConfig(mjcf_path="/tmp/robot.xml")
>>> importer.config = config
>>> # output_path = importer.import_mjcf()
property config: MJCFImporterConfig#

Get the importer configuration.

Returns:

Current importer configuration.

Example:

>>> from isaacsim.asset.importer.mjcf import MJCFImporter, MJCFImporterConfig

>>> importer = MJCFImporter()
>>> importer.config  
MJCFImporterConfig(...)
class MJCFImporterConfig(
mjcf_path: str | None = None,
usd_path: str | None = None,
import_scene: bool = True,
merge_mesh: bool = False,
debug_mode: bool = False,
collision_from_visuals: bool = False,
collision_type: str = 'Convex Hull',
allow_self_collision: bool = False,
)#

Configuration for MJCF import operations.

Stores settings that control how MJCF files are converted to USD.

Parameters:
  • mjcf_path – Path to the MJCF (.xml) file to import.

  • usd_path – Directory path where the USD file will be saved.

  • import_scene – If True, imports the MJCF simulation settings along with the model.

  • merge_mesh – If True, merges meshes where possible to optimize the model.

  • debug_mode – If True, enables debug mode with additional logging and visualization.

  • collision_from_visuals – If True, collision geometry is generated from visual geometries.

  • collision_type – Type of collision geometry to use. Options: “Convex Hull”, “Convex Decomposition”, “Bounding Sphere”, “Bounding Cube”.

  • allow_self_collision – If True, allows the model to collide with itself.

Example:

>>> from isaacsim.asset.importer.mjcf import MJCFImporterConfig

>>> config = MJCFImporterConfig(
...     mjcf_path="/tmp/robot.xml",
...     usd_path="/tmp/output",
...     merge_mesh=True
... )
>>> config.mjcf_path
'/tmp/robot.xml'
allow_self_collision: bool = False#
collision_from_visuals: bool = False#
collision_type: str = 'Convex Hull'#
debug_mode: bool = False#
import_scene: bool = True#
merge_mesh: bool = False#
mjcf_path: str | None = None#
usd_path: str | None = None#