Unverified Commit fcc216a5 authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Adds custom experience file loading to the AppLauncher (#473)

# Description

This MR automates the configuring of kit app files based on the settings
passed to the app launcher.

The experience file to load when launching the SimulationApp. If a
relative path is provided, it is resolved relative to the ``EXP_PATH``
environment variable. If provided as an empty string, the experience
file is determined based on the headless flag:

* If headless is True, the experience file is set to
``orbit.python.headless.kit``.
* If headless is False, the experience file is set to
``orbit.python.kit``.

Moreover, it adds the app experience file to use when running
multi-camera setup. This is taken from OIGE:
>
https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/blob/main/docs/examples/training_with_camera.md#working-with-cameras

Fixes #238

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] 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
- [x] 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
parent d4e350e9
...@@ -9,6 +9,33 @@ Tricks and Troubleshooting ...@@ -9,6 +9,33 @@ Tricks and Troubleshooting
assistance. assistance.
Checking the internal logs from the simulator
---------------------------------------------
When running the simulator from a standalone script, it logs warnings and errors to the terminal. At the same time,
it also logs internal messages to a file. These are useful for debugging and understanding the internal state of the
simulator. Depending on your system, the log file can be found in the locations listed
`here <https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_faq.html#common-path-locations>`_.
To obtain the exact location of the log file, you need to check the first few lines of the terminal output when
you run the standalone script. The log file location is printed at the start of the terminal output. For example:
.. code:: bash
[INFO] Using python from: /home/${USER}/git/orbit/_isaac_sim/python.sh
...
Passing the following args to the base kit application: []
Loading user config located at: '.../data/Kit/Isaac-Sim/2023.1/user.config.json'
[Info] [carb] Logging to file: '.../logs/Kit/Isaac-Sim/2023.1/kit_20240328_183346.log'
In the above example, the log file is located at ``.../logs/Kit/Isaac-Sim/2023.1/kit_20240328_183346.log``,
``...`` is the path to the user's log directory. The log file is named ``kit_20240328_183346.log``
You can open this file to check the internal logs from the simulator. Also when reporting issues, please include
this log file to help us debug the issue.
Using CPU Scaling Governor for performance Using CPU Scaling Governor for performance
------------------------------------------ ------------------------------------------
......
...@@ -76,7 +76,7 @@ custom arguments and those from :class:`~app.AppLauncher`. ...@@ -76,7 +76,7 @@ custom arguments and those from :class:`~app.AppLauncher`.
[INFO][AppLauncher]: The argument 'width' will be used to configure the SimulationApp. [INFO][AppLauncher]: The argument 'width' will be used to configure the SimulationApp.
[INFO][AppLauncher]: The argument 'height' will be used to configure the SimulationApp. [INFO][AppLauncher]: The argument 'height' will be used to configure the SimulationApp.
usage: launch_app.py [-h] [--size SIZE] [--width WIDTH] [--height HEIGHT] [--headless] [--livestream {0,1,2,3}] usage: launch_app.py [-h] [--size SIZE] [--width WIDTH] [--height HEIGHT] [--headless] [--livestream {0,1,2,3}]
[--offscreen_render] [--offscreen_render] [--verbose] [--experience EXPERIENCE]
Tutorial on running IsaacSim via the AppLauncher. Tutorial on running IsaacSim via the AppLauncher.
...@@ -91,6 +91,13 @@ custom arguments and those from :class:`~app.AppLauncher`. ...@@ -91,6 +91,13 @@ custom arguments and those from :class:`~app.AppLauncher`.
--livestream {0,1,2,3} --livestream {0,1,2,3}
Force enable livestreaming. Mapping corresponds to that for the "LIVESTREAM" environment variable. Force enable livestreaming. Mapping corresponds to that for the "LIVESTREAM" environment variable.
--offscreen_render Enable offscreen rendering when running without a GUI. --offscreen_render Enable offscreen rendering when running without a GUI.
--verbose Enable verbose terminal logging from the SimulationApp.
--experience EXPERIENCE
The experience file to load when launching the SimulationApp.
* If an empty string is provided, the experience file is determined based on the headless flag.
* If a relative path is provided, it is resolved relative to the `apps` folder in Isaac Sim and
Orbit (in that order).
This readout details the ``--size``, ``--height``, and ``--width`` arguments defined in the script directly, This readout details the ``--size``, ``--height``, and ``--width`` arguments defined in the script directly,
as well as the :class:`~app.AppLauncher` arguments. as well as the :class:`~app.AppLauncher` arguments.
......
...@@ -132,6 +132,7 @@ setup_conda_env() { ...@@ -132,6 +132,7 @@ setup_conda_env() {
'source '${isaacsim_setup_conda_env_script}'' \ 'source '${isaacsim_setup_conda_env_script}'' \
'' \ '' \
'# for orbit' \ '# for orbit' \
'export ORBIT_PATH='${ORBIT_PATH}'' \
'alias orbit='${ORBIT_PATH}'/orbit.sh' \ 'alias orbit='${ORBIT_PATH}'/orbit.sh' \
'' \ '' \
'# show icon if not runninng headless' \ '# show icon if not runninng headless' \
...@@ -144,6 +145,7 @@ setup_conda_env() { ...@@ -144,6 +145,7 @@ setup_conda_env() {
printf '%s\n' '#!/usr/bin/env bash' '' \ printf '%s\n' '#!/usr/bin/env bash' '' \
'# for orbit' \ '# for orbit' \
'unalias orbit &>/dev/null' \ 'unalias orbit &>/dev/null' \
'unalias ORBIT_PATH &>/dev/null' \
'' \ '' \
'# for isaac-sim' \ '# for isaac-sim' \
'unset CARB_APP_PATH' \ 'unset CARB_APP_PATH' \
......
##
# Adapted from: _isaac_sim/apps/omni.isaac.sim.python.gym.headless.kit
##
[package]
title = "Isaac Sim Python - Minimal (headless)"
description = "A minimal app for running standalone scripts headlessly."
version = "2023.1.1"
# That makes it browsable in UI with "experience" filter
keywords = ["experience", "app", "orbit", "python", "headless"]
#################
# Basic Kit App #
#################
[settings]
# Note: This path was adapted to be respective to the kit-exe file location
app.versionFile = "${exe-path}/../VERSION"
app.folder = "${exe-path}/../"
app.name = "Isaac-Sim"
app.version = "2023.1.1"
# set the default ros bridge to disable on startup
isaac.startup.ros_bridge_extension = ""
##################################
# Omniverse related dependencies #
##################################
[dependencies]
"omni.kit.window.title" = {}
"omni.kit.window.console" = {}
"omni.physx" = {}
"omni.physx.tensors" = {}
"omni.physx.fabric" = {}
"omni.warp.core" = {}
"usdrt.scenegraph" = {}
# "omni.kit.mainwindow" = {}
# "omni.kit.telemetry" = {}
[settings]
# Basic Kit App
app.content.emptyStageOnStart = false
# deprecate support for old kit.ui.menu
app.menu.legacy_mode = false
# use omni.ui.Menu for the MenuBar
app.menu.compatibility_mode = false
# Setting the port for the embedded http server
exts."omni.services.transport.server.http".port = 8211
# default viewport is fill
app.runLoops.rendering_0.fillResolution = false
# Fix PlayButtonGroup error
exts."omni.kit.widget.toolbar".PlayButton.enabled = false
[settings.app.settings]
persistent = true
dev_build = false
fabricDefaultStageFrameHistoryCount = 3 # needed for omni.syntheticdata TODO105 still true?
[settings.app.window]
title = "Isaac Sim Python"
hideUi = false
_iconSize = 256
# Note: This path was adapted to be respective to the kit folder location
iconPath = "${exe-path}/../exts/omni.isaac.app.setup/data/nvidia-omniverse-isaacsim.ico"
# Fonts
[setting.app.font]
file = "${fonts}/OpenSans-SemiBold.ttf"
size = 16
[settings.exts.'omni.kit.window.extensions']
# List extensions here we want to show as featured when extension manager is opened
featuredExts = []
[settings.app.python]
# These disable the kit app from also printing out python output, which gets confusing
interceptSysStdOutput = false
logSysStdOutput = false
[settings]
# MGPU is always on, you can turn it from the settings, and force this off to save even more resource if you
# only want to use a single GPU on your MGPU system
# False for Isaac Sim
renderer.multiGpu.enabled = true
renderer.multiGpu.autoEnable = true
'rtx-transient'.resourcemanager.enableTextureStreaming = true
app.asyncRendering = false
app.asyncRenderingLowLatency = false
app.hydraEngine.waitIdle = false
# app.hydra.aperture.conform = 4 # in 105.1 pixels are square by default
omni.replicator.asyncRendering = false
# Enable Iray and pxr by setting this to "rtx,iray,pxr"
renderer.enabled = "rtx"
# Disable the simulation output window popup
physics.autoPopupSimulationOutputWindow=false
# Disable IOMMU Enabled pop-up message on warmup (OM-100381)
persistent.renderer.startupMessageDisplayed = true
# Hang Detector
################################
# app.hangDetector.enabled = false
# app.hangDetector.timeout = 120
#######################
# Extensions Settings #
#######################
[settings.exts."omni.kit.registry.nucleus"]
registries = [
{ name = "kit/default", url = "https://ovextensionsprod.blob.core.windows.net/exts/kit/prod/shared" },
{ name = "kit/sdk", url = "https://ovextensionsprod.blob.core.windows.net/exts/kit/prod/sdk/${kit_version_short}/${kit_git_hash}" },
{ name = "kit/community", url = "https://dw290v42wisod.cloudfront.net/exts/kit/community" },
]
[settings.app.extensions]
skipPublishVerification = false
registryEnabled = true
[settings.exts."omni.kit.window.modifier.titlebar"]
titleFormatString = " Isaac Sim {version:${exe-path}/../SHORT_VERSION,font_color=0x909090,font_size=16} {separator} {file, board=true}"
showFileFullPath = true
icon.file = "${exe-path}/../exts/omni.isaac.app.setup/data/nvidia-omniverse-isaacsim.ico"
icon.size = 256
defaultFont.name = "Arial"
defaultFont.size = 16
defaultFont.color = 0xD0D0D0
separator.color = 0x00B976
separator.width = 1
windowBorder.color = 0x0F0F0F
windowBorder.width = 2
colors.caption = 0x0F0F0F
colors.client = 0x0F0F0F
respondOnMouseUp = true
changeWindowRegion = true
[settings.crashreporter.data]
experience = "Isaac Sim Python Minimal"
######################
# Isaac Sim Settings #
######################
[settings.app.renderer]
skipWhileMinimized = false
sleepMsOnFocus = 0
sleepMsOutOfFocus = 0
resolution.width=1280
resolution.height=720
# default camera position in meters
[settings.app.viewport]
defaultCamPos.x = 5
defaultCamPos.y = 5
defaultCamPos.z = 5
[settings.rtx]
raytracing.fractionalCutoutOpacity = false
hydra.enableSemanticSchema = true
# descriptorSets=60000
# reservedDescriptors=500000
# sceneDb.maxInstances=1000000
# Enable this for static scenes, improves visual quality
# directLighting.sampledLighting.enabled = true
[settings.persistent]
app.file.recentFiles = []
app.stage.upAxis = "Z"
app.stage.movePrimInPlace = false
app.stage.instanceableOnCreatingReference = false
app.stage.materialStrength = "weakerThanDescendants"
app.transform.gizmoUseSRT = true
app.viewport.grid.scale = 1.0
app.viewport.pickingMode = "kind:model.ALL"
app.viewport.camMoveVelocity = 0.05 # 5 m/s
app.viewport.gizmo.scale = 0.01 # scaled to meters
app.viewport.previewOnPeek = false
app.viewport.snapToSurface = false
app.viewport.displayOptions = 31951 # Disable Frame Rate and Resolution by default
app.window.uiStyle = "NvidiaDark"
app.primCreation.DefaultXformOpType = "Scale, Orient, Translate"
app.primCreation.DefaultXformOpOrder="xformOp:translate, xformOp:orient, xformOp:scale"
app.primCreation.typedDefaults.camera.clippingRange = [0.01, 10000000.0]
simulation.minFrameRate = 15
simulation.defaultMetersPerUnit = 1.0
omnigraph.updateToUsd = false
omnigraph.useSchemaPrims = true
omnigraph.disablePrimNodes = true
physics.updateToUsd = false
physics.updateVelocitiesToUsd = false
physics.useFastCache = false
physics.visualizationDisplayJoints = false
omni.replicator.captureOnPlay = true
omnihydra.useSceneGraphInstancing = true
renderer.startupMessageDisplayed = true # hides the IOMMU popup window
# Make Detail panel invisible by default
app.omniverse.content_browser.options_menu.show_details = false
app.omniverse.filepicker.options_menu.show_details = false
[settings.physics]
updateToUsd = false
updateVelocitiesToUsd = false
updateForceSensorsToUsd = false
outputVelocitiesLocalSpace = false
# Register extension folder from this repo in kit
[settings.app.exts]
folders = [
"${exe-path}/exts", # kit extensions
"${exe-path}/extscore", # kit core extensions
"${exe-path}/../exts", # isaac extensions
"${exe-path}/../extscache", # isaac cache extensions
"${exe-path}/../extsPhysics", # isaac physics extensions,
"${app}", # needed to find other app files
"${app}/../extensions", # needed to find extensions in orbit
]
[settings.ngx]
enabled=true # Enable this for DLSS
########################
# Isaac Sim Extensions #
########################
[dependencies]
"omni.isaac.core" = {}
"omni.isaac.core_archive" = {}
"omni.pip.compute" = {}
"omni.pip.cloud" = {}
"omni.isaac.cloner" = {}
"omni.isaac.kit" = {}
"omni.isaac.ml_archive" = {}
"omni.kit.loop-isaac" = {}
"omni.isaac.cloner" = {}
##
# Adapted from: https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/blob/main/apps/omni.isaac.sim.python.gym.camera.kit
#
# This app file designed specifically towards vision-based RL tasks. It provides necessary settings to enable
# multiple cameras to be rendered each frame. Additional settings are also applied to increase performance when
# rendering cameras across multiple environments.
##
[package]
title = "Isaac Sim Python - Minimal (efficient rendering)"
description = "A minimal app for running standalone scripts with efficient camera rendering settings."
version = "2023.1.1"
# That makes it browsable in UI with "experience" filter
keywords = ["experience", "app", "orbit", "python", "camera", "minimal"]
[dependencies]
# Orbit minimal app
"orbit.python.headless" = {}
# PhysX
"omni.kit.property.physx" = {}
"omni.kit.property.bundle" = {}
# Rendering
"omni.kit.material.library" = {}
"omni.kit.viewport.rtx" = {}
"omni.kit.viewport.bundle" = {}
# Windows
"omni.kit.window.file" = {}
"omni.kit.window.status_bar" = {}
"omni.kit.window.title" = {}
"omni.kit.window.extensions" = {}
"omni.kit.window.toolbar" = {}
"omni.kit.window.stage" = {}
# Menus
"omni.kit.menu.utils" = {}
"omni.kit.menu.file" = {}
"omni.kit.menu.edit" = {}
"omni.kit.menu.create" = {}
"omni.kit.menu.common" = {}
"omni.kit.menu.stage" = {}
[settings]
# Basic Kit App
################################
# Note: This path was adapted to be respective to the kit-exe file location
app.versionFile = "${exe-path}/../VERSION"
app.folder = "${exe-path}/../"
app.name = "Isaac-Sim"
app.version = "2023.1.1"
# set the default ros bridge to disable on startup
isaac.startup.ros_bridge_extension = ""
# Increase available descriptors to support more simultaneous cameras
rtx.descriptorSets=30000
# Enable new denoiser to reduce motion blur artifacts
rtx.newDenoiser.enabled=true
# Disable present thread to improve performance
exts."omni.renderer.core".present.enabled=false
# Disabling these settings reduces renderer VRAM usage and improves rendering performance, but at some quality cost
rtx.raytracing.cached.enabled = false
rtx.raytracing.lightcache.spatialCache.enabled = false
rtx.ambientOcclusion.enabled = false
rtx-transient.dlssg.enabled = false
rtx.sceneDb.ambientLightIntensity = 1.0
rtx.directLighting.sampledLighting.enabled = true
# Force synchronous rendering to improve training results
omni.replicator.asyncRendering = false
app.renderer.waitIdle=true
app.hydraEngine.waitIdle=true
[settings.exts."omni.kit.registry.nucleus"]
registries = [
{ name = "kit/default", url = "https://ovextensionsprod.blob.core.windows.net/exts/kit/prod/shared" },
{ name = "kit/sdk", url = "https://ovextensionsprod.blob.core.windows.net/exts/kit/prod/sdk/${kit_version_short}/${kit_git_hash}" },
{ name = "kit/community", url = "https://dw290v42wisod.cloudfront.net/exts/kit/community" },
]
[settings.app.renderer]
skipWhileMinimized = false
sleepMsOnFocus = 0
sleepMsOutOfFocus = 0
# Register extension folder from this repo in kit
[settings.app.exts]
folders = [
"${exe-path}/exts", # kit extensions
"${exe-path}/extscore", # kit core extensions
"${exe-path}/../exts", # isaac extensions
"${exe-path}/../extscache", # isaac cache extensions
"${exe-path}/../extsPhysics", # isaac physics extensions,
"${app}", # needed to find other app files
"${app}/../extensions", # needed to find extensions in orbit
]
# Isaac Sim Extensions
###############################
[dependencies]
"omni.isaac.app.setup" = { order = 1000 } # we are running that at the end
This diff is collapsed.
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.15.5" version = "0.15.6"
# Description # Description
title = "ORBIT framework for Robot Learning" title = "ORBIT framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.15.6 (2024-03-28)
~~~~~~~~~~~~~~~~~~~
Added
^^^^^
* Extended the :class:`omni.isaac.orbit.app.AppLauncher` class to support the loading of experience files
from the command line. This allows users to load a specific experience file when running the application
(such as for multi-camera rendering or headless mode).
Changed
^^^^^^^
* Changed default loading of experience files in the :class:`omni.isaac.orbit.app.AppLauncher` class from the ones
provided by Isaac Sim to the ones provided in Orbit's ``source/apps`` directory.
0.15.5 (2024-03-23) 0.15.5 (2024-03-23)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -102,6 +102,7 @@ class AppLauncher: ...@@ -102,6 +102,7 @@ class AppLauncher:
self._headless: bool # 0: GUI, 1: Headless self._headless: bool # 0: GUI, 1: Headless
self._livestream: Literal[0, 1, 2, 3] # 0: Disabled, 1: Native, 2: Websocket, 3: WebRTC self._livestream: Literal[0, 1, 2, 3] # 0: Disabled, 1: Native, 2: Websocket, 3: WebRTC
self._offscreen_render: bool # 0: Disabled, 1: Enabled self._offscreen_render: bool # 0: Disabled, 1: Enabled
self._sim_experience_file: str # Experience file to load
# Integrate env-vars and input keyword args into simulation app config # Integrate env-vars and input keyword args into simulation app config
self._config_resolution(launcher_args) self._config_resolution(launcher_args)
...@@ -157,6 +158,13 @@ class AppLauncher: ...@@ -157,6 +158,13 @@ class AppLauncher:
* ``offscreen_render`` (bool): If True, the app will be launched in offscreen-render mode. The values * ``offscreen_render`` (bool): If True, the app will be launched in offscreen-render mode. The values
map the same as that for the ``OFFSCREEN_RENDER`` environment variable. If False, then offscreen-render map the same as that for the ``OFFSCREEN_RENDER`` environment variable. If False, then offscreen-render
mode is determined by the ``OFFSCREEN_RENDER`` environment variable. mode is determined by the ``OFFSCREEN_RENDER`` environment variable.
* ``experience`` (str): The experience file to load when launching the SimulationApp. If a relative path
is provided, it is resolved relative to the ``apps`` folder in Isaac Sim and Orbit (in that order).
If provided as an empty string, the experience file is determined based on the headless flag:
* If headless is True, the experience file is set to ``orbit.python.headless.kit``.
* If headless is False, the experience file is set to ``orbit.python.kit``.
Args: Args:
parser: An argument parser instance to be extended with the AppLauncher specific options. parser: An argument parser instance to be extended with the AppLauncher specific options.
...@@ -184,7 +192,7 @@ class AppLauncher: ...@@ -184,7 +192,7 @@ class AppLauncher:
config = vars(known) config = vars(known)
if len(config) == 0: if len(config) == 0:
print( print(
"[Warn][AppLauncher]: There are no arguments attached to the ArgumentParser object." "[WARN][AppLauncher]: There are no arguments attached to the ArgumentParser object."
" If you have your own arguments, please load your own arguments before calling the" " If you have your own arguments, please load your own arguments before calling the"
" `AppLauncher.add_app_launcher_args` method. This allows the method to check the validity" " `AppLauncher.add_app_launcher_args` method. This allows the method to check the validity"
" of the arguments and perform checks for argument names." " of the arguments and perform checks for argument names."
...@@ -193,7 +201,10 @@ class AppLauncher: ...@@ -193,7 +201,10 @@ class AppLauncher:
AppLauncher._check_argparser_config_params(config) AppLauncher._check_argparser_config_params(config)
# Add custom arguments to the parser # Add custom arguments to the parser
arg_group = parser.add_argument_group("app_launcher arguments") arg_group = parser.add_argument_group(
"app_launcher arguments",
description="Arguments for the AppLauncher. For more details, please check the documentation.",
)
arg_group.add_argument( arg_group.add_argument(
"--headless", "--headless",
action="store_true", action="store_true",
...@@ -213,6 +224,21 @@ class AppLauncher: ...@@ -213,6 +224,21 @@ class AppLauncher:
default=AppLauncher._APPLAUNCHER_CFG_INFO["offscreen_render"][1], default=AppLauncher._APPLAUNCHER_CFG_INFO["offscreen_render"][1],
help="Enable offscreen rendering when running without a GUI.", help="Enable offscreen rendering when running without a GUI.",
) )
arg_group.add_argument(
"--verbose", # Note: This is read by SimulationApp through sys.argv
action="store_true",
help="Enable verbose terminal output from the SimulationApp.",
)
arg_group.add_argument(
"--experience",
type=str,
default="",
help=(
"The experience file to load when launching the SimulationApp. If an empty string is provided,"
" the experience file is determined based on the headless flag. If a relative path is provided,"
" it is resolved relative to the `apps` folder in Isaac Sim and Orbit (in that order)."
),
)
# Corresponding to the beginning of the function, # Corresponding to the beginning of the function,
# if we have removed -h/--help handling, we add it back. # if we have removed -h/--help handling, we add it back.
...@@ -228,6 +254,7 @@ class AppLauncher: ...@@ -228,6 +254,7 @@ class AppLauncher:
"headless": ([bool], False), "headless": ([bool], False),
"livestream": ([int], -1), "livestream": ([int], -1),
"offscreen_render": ([bool], False), "offscreen_render": ([bool], False),
"experience": ([str], ""),
} }
"""A dictionary of arguments added manually by the :meth:`AppLauncher.add_app_launcher_args` method. """A dictionary of arguments added manually by the :meth:`AppLauncher.add_app_launcher_args` method.
...@@ -240,7 +267,7 @@ class AppLauncher: ...@@ -240,7 +267,7 @@ class AppLauncher:
# TODO: Find some internally managed NVIDIA list of these types. # TODO: Find some internally managed NVIDIA list of these types.
# SimulationApp.DEFAULT_LAUNCHER_CONFIG almost works, except that # SimulationApp.DEFAULT_LAUNCHER_CONFIG almost works, except that
# it is ambiguous where the default types are None # it is ambiguous where the default types are None
_SIMULATIONAPP_CFG_TYPES: dict[str, list[type]] = { _SIM_APP_CFG_TYPES: dict[str, list[type]] = {
"headless": [bool], "headless": [bool],
"active_gpu": [int, type(None)], "active_gpu": [int, type(None)],
"physics_gpu": [int], "physics_gpu": [int],
...@@ -289,7 +316,7 @@ class AppLauncher: ...@@ -289,7 +316,7 @@ class AppLauncher:
ValueError: If a key is an already existing field in the configuration parameters but ValueError: If a key is an already existing field in the configuration parameters but
should be added by calling the :meth:`AppLauncher.add_app_launcher_args. should be added by calling the :meth:`AppLauncher.add_app_launcher_args.
ValueError: If keys corresponding to those used to initialize SimulationApp ValueError: If keys corresponding to those used to initialize SimulationApp
(as found in :attr:`_SIMULATIONAPP_CFG_TYPES`) are of the wrong value type. (as found in :attr:`_SIM_APP_CFG_TYPES`) are of the wrong value type.
""" """
# check that no config key conflicts with AppLauncher config names # check that no config key conflicts with AppLauncher config names
applauncher_keys = set(AppLauncher._APPLAUNCHER_CFG_INFO.keys()) applauncher_keys = set(AppLauncher._APPLAUNCHER_CFG_INFO.keys())
...@@ -301,11 +328,11 @@ class AppLauncher: ...@@ -301,11 +328,11 @@ class AppLauncher:
" argument or rename it to a non-conflicting name." " argument or rename it to a non-conflicting name."
) )
# check that type of the passed keys are valid # check that type of the passed keys are valid
simulationapp_keys = set(AppLauncher._SIMULATIONAPP_CFG_TYPES.keys()) simulationapp_keys = set(AppLauncher._SIM_APP_CFG_TYPES.keys())
for key, value in config.items(): for key, value in config.items():
if key in simulationapp_keys: if key in simulationapp_keys:
given_type = type(value) given_type = type(value)
expected_types = AppLauncher._SIMULATIONAPP_CFG_TYPES[key] expected_types = AppLauncher._SIM_APP_CFG_TYPES[key]
if type(value) not in set(expected_types): if type(value) not in set(expected_types):
raise ValueError( raise ValueError(
f"Invalid value type for the argument '{key}': {given_type}. Expected one of {expected_types}," f"Invalid value type for the argument '{key}': {given_type}. Expected one of {expected_types},"
...@@ -409,13 +436,42 @@ class AppLauncher: ...@@ -409,13 +436,42 @@ class AppLauncher:
# Check if input keywords contain an 'experience' file setting # Check if input keywords contain an 'experience' file setting
# Note: since experience is taken as a separate argument by Simulation App, we store it separately # Note: since experience is taken as a separate argument by Simulation App, we store it separately
self._simulationapp_experience = launcher_args.pop("experience", "") self._sim_experience_file = launcher_args.pop("experience", "")
print(f"[INFO][AppLauncher]: Loading experience file: {self._simulationapp_experience} .")
# If nothing is provided resolve the experience file based on the headless flag
kit_app_exp_path = os.environ["EXP_PATH"]
orbit_app_exp_path = os.path.join(os.environ["ORBIT_PATH"], "source", "apps")
if self._sim_experience_file == "":
# check if the headless flag is set
if self._headless:
self._sim_experience_file = os.path.join(orbit_app_exp_path, "orbit.python.headless.kit")
else:
self._sim_experience_file = os.path.join(orbit_app_exp_path, "orbit.python.kit")
elif not os.path.isabs(self._sim_experience_file):
option_1_app_exp_path = os.path.join(kit_app_exp_path, self._sim_experience_file)
option_2_app_exp_path = os.path.join(orbit_app_exp_path, self._sim_experience_file)
if os.path.exists(option_1_app_exp_path):
self._sim_experience_file = option_1_app_exp_path
elif os.path.exists(option_2_app_exp_path):
self._sim_experience_file = option_2_app_exp_path
else:
raise FileNotFoundError(
f"Invalid value for input keyword argument `experience`: {self._sim_experience_file}."
"\n No such file exists in either the Kit or Orbit experience paths. Checked paths:"
f"\n\t [1]: {option_1_app_exp_path}"
f"\n\t [2]: {option_2_app_exp_path}"
)
elif not os.path.exists(self._sim_experience_file):
raise FileNotFoundError(
f"Invalid value for input keyword argument `experience`: {self._sim_experience_file}."
" The file does not exist."
)
print(f"[INFO][AppLauncher]: Loading experience file: {self._sim_experience_file}")
# Remove all values from input keyword args which are not meant for SimulationApp # Remove all values from input keyword args which are not meant for SimulationApp
# Assign all the passed settings to a dictionary for the simulation app # Assign all the passed settings to a dictionary for the simulation app
self._simulationapp_config = { self._sim_app_config = {
key: launcher_args[key] key: launcher_args[key] for key in set(AppLauncher._SIM_APP_CFG_TYPES.keys()) & set(launcher_args.keys())
for key in set(AppLauncher._SIMULATIONAPP_CFG_TYPES.keys()) & set(launcher_args.keys())
} }
def _create_app(self): def _create_app(self):
...@@ -432,7 +488,7 @@ class AppLauncher: ...@@ -432,7 +488,7 @@ class AppLauncher:
hacked_modules[key] = sys.modules[key] hacked_modules[key] = sys.modules[key]
del sys.modules[key] del sys.modules[key]
# launch simulation app # launch simulation app
self._app = SimulationApp(self._simulationapp_config, experience=self._simulationapp_experience) self._app = SimulationApp(self._sim_app_config, experience=self._sim_experience_file)
# add orbit modules back to sys.modules # add orbit modules back to sys.modules
for key, value in hacked_modules.items(): for key, value in hacked_modules.items():
sys.modules[key] = value sys.modules[key] = value
...@@ -505,7 +561,8 @@ class AppLauncher: ...@@ -505,7 +561,8 @@ class AppLauncher:
# the module for orbit.envs.ui work # the module for orbit.envs.ui work
enable_extension("omni.isaac.ui") enable_extension("omni.isaac.ui")
# enable animation recording extension # enable animation recording extension
enable_extension("omni.kit.stagerecorder.core") if not self._headless or self._livestream >= 1:
enable_extension("omni.kit.stagerecorder.core")
# set the nucleus directory manually to the latest published Nucleus # set the nucleus directory manually to the latest published Nucleus
# note: this is done to ensure prior versions of Isaac Sim still use the latest assets # note: this is done to ensure prior versions of Isaac Sim still use the latest assets
......
...@@ -8,7 +8,6 @@ from __future__ import annotations ...@@ -8,7 +8,6 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import argparse import argparse
import os
parser = argparse.ArgumentParser(description="Generate terrains using trimesh") parser = argparse.ArgumentParser(description="Generate terrains using trimesh")
parser.add_argument( parser.add_argument(
...@@ -20,12 +19,12 @@ from omni.isaac.orbit.app import AppLauncher ...@@ -20,12 +19,12 @@ from omni.isaac.orbit.app import AppLauncher
# launch omniverse app # launch omniverse app
# note: we only need to do this because of `TerrainImporter` which uses Omniverse functions # note: we only need to do this because of `TerrainImporter` which uses Omniverse functions
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
import os
import trimesh import trimesh
import omni.isaac.orbit.terrains.height_field as hf_gen import omni.isaac.orbit.terrains.height_field as hf_gen
......
...@@ -8,7 +8,6 @@ from __future__ import annotations ...@@ -8,7 +8,6 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import argparse import argparse
import os
parser = argparse.ArgumentParser(description="Generate terrains using trimesh") parser = argparse.ArgumentParser(description="Generate terrains using trimesh")
parser.add_argument( parser.add_argument(
...@@ -20,13 +19,13 @@ from omni.isaac.orbit.app import AppLauncher ...@@ -20,13 +19,13 @@ from omni.isaac.orbit.app import AppLauncher
# launch omniverse app # launch omniverse app
# note: we only need to do this because of `TerrainImporter` which uses Omniverse functions # note: we only need to do this because of `TerrainImporter` which uses Omniverse functions
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(headless=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
import argparse import argparse
import os
import trimesh import trimesh
import omni.isaac.orbit.terrains.trimesh as mesh_gen import omni.isaac.orbit.terrains.trimesh as mesh_gen
......
...@@ -7,18 +7,16 @@ from __future__ import annotations ...@@ -7,18 +7,16 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import os
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
# launch omniverse app # launch omniverse app
# note: we only need to do this because of `TerrainImporter` which uses Omniverse functions # note: we only need to do this because of `TerrainImporter` which uses Omniverse functions
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(headless=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
import os
import shutil import shutil
from omni.isaac.orbit.terrains.config.rough import ROUGH_TERRAINS_CFG from omni.isaac.orbit.terrains.config.rough import ROUGH_TERRAINS_CFG
......
...@@ -7,13 +7,10 @@ from __future__ import annotations ...@@ -7,13 +7,10 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import os
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch the simulator # launch the simulator
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(headless=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
......
...@@ -7,13 +7,10 @@ from __future__ import annotations ...@@ -7,13 +7,10 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import os
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch the simulator # launch the simulator
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(headless=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
......
...@@ -7,13 +7,10 @@ from __future__ import annotations ...@@ -7,13 +7,10 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import os
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch the simulator # launch the simulator
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True, offscreen_render=True)
app_launcher = AppLauncher(headless=True, offscreen_render=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
......
...@@ -7,13 +7,10 @@ from __future__ import annotations ...@@ -7,13 +7,10 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import os
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch the simulator # launch the simulator
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(headless=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
......
...@@ -7,13 +7,10 @@ from __future__ import annotations ...@@ -7,13 +7,10 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import os
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch the simulator # launch the simulator
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(headless=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
......
...@@ -7,13 +7,11 @@ from __future__ import annotations ...@@ -7,13 +7,11 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import os
from omni.isaac.orbit.app import AppLauncher, run_tests from omni.isaac.orbit.app import AppLauncher, run_tests
# launch the simulator # launch the simulator
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit" app_launcher = AppLauncher(headless=True)
app_launcher = AppLauncher(headless=True, experience=app_experience)
simulation_app = app_launcher.app simulation_app = app_launcher.app
......
...@@ -9,7 +9,6 @@ from __future__ import annotations ...@@ -9,7 +9,6 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import argparse import argparse
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
......
...@@ -9,9 +9,7 @@ from __future__ import annotations ...@@ -9,9 +9,7 @@ from __future__ import annotations
"""Launch Isaac Sim Simulator first.""" """Launch Isaac Sim Simulator first."""
import argparse import argparse
import os
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
...@@ -32,14 +30,8 @@ AppLauncher.add_app_launcher_args(parser) ...@@ -32,14 +30,8 @@ AppLauncher.add_app_launcher_args(parser)
# parse the arguments # parse the arguments
args_cli = parser.parse_args() args_cli = parser.parse_args()
# launch the simulator
# load cheaper kit config in headless
if args_cli.headless:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit"
else:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.kit"
# launch omniverse app # launch omniverse app
app_launcher = AppLauncher(args_cli, experience=app_experience) app_launcher = AppLauncher(args_cli)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
......
...@@ -11,7 +11,6 @@ from __future__ import annotations ...@@ -11,7 +11,6 @@ from __future__ import annotations
import argparse import argparse
import os
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
...@@ -37,14 +36,8 @@ cli_args.add_rsl_rl_args(parser) ...@@ -37,14 +36,8 @@ cli_args.add_rsl_rl_args(parser)
AppLauncher.add_app_launcher_args(parser) AppLauncher.add_app_launcher_args(parser)
args_cli = parser.parse_args() args_cli = parser.parse_args()
# load cheaper kit config in headless
if args_cli.headless:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit"
else:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.kit"
# launch omniverse app # launch omniverse app
app_launcher = AppLauncher(args_cli, experience=app_experience) app_launcher = AppLauncher(args_cli)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
......
...@@ -11,7 +11,6 @@ from __future__ import annotations ...@@ -11,7 +11,6 @@ from __future__ import annotations
import argparse import argparse
import numpy as np
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
...@@ -41,6 +40,7 @@ simulation_app = app_launcher.app ...@@ -41,6 +40,7 @@ simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
import gymnasium as gym import gymnasium as gym
import numpy as np
import os import os
import torch import torch
......
...@@ -16,8 +16,6 @@ from __future__ import annotations ...@@ -16,8 +16,6 @@ from __future__ import annotations
import argparse import argparse
import numpy as np
import os
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
...@@ -38,20 +36,14 @@ AppLauncher.add_app_launcher_args(parser) ...@@ -38,20 +36,14 @@ AppLauncher.add_app_launcher_args(parser)
# parse the arguments # parse the arguments
args_cli = parser.parse_args() args_cli = parser.parse_args()
# launch the simulator
config = {"headless": args_cli.headless}
# load cheaper kit config in headless
if args_cli.headless:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit"
else:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.kit"
# launch omniverse app # launch omniverse app
app_launcher = AppLauncher(args_cli, experience=app_experience) app_launcher = AppLauncher(args_cli)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
import gymnasium as gym import gymnasium as gym
import numpy as np
import os import os
from datetime import datetime from datetime import datetime
......
...@@ -16,7 +16,6 @@ from __future__ import annotations ...@@ -16,7 +16,6 @@ from __future__ import annotations
import argparse import argparse
import os
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
...@@ -41,6 +40,7 @@ simulation_app = app_launcher.app ...@@ -41,6 +40,7 @@ simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
import gymnasium as gym import gymnasium as gym
import os
import torch import torch
from skrl.agents.torch.ppo import PPO, PPO_DEFAULT_CONFIG from skrl.agents.torch.ppo import PPO, PPO_DEFAULT_CONFIG
......
...@@ -16,7 +16,6 @@ from __future__ import annotations ...@@ -16,7 +16,6 @@ from __future__ import annotations
import argparse import argparse
import os
from omni.isaac.orbit.app import AppLauncher from omni.isaac.orbit.app import AppLauncher
...@@ -37,19 +36,14 @@ AppLauncher.add_app_launcher_args(parser) ...@@ -37,19 +36,14 @@ AppLauncher.add_app_launcher_args(parser)
# parse the arguments # parse the arguments
args_cli = parser.parse_args() args_cli = parser.parse_args()
# launch the simulator
# load cheaper kit config in headless
if args_cli.headless:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.gym.headless.kit"
else:
app_experience = f"{os.environ['EXP_PATH']}/omni.isaac.sim.python.kit"
# launch omniverse app # launch omniverse app
app_launcher = AppLauncher(args_cli, experience=app_experience) app_launcher = AppLauncher(args_cli)
simulation_app = app_launcher.app simulation_app = app_launcher.app
"""Rest everything follows.""" """Rest everything follows."""
import gymnasium as gym import gymnasium as gym
import os
from datetime import datetime from datetime import datetime
from skrl.agents.torch.ppo import PPO, PPO_DEFAULT_CONFIG from skrl.agents.torch.ppo import PPO, PPO_DEFAULT_CONFIG
......
...@@ -59,8 +59,8 @@ def parse_args() -> argparse.Namespace: ...@@ -59,8 +59,8 @@ def parse_args() -> argparse.Namespace:
) )
# configure default logging path based on time stamp # configure default logging path based on time stamp
log_file_name = "test_results_" + datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + ".log" log_file_name = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + ".log"
default_log_path = os.path.join(ORBIT_PATH, "logs", log_file_name) default_log_path = os.path.join(ORBIT_PATH, "logs", "test_results", log_file_name)
parser.add_argument( parser.add_argument(
"--log_path", type=str, default=default_log_path, help="Path to the log file to store the results in." "--log_path", type=str, default=default_log_path, help="Path to the log file to store the results in."
......
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