Isaac Lab Extension Template

repository·main·Indexed 42 days ago

https://github.com/isaac-sim/isaaclabextensiontemplate

A template for developing Isaac Lab projects and extensions in an isolated environment. This repository is deprecated; users are advised to use the project template generator migrated into the main Isaac Lab repository.

Tokens
2K
Snippets
5
Records
7
Agent score
5%

What's inside Isaac Lab Extension Template

  1. Configure VSCode for Isaac Lab Development

    main

    To enable intelligent code suggestions and indexing for Isaac Sim and Omniverse modules:

    1. Run the setup task:

      • Press Ctrl+Shift+P in VSCode.
      • Select Tasks: Run Task.
      • Choose setup_python_env.
      • When prompted, provide the absolute path to your Isaac Sim installation.
      • This creates a .python.env file in the .vscode directory.
    2. Troubleshooting Pylance Indexing:

      • If extensions are not being indexed, add your extension path to .vscode/settings.json:
        {
            "python.analysis.extraPaths": [
                "<path-to-ext-repo>/source/ext_template"
            ]
        }
      • If Pylance crashes due to memory limits, exclude unused Omniverse packages (e.g., omni.anim.*, omni.kit.*, omni.graph.*) from the python.analysis.extraPaths list in .vscode/settings.json.
    {
        "python.analysis.extraPaths": [
            "<path-to-ext-repo>/source/ext_template"
        ]
    }
  2. Docker Setup for Isaac Lab Template

    main

    This project uses Docker Compose to manage the development environment.

    Prerequisites: You must first build the Isaac Lab base image locally following the Isaac Lab deployment guide. Verify it exists with docker images (should show isaac-lab-base).

    Workflow:

    1. Build the template image:

      cd docker
      docker compose --env-file .env.base --file docker-compose.yaml build isaac-lab-template
    2. Run the containers:

      • Foreground: docker compose --env-file .env.base --file docker-compose.yaml up
      • Detached (Background): docker compose --env-file .env.base --file docker-compose.yaml up -d
    3. Interact with the container:

      docker exec --interactive --tty -e DISPLAY=${DISPLAY} isaac-lab-template /bin/bash
    4. Shutdown:

      docker compose --env-file .env.base --file docker-compose.yaml down
    # Build and run in detached mode
    cd docker
    docker compose --env-file .env.base --file docker-compose.yaml up -d
    
    # Enter the container
    docker exec --interactive --tty -e DISPLAY=${DISPLAY} isaac-lab-template /bin/bash
  3. Setup as an Omniverse Extension

    main

    To run your code as a UI extension within the Omniverse environment:

    1. Add Search Paths:

      • Open the Extension Manager in Omniverse (Window -> Extensions).
      • Click the Hamburger Icon (☰) -> Settings.
      • Add the absolute path to IsaacLabExtensionTemplate/source to Extension Search Paths.
      • Add the path to Isaac Lab's extension directory (IsaacLab/source) if not already present.
      • Click the Hamburger Icon (☰) -> Refresh.
    2. Enable Extension:

      • Search for your extension under the Third Party category.
      • Toggle it to enable. An example UI extension is provided in source/ext_template/ext_template/ui_extension_example.py.
  4. Install the Isaac Lab Extension Template

    main

    Follow these steps to set up the template environment. Note that you must have Isaac Lab installed first (conda installation is recommended).

    1. Clone the repository (outside your Isaac Lab directory):

      • HTTPS: git clone https://github.com/isaac-sim/IsaacLabExtensionTemplate.git
      • SSH: git clone git@github.com:isaac-sim/IsaacLabExtensionTemplate.git
    2. Rename the template placeholder: The repository uses ext_template as a placeholder. Use the provided script to rename all occurrences to your desired extension name:

      cd IsaacLabExtensionTemplate
      python scripts/rename_template.py your_fancy_extension_name
    3. Install the extension in editable mode: Using a Python interpreter that has Isaac Lab installed, run:

      python -m pip install -e source/ext_template
    4. Verify installation: Run the training script to ensure the extension is correctly recognized:

      python scripts/rsl_rl/train.py --task=Template-Isaac-Velocity-Rough-Anymal-D-v0
    # Example sequence
    git clone https://github.com/isaac-sim/IsaacLabExtensionTemplate.git
    cd IsaacLabExtensionTemplate
    python scripts/rename_template.py my_robot_ext
    python -m pip install -e source/my_robot_ext
    python scripts/rsl_rl/train.py --task=Template-Isaac-Velocity-Rough-Anymal-D-v0
  5. Configure the Isaac Lab Template Docker environment

    main

    The docker-compose.yaml file defines the service isaac-lab-template used to run the extension template in a containerized environment. It relies on several environment variables and build arguments to map the local source code into the container.

    Key Configuration Details

    • Build Arguments: During the build process, the following arguments are passed to the Dockerfile:
      • ISAACLAB_BASE_IMAGE_ARG: Set via the ${ISAACLAB_BASE_IMAGE} environment variable.
      • DOCKER_ISAACLAB_EXTENSION_TEMPLATE_PATH_ARG: Set via the ${DOCKER_ISAACLAB_EXTENSION_TEMPLATE_PATH} environment variable.
    • Volumes: The project root (../) is bind-mounted to the path specified by ${DOCKER_ISAACLAB_EXTENSION_TEMPLATE_PATH} inside the container.
    • Environment Variables:
      • Uses an .env.base file for environment configuration.
      • Sets OMNI_KIT_ALLOW_ROOT=1 by default.
    • Hardware Requirements: The service uses the nvidia driver with count: all and capabilities: [ gpu ] to ensure GPU access.
    • Network: Uses network_mode: host.
    • Container Interaction: The container is configured with entrypoint: bash, stdin_open: true, and tty: true to allow interactive shell access.
    services:
      isaac-lab-template:
        env_file: .env.base
        build:
          context: ../
          dockerfile: docker/Dockerfile
          args:
            - ISAACLAB_BASE_IMAGE_ARG=${ISAACLAB_BASE_IMAGE}
            - DOCKER_ISAACLAB_EXTENSION_TEMPLATE_PATH_ARG=${DOCKER_ISAACLAB_EXTENSION_TEMPLATE_PATH}
        image: isaac-lab-template
        container_name: isaac-lab-template
        volumes:
          - type: bind
            source: ../
            target: ${DOCKER_ISAACLAB_EXTENSION_TEMPLATE_PATH}
        network_mode: host
        environment: 
          - OMNI_KIT_ALLOW_ROOT=1
        deploy:
          resources:
            reservations:
              devices:
                - driver: nvidia
                  count: all
                  capabilities: [ gpu ]
        entrypoint: bash
        stdin_open: true
        tty: true