Commit 7358a4e0 authored by oahmednv's avatar oahmednv Committed by Kelly Guo

Adds flag to wait for texture loading completion when reset (#164)

This PR adds a new `wait_for_textures` option in DirectRLEnv and
ManagerBasedEnv cfg classes to wait for texture loading to complete
before proceeding with rendering. Previously, textures may continue to
load while the environment is running, resulting in renders with
incomplete textures.

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

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.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 updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent e9de688e
...@@ -163,7 +163,7 @@ Added ...@@ -163,7 +163,7 @@ Added
* Added full buffer property to :class:`omni.isaac.lab.utils.buffers.circular_buffer.CircularBuffer` * Added full buffer property to :class:`omni.isaac.lab.utils.buffers.circular_buffer.CircularBuffer`
0.27.33 (2024-12-15) 0.27.34 (2024-12-15)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Added Added
...@@ -172,7 +172,7 @@ Added ...@@ -172,7 +172,7 @@ Added
* Added action clip to all :class:`omni.isaac.lab.envs.mdp.actions`. * Added action clip to all :class:`omni.isaac.lab.envs.mdp.actions`.
0.27.32 (2024-12-14) 0.27.33 (2024-12-14)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Changed Changed
...@@ -181,7 +181,7 @@ Changed ...@@ -181,7 +181,7 @@ Changed
* Added check for error below threshold in state machines to ensure the state has been reached. * Added check for error below threshold in state machines to ensure the state has been reached.
0.27.31 (2024-12-13) 0.27.32 (2024-12-13)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Fixed Fixed
...@@ -190,7 +190,7 @@ Fixed ...@@ -190,7 +190,7 @@ Fixed
* Fixed the shape of ``quat_w`` in the ``apply_actions`` method of :attr:`~omni.isaac.lab.env.mdp.NonHolonomicAction` (previously (N,B,4), now (N,4) since the number of root bodies B is required to be 1). Previously ``apply_actions`` errored because ``euler_xyz_from_quat`` requires inputs of shape (N,4). * Fixed the shape of ``quat_w`` in the ``apply_actions`` method of :attr:`~omni.isaac.lab.env.mdp.NonHolonomicAction` (previously (N,B,4), now (N,4) since the number of root bodies B is required to be 1). Previously ``apply_actions`` errored because ``euler_xyz_from_quat`` requires inputs of shape (N,4).
0.27.30 (2024-12-11) 0.27.31 (2024-12-11)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Changed Changed
...@@ -201,7 +201,7 @@ Changed ...@@ -201,7 +201,7 @@ Changed
* Improved documentation to clarify the usage of the :meth:`~omni.isaac.lab.envs.mdp.rewards.base_height_l2` function in both flat and rough terrain settings. * Improved documentation to clarify the usage of the :meth:`~omni.isaac.lab.envs.mdp.rewards.base_height_l2` function in both flat and rough terrain settings.
0.27.29 (2024-12-11) 0.27.30 (2024-12-11)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Fixed Fixed
...@@ -211,7 +211,7 @@ Fixed ...@@ -211,7 +211,7 @@ Fixed
Jacobian computed w.r.t. to the root frame of the robot. This helps ensure that root pose does not affect the tracking. Jacobian computed w.r.t. to the root frame of the robot. This helps ensure that root pose does not affect the tracking.
0.27.28 (2024-12-09) 0.27.29 (2024-12-09)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Fixed Fixed
...@@ -221,7 +221,7 @@ Fixed ...@@ -221,7 +221,7 @@ Fixed
return only the states of the specified environment IDs. return only the states of the specified environment IDs.
0.27.27 (2024-12-06) 0.27.28 (2024-12-06)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Fixed Fixed
...@@ -231,7 +231,7 @@ Fixed ...@@ -231,7 +231,7 @@ Fixed
:attr:`~omni.isaac.lab.assets.Articulation.root_physx_view` level. :attr:`~omni.isaac.lab.assets.Articulation.root_physx_view` level.
0.27.26 (2024-12-06) 0.27.27 (2024-12-06)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Changed Changed
...@@ -242,7 +242,7 @@ Changed ...@@ -242,7 +242,7 @@ Changed
disabled. Using an articulation root for rigid bodies is not needed and decreases overall performance. disabled. Using an articulation root for rigid bodies is not needed and decreases overall performance.
0.27.25 (2024-12-06) 0.27.26 (2024-12-06)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Fixed Fixed
...@@ -252,7 +252,7 @@ Fixed ...@@ -252,7 +252,7 @@ Fixed
Earlier, the projection names used snakecase instead of camelcase. Earlier, the projection names used snakecase instead of camelcase.
0.27.24 (2024-12-06) 0.27.25 (2024-12-06)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Added Added
...@@ -270,7 +270,7 @@ Changed ...@@ -270,7 +270,7 @@ Changed
:class:`~omni.isaac.lab.sensors.Camera` did not clip them and had a different behavior for both types. :class:`~omni.isaac.lab.sensors.Camera` did not clip them and had a different behavior for both types.
0.27.23 (2024-12-05) 0.27.24 (2024-12-05)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Fixed Fixed
...@@ -279,6 +279,16 @@ Fixed ...@@ -279,6 +279,16 @@ Fixed
* Fixed the condition in ``isaaclab.sh`` that checks whether ``pre-commit`` is installed before attempting installation. * Fixed the condition in ``isaaclab.sh`` that checks whether ``pre-commit`` is installed before attempting installation.
0.27.23 (2024-12-04)
~~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Added the attributes :attr:`~omni.isaac.lab.envs.DirectRLEnvCfg.wait_for_textures` and :attr:`~omni.isaac.lab.envs.ManagerBasedEnvCfg.wait_for_textures`
to enable assets loading check during :class:`~omni.isaac.lab.DirectRLEnv` and :class:`~omni.isaac.lab.ManagerBasedEnv` reset method when rtx sensors are added to the scene.
0.27.22 (2024-12-04) 0.27.22 (2024-12-04)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
......
...@@ -20,6 +20,7 @@ from typing import Any, ClassVar ...@@ -20,6 +20,7 @@ from typing import Any, ClassVar
import isaacsim.core.utils.torch as torch_utils import isaacsim.core.utils.torch as torch_utils
import omni.kit.app import omni.kit.app
import omni.log import omni.log
from isaacsim.core.simulation_manager import SimulationManager
from isaacsim.core.version import get_version from isaacsim.core.version import get_version
from omni.isaac.lab.managers import EventManager from omni.isaac.lab.managers import EventManager
...@@ -281,6 +282,10 @@ class DirectRLEnv(gym.Env): ...@@ -281,6 +282,10 @@ class DirectRLEnv(gym.Env):
if self.sim.has_rtx_sensors() and self.cfg.rerender_on_reset: if self.sim.has_rtx_sensors() and self.cfg.rerender_on_reset:
self.sim.render() self.sim.render()
if self.cfg.wait_for_textures and self.sim.has_rtx_sensors():
while SimulationManager.assets_loading():
self.sim.render()
# return observations # return observations
return self._get_observations(), self.extras return self._get_observations(), self.extras
......
...@@ -222,3 +222,6 @@ class DirectRLEnvCfg: ...@@ -222,3 +222,6 @@ class DirectRLEnvCfg:
step will be performed after each time an environment is reset. step will be performed after each time an environment is reset.
""" """
wait_for_textures: bool = True
"""True to wait for assets to be loaded completely, False otherwise. Defaults to True."""
...@@ -10,6 +10,7 @@ from typing import Any ...@@ -10,6 +10,7 @@ from typing import Any
import isaacsim.core.utils.torch as torch_utils import isaacsim.core.utils.torch as torch_utils
import omni.log import omni.log
from isaacsim.core.simulation_manager import SimulationManager
from omni.isaac.lab.managers import ActionManager, EventManager, ObservationManager, RecorderManager from omni.isaac.lab.managers import ActionManager, EventManager, ObservationManager, RecorderManager
from omni.isaac.lab.scene import InteractiveScene from omni.isaac.lab.scene import InteractiveScene
...@@ -294,6 +295,10 @@ class ManagerBasedEnv: ...@@ -294,6 +295,10 @@ class ManagerBasedEnv:
# compute observations # compute observations
self.obs_buf = self.observation_manager.compute() self.obs_buf = self.observation_manager.compute()
if self.cfg.wait_for_textures and self.sim.has_rtx_sensors():
while SimulationManager.assets_loading():
self.sim.render()
# return observations # return observations
return self.obs_buf, self.extras return self.obs_buf, self.extras
......
...@@ -114,3 +114,6 @@ class ManagerBasedEnvCfg: ...@@ -114,3 +114,6 @@ class ManagerBasedEnvCfg:
step will be performed after each time an environment is reset. step will be performed after each time an environment is reset.
""" """
wait_for_textures: bool = True
"""True to wait for assets to be loaded completely, False otherwise. Defaults to True."""
...@@ -88,6 +88,8 @@ class TestEnvironments(unittest.TestCase): ...@@ -88,6 +88,8 @@ class TestEnvironments(unittest.TestCase):
"""Run random actions and check environments returned signals are valid.""" """Run random actions and check environments returned signals are valid."""
# create a new stage # create a new stage
omni.usd.get_context().new_stage() omni.usd.get_context().new_stage()
# reset the rtx sensors carb setting to False
carb.settings.get_settings().set_bool("/isaaclab/render/rtx_sensors", False)
try: try:
# parse configuration # parse configuration
env_cfg: ManagerBasedRLEnvCfg = parse_env_cfg(task_name, device=device, num_envs=num_envs) env_cfg: ManagerBasedRLEnvCfg = parse_env_cfg(task_name, device=device, num_envs=num_envs)
......
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