Skip to main content

A parser that converts between different scene descriptions

Project description

Multiverse Parser

Python Tests with Coverage (Ubuntu 22.04) Python Tests with Coverage  (Ubuntu 24.04) Python Tests with Coverage (Windows) codecov

The Multiverse Parser module provides seamless conversion between different scene description formats, using USD (Universal Scene Description) as a universal translation layer.


📋 Prerequisites

  • Python ≥ 3.10 (Linux), 3.12 (Windows)
  • Python packages listed in requirements.txt

Install the required packages:

pip install -r requirements.txt

⚙️ Setup

First, clone the repository:

git clone https://github.com/Multiverse-Framework/Multiverse-Parser.git --depth 1

Then, run the setup script to automatically download and link Blender:

Linux:

./Multiverse-Parser/setup.sh

Windows:

.\Multiverse-Parser\setup.bat

✨ Optional: Rebuild USD

To upgrade or rebuild USD:

  1. Install the additional Python dependencies:

    pip install pyside6 pyopengl jinja2
    
  2. Run the setup script with the --usd flag:

    Linux:

    ./Multiverse-Parser/setup.sh --usd
    

    Windows:

    .\Multiverse-Parser\setup.bat --usd
    

🚀 Usage

To view all available options:

Linux:

./Multiverse-Parser/scripts/multiverse_parser --help

Windows:

.\Multiverse-Parser\scripts\multiverse_parser.cmd --help

Example output:

usage: multiverse_parser [-h] --input INPUT --output OUTPUT [--fixed_base] [--root_name ROOT_NAME] [--add_xform_for_each_geom] [--relative_to_ros_package RELATIVE_TO_ROS_PACKAGE] [--no-physics] [--no-visual]
                         [--no-collision] [--keepusd] [--inertiasource INERTIASOURCE] [--defaultrgba DEFAULTRGBA [DEFAULTRGBA ...]]

Multiverse parser

options:
  -h, --help            show this help message and exit
  --input INPUT         Import scene description as (URDF, MJCF, WORLD or USD)
  --output OUTPUT       Export scene description as (URDF, MJCF, WORLD or USD)
  --fixed_base          Set the base link as fixed
  --root_name ROOT_NAME
                        The name of the root body
  --add_xform_for_each_geom
                        Add additional parent xform for each geom (only for input USD)
  --relative_to_ros_package RELATIVE_TO_ROS_PACKAGE
                        The path to the ROS package that contains the URDF file (only for output URDF)
  --no-physics          Exclude the physics properties
  --no-visual           Exclude the visual meshes
  --no-collision        Exclude the collision meshes
  --keepusd             Keep the temporary USD file after exporting
  --inertiasource INERTIASOURCE
                        Where to get the inertia from (from_src, from_visual_mesh or from_collision_mesh)
  --defaultrgba DEFAULTRGBA [DEFAULTRGBA ...]
                        The default color of the meshes

🐍 For Python Users

If you want to use multiverse_parser programmatically in Python, you can install it as a local Python package using a symbolic link (editable mode):

pip install -e .

This allows you to make changes to the source code and immediately reflect them without reinstalling.

You can then test it in a Python shell:

from multiverse_parser import InertiaSource, MjcfImporter, UrdfExporter

def main():
    input_path = "input/path.xml"
    output_path = "output/path.urdf"
    factory = MjcfImporter(file_path=input_path,
                           fixed_base=False,
                           root_name="world", # Or robot root link
                           with_physics=True,
                           with_visual=True,
                           with_collision=True,
                           inertia_source=InertiaSource.FROM_SRC)
    factory.import_model()
    exporter = UrdfExporter(file_path=output_path,
                            factory=factory)
    exporter.build()
    exporter.export(keep_usd=False)

if __name__ == "__main__":
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multiverse_parser-0.0.2-py3-none-any.whl (64.3 kB view details)

Uploaded Python 3

File details

Details for the file multiverse_parser-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for multiverse_parser-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0754a2ffd758c34c7a92812dd8729375692c12225bc176e1e00cddf06c98812b
MD5 5f72e8a6a006e3cd4f74e64de424de0c
BLAKE2b-256 5c6cfae30018e969e70b5088158c0ff307e3cc3cbd6823dc8f604a93ca9d5abd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page