Unverified Commit dfa74872 authored by Hunter Hansen's avatar Hunter Hansen Committed by GitHub

Adapts isaac sim path in the container to point to its symlink (#482)

# Description

The experience files that we host in Orbit rely upon an expression
`${exe-path}`, specifically to resolve the location of the `VERSION`.
From our `orbit.python.headless.kit`:
```
app.versionFile = "${exe-path}/../VERSION"
app.folder = "${exe-path}/../"
```
This resolves to the full path of the calling exe, which is the `kit`
application in isaac-sim.

Currently this is broken in the container because we set
`ISAACSIM_PATH=/isaac-sim`, which is broken during the path operations
done on it. This PR fixes that by making
`ISAACSIM_PATH=/workspace/orbit/_isaac_sim` as well as mapping other
aliases (`python`, `python3`) through this path.

I have also added `not self._livestream` as a precondition of enabling
the `orbit.python.headless.kit` experience file, because otherwise we do
not render to livestream.

I also added fixes for all the newly failing tests, except for
`test_urdf_converter.py`. I will add a fix for that to this branch as
soon as I have one.

UPDATE:
It appears that `test_urdf_converter.py` was broken at least as far back
as commit `a30d764d`, which precedes the experience file commit. I will
therefore merge this without fixing that test.

Fixes [#339](https://github.com/NVIDIA-Omniverse/orbit/issues/339),
[#338](https://github.com/NVIDIA-Omniverse/orbit/issues/338)

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have run all the tests with `./orbit.sh --test` and they pass
(except `test_urdf_converter.py`)
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------
Signed-off-by: 's avatarHunter Hansen <50837800+hhansen-bdai@users.noreply.github.com>
Co-authored-by: 's avatarMayank Mittal <12863862+Mayankm96@users.noreply.github.com>
parent 6cbf0011
...@@ -7,7 +7,9 @@ ACCEPT_EULA=Y ...@@ -7,7 +7,9 @@ ACCEPT_EULA=Y
# NVIDIA Isaac Sim version to use (e.g. 2023.1.1, 2023.1.0-hotfix.1) # NVIDIA Isaac Sim version to use (e.g. 2023.1.1, 2023.1.0-hotfix.1)
ISAACSIM_VERSION=2023.1.1 ISAACSIM_VERSION=2023.1.1
# Derived from the default path in the NVIDIA provided Isaac Sim container # Derived from the default path in the NVIDIA provided Isaac Sim container
DOCKER_ISAACSIM_PATH=/isaac-sim DOCKER_ISAACSIM_ROOT_PATH=/isaac-sim
# The Orbit path in the container
DOCKER_ORBIT_PATH=/workspace/orbit
# Docker user directory - by default this is the root user's home directory # Docker user directory - by default this is the root user's home directory
DOCKER_USER_HOME=/root DOCKER_USER_HOME=/root
......
...@@ -19,15 +19,15 @@ LABEL description="Dockerfile for building and running the Orbit framework insid ...@@ -19,15 +19,15 @@ LABEL description="Dockerfile for building and running the Orbit framework insid
# Arguments # Arguments
# Path to Isaac Sim root folder # Path to Isaac Sim root folder
ARG ISAACSIM_PATH ARG ISAACSIM_ROOT_PATH
# Path to orbit directory
ARG ORBIT_PATH
# Home dir of docker user, typically '/root' # Home dir of docker user, typically '/root'
ARG DOCKER_USER_HOME ARG DOCKER_USER_HOME
# Set environment variables # Set environment variables
ENV LANG=C.UTF-8 ENV LANG=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Path to orbit directory
ENV ORBIT_PATH=/workspace/orbit
# Install dependencies and remove cache # Install dependencies and remove cache
RUN --mount=type=cache,target=/var/cache/apt \ RUN --mount=type=cache,target=/var/cache/apt \
...@@ -44,10 +44,10 @@ RUN --mount=type=cache,target=/var/cache/apt \ ...@@ -44,10 +44,10 @@ RUN --mount=type=cache,target=/var/cache/apt \
COPY ../ ${ORBIT_PATH} COPY ../ ${ORBIT_PATH}
# Set up a symbolic link between the installed Isaac Sim root folder and _isaac_sim in the orbit directory # Set up a symbolic link between the installed Isaac Sim root folder and _isaac_sim in the orbit directory
RUN ln -sf ${ISAACSIM_PATH} ${ORBIT_PATH}/_isaac_sim RUN ln -sf ${ISAACSIM_ROOT_PATH} ${ORBIT_PATH}/_isaac_sim
# for singularity usage, have to create the directories that will binded # for singularity usage, have to create the directories that will binded
RUN mkdir -p ${ISAACSIM_PATH}/kit/cache && \ RUN mkdir -p ${ISAACSIM_ROOT_PATH}/kit/cache && \
mkdir -p ${DOCKER_USER_HOME}/.cache/ov && \ mkdir -p ${DOCKER_USER_HOME}/.cache/ov && \
mkdir -p ${DOCKER_USER_HOME}/.cache/pip && \ mkdir -p ${DOCKER_USER_HOME}/.cache/pip && \
mkdir -p ${DOCKER_USER_HOME}/.cache/nvidia/GLCache && \ mkdir -p ${DOCKER_USER_HOME}/.cache/nvidia/GLCache && \
...@@ -73,11 +73,11 @@ RUN --mount=type=cache,target=${DOCKER_USER_HOME}/.cache/pip \ ...@@ -73,11 +73,11 @@ RUN --mount=type=cache,target=${DOCKER_USER_HOME}/.cache/pip \
# aliasing orbit.sh and python for convenience # aliasing orbit.sh and python for convenience
RUN echo "alias orbit=${ORBIT_PATH}/orbit.sh" >> ${HOME}/.bashrc && \ RUN echo "alias orbit=${ORBIT_PATH}/orbit.sh" >> ${HOME}/.bashrc && \
echo "alias python=${ISAACSIM_PATH}/python.sh" >> ${HOME}/.bashrc && \ echo "alias python=${ORBIT_PATH}/_isaac_sim/python.sh" >> ${HOME}/.bashrc && \
echo "alias python3=${ISAACSIM_PATH}/python.sh" >> ${HOME}/.bashrc && \ echo "alias python3=${ORBIT_PATH}/_isaac_sim/python.sh" >> ${HOME}/.bashrc && \
echo "alias pip='${ISAACSIM_PATH}/python.sh -m pip'" >> ${HOME}/.bashrc && \ echo "alias pip='${ORBIT_PATH}/_isaac_sim/python.sh -m pip'" >> ${HOME}/.bashrc && \
echo "alias pip3='${ISAACSIM_PATH}/python.sh -m pip'" >> ${HOME}/.bashrc && \ echo "alias pip3='${ORBIT_PATH}/_isaac_sim/python.sh -m pip'" >> ${HOME}/.bashrc && \
echo "alias tensorboard='${ISAACSIM_PATH}/python.sh ${ISAACSIM_PATH}/tensorboard'" >> ${HOME}/.bashrc && \ echo "alias tensorboard='${ORBIT_PATH}/_isaac_sim/python.sh ${ORBIT_PATH}/_isaac_sim/tensorboard'" >> ${HOME}/.bashrc && \
echo "export TZ=$(date +%Z)" >> ${HOME}/.bashrc echo "export TZ=$(date +%Z)" >> ${HOME}/.bashrc
# make working directory as the orbit directory # make working directory as the orbit directory
......
...@@ -8,7 +8,7 @@ x-default-orbit-volumes: ...@@ -8,7 +8,7 @@ x-default-orbit-volumes:
# https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/install_faq.html#save-isaac-sim-configs-on-local-disk # https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/install_faq.html#save-isaac-sim-configs-on-local-disk
- type: volume - type: volume
source: isaac-cache-kit source: isaac-cache-kit
target: ${DOCKER_ISAACSIM_PATH}/kit/cache target: ${DOCKER_ISAACSIM_ROOT_PATH}/kit/cache
- type: volume - type: volume
source: isaac-cache-ov source: isaac-cache-ov
target: ${DOCKER_USER_HOME}/.cache/ov target: ${DOCKER_USER_HOME}/.cache/ov
...@@ -26,7 +26,7 @@ x-default-orbit-volumes: ...@@ -26,7 +26,7 @@ x-default-orbit-volumes:
target: ${DOCKER_USER_HOME}/.nvidia-omniverse/logs target: ${DOCKER_USER_HOME}/.nvidia-omniverse/logs
- type: volume - type: volume
source: isaac-carb-logs source: isaac-carb-logs
target: ${DOCKER_ISAACSIM_PATH}/kit/logs/Kit/Isaac-Sim target: ${DOCKER_ISAACSIM_ROOT_PATH}/kit/logs/Kit/Isaac-Sim
- type: volume - type: volume
source: isaac-data source: isaac-data
target: ${DOCKER_USER_HOME}/.local/share/ov/data target: ${DOCKER_USER_HOME}/.local/share/ov/data
...@@ -87,17 +87,16 @@ services: ...@@ -87,17 +87,16 @@ services:
dockerfile: docker/Dockerfile.base dockerfile: docker/Dockerfile.base
args: args:
- ISAACSIM_VERSION=${ISAACSIM_VERSION} - ISAACSIM_VERSION=${ISAACSIM_VERSION}
- ISAACSIM_PATH=${DOCKER_ISAACSIM_PATH} - ISAACSIM_ROOT_PATH=${DOCKER_ISAACSIM_ROOT_PATH}
- ORBIT_PATH=${DOCKER_ORBIT_PATH}
- DOCKER_USER_HOME=${DOCKER_USER_HOME} - DOCKER_USER_HOME=${DOCKER_USER_HOME}
image: orbit-base image: orbit-base
container_name: orbit-base container_name: orbit-base
environment: environment:
# We set DOCKER_ISAACSIM_PATH and then forward it to ISAACSIM_PATH within
# the container to avoid collision with pre-existing ISAACSIM_PATH env vars
# that could come from installing Orbit on the local machine, causing build errors.
# We can't just define this in the .env file because shell envars take precedence # We can't just define this in the .env file because shell envars take precedence
# https://docs.docker.com/compose/environment-variables/envvars-precedence/ # https://docs.docker.com/compose/environment-variables/envvars-precedence/
- ISAACSIM_PATH=${DOCKER_ISAACSIM_PATH} - ISAACSIM_PATH=${DOCKER_ORBIT_PATH}/_isaac_sim
- ORBIT_PATH=${DOCKER_ORBIT_PATH}
# This should also be enabled for X11 forwarding # This should also be enabled for X11 forwarding
# - DISPLAY=${DISPLAY} # - DISPLAY=${DISPLAY}
volumes: *default-orbit-volumes volumes: *default-orbit-volumes
...@@ -127,7 +126,8 @@ services: ...@@ -127,7 +126,8 @@ services:
image: orbit-ros2 image: orbit-ros2
container_name: orbit-ros2 container_name: orbit-ros2
environment: environment:
- ISAACSIM_PATH=${DOCKER_ISAACSIM_PATH} - ISAACSIM_PATH=${DOCKER_ORBIT_PATH}/_isaac_sim
- ORBIT_PATH=${DOCKER_ORBIT_PATH}
volumes: *default-orbit-volumes volumes: *default-orbit-volumes
network_mode: host network_mode: host
deploy: *default-orbit-deploy deploy: *default-orbit-deploy
......
...@@ -443,7 +443,7 @@ class AppLauncher: ...@@ -443,7 +443,7 @@ class AppLauncher:
orbit_app_exp_path = os.path.join(os.environ["ORBIT_PATH"], "source", "apps") orbit_app_exp_path = os.path.join(os.environ["ORBIT_PATH"], "source", "apps")
if self._sim_experience_file == "": if self._sim_experience_file == "":
# check if the headless flag is set # check if the headless flag is set
if self._headless: if self._headless and not self._livestream:
self._sim_experience_file = os.path.join(orbit_app_exp_path, "orbit.python.headless.kit") self._sim_experience_file = os.path.join(orbit_app_exp_path, "orbit.python.headless.kit")
else: else:
self._sim_experience_file = os.path.join(orbit_app_exp_path, "orbit.python.kit") self._sim_experience_file = os.path.join(orbit_app_exp_path, "orbit.python.kit")
......
...@@ -13,7 +13,7 @@ from __future__ import annotations ...@@ -13,7 +13,7 @@ from __future__ import annotations
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch omniverse app # launch omniverse app
app_launcher = AppLauncher(headless=True) app_launcher = AppLauncher(headless=True, offscreen_render=True)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch omniverse app # launch omniverse app
app_launcher = AppLauncher(headless=True) app_launcher = AppLauncher(headless=True, offscreen_render=True)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
......
...@@ -10,7 +10,7 @@ from __future__ import annotations ...@@ -10,7 +10,7 @@ from __future__ import annotations
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch omniverse app # launch omniverse app
simulation_app = AppLauncher(headless=True).app simulation_app = AppLauncher(headless=True, experience="omni.isaac.sim.python.gym.headless.kit").app
"""Rest everything follows.""" """Rest everything follows."""
......
...@@ -17,7 +17,7 @@ import unittest ...@@ -17,7 +17,7 @@ import unittest
import omni.isaac.core.utils.prims as prim_utils import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils import omni.isaac.core.utils.stage as stage_utils
from omni.isaac.core.simulation_context import SimulationContext from omni.isaac.core.simulation_context import SimulationContext
from omni.isaac.core.utils.extensions import get_extension_path_from_name from omni.isaac.core.utils.extensions import enable_extension, get_extension_path_from_name
import omni.isaac.orbit.sim as sim_utils import omni.isaac.orbit.sim as sim_utils
from omni.isaac.orbit.utils.assets import ISAAC_ORBIT_NUCLEUS_DIR from omni.isaac.orbit.utils.assets import ISAAC_ORBIT_NUCLEUS_DIR
...@@ -62,6 +62,7 @@ class TestSpawningFromFiles(unittest.TestCase): ...@@ -62,6 +62,7 @@ class TestSpawningFromFiles(unittest.TestCase):
def test_spawn_urdf(self): def test_spawn_urdf(self):
"""Test loading prim from URDF file.""" """Test loading prim from URDF file."""
# retrieve path to urdf importer extension # retrieve path to urdf importer extension
enable_extension("omni.importer.urdf")
extension_path = get_extension_path_from_name("omni.importer.urdf") extension_path = get_extension_path_from_name("omni.importer.urdf")
# Spawn franka from URDF # Spawn franka from URDF
cfg = sim_utils.UrdfFileCfg( cfg = sim_utils.UrdfFileCfg(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment