forked from isaac-sim/IsaacLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes minor bugs in RayCasterCamera and BaseEnvWindow (isaac-sim#1308)
# Description * Fixes a bug in RayCasterCamera's print function that was accessing `RayCaster.meshes` instead of `self.meshes` * Fixes a bug in BaseEnvWindow that was trying to access attributes from undefined configs when building UI elements for action and command terms ## 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 `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] 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 - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
- Loading branch information
1 parent
6b826b1
commit e971d64
Showing
11 changed files
with
211 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
source/extensions/omni.isaac.lab/test/envs/test_manager_based_rl_env_ui.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Copyright (c) 2022-2024, The Isaac Lab Project Developers. | ||
# All rights reserved. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
# ignore private usage of variables warning | ||
# pyright: reportPrivateUsage=none | ||
|
||
from __future__ import annotations | ||
|
||
"""Launch Isaac Sim Simulator first.""" | ||
|
||
from omni.isaac.lab.app import AppLauncher, run_tests | ||
|
||
# Can set this to False to see the GUI for debugging | ||
HEADLESS = True | ||
|
||
# launch omniverse app | ||
app_launcher = AppLauncher(headless=HEADLESS, enable_cameras=True) | ||
simulation_app = app_launcher.app | ||
|
||
"""Rest everything follows.""" | ||
|
||
import unittest | ||
|
||
import carb | ||
import omni.usd | ||
from omni.isaac.core.utils.extensions import enable_extension | ||
|
||
from omni.isaac.lab.envs import ManagerBasedRLEnv, ManagerBasedRLEnvCfg | ||
from omni.isaac.lab.envs.ui import ManagerBasedRLEnvWindow | ||
from omni.isaac.lab.scene import InteractiveSceneCfg | ||
from omni.isaac.lab.utils import configclass | ||
|
||
enable_extension("omni.isaac.ui") | ||
|
||
|
||
@configclass | ||
class EmptyManagerCfg: | ||
"""Empty manager specifications for the environment.""" | ||
|
||
pass | ||
|
||
|
||
@configclass | ||
class EmptySceneCfg(InteractiveSceneCfg): | ||
"""Configuration for an empty scene.""" | ||
|
||
pass | ||
|
||
|
||
def get_empty_base_env_cfg(device: str = "cuda:0", num_envs: int = 1, env_spacing: float = 1.0): | ||
"""Generate base environment config based on device""" | ||
|
||
@configclass | ||
class EmptyEnvCfg(ManagerBasedRLEnvCfg): | ||
"""Configuration for the empty test environment.""" | ||
|
||
# Scene settings | ||
scene: EmptySceneCfg = EmptySceneCfg(num_envs=num_envs, env_spacing=env_spacing) | ||
# Basic settings | ||
actions: EmptyManagerCfg = EmptyManagerCfg() | ||
observations: EmptyManagerCfg = EmptyManagerCfg() | ||
rewards: EmptyManagerCfg = EmptyManagerCfg() | ||
terminations: EmptyManagerCfg = EmptyManagerCfg() | ||
# Define window | ||
ui_window_class_type: ManagerBasedRLEnvWindow = ManagerBasedRLEnvWindow | ||
|
||
def __post_init__(self): | ||
"""Post initialization.""" | ||
# step settings | ||
self.decimation = 4 # env step every 4 sim steps: 200Hz / 4 = 50Hz | ||
# simulation settings | ||
self.sim.dt = 0.005 # sim step every 5ms: 200Hz | ||
self.sim.render_interval = self.decimation # render every 4 sim steps | ||
# pass device down from test | ||
self.sim.device = device | ||
# episode length | ||
self.episode_length_s = 5.0 | ||
|
||
return EmptyEnvCfg() | ||
|
||
|
||
class TestManagerBasedRLEnvUI(unittest.TestCase): | ||
"""Test for manager-based RL env class UI""" | ||
|
||
""" | ||
Tests | ||
""" | ||
|
||
def test_ui_window(self): | ||
device = "cuda:0" | ||
# override sim setting to enable UI | ||
carb.settings.get_settings().set_bool("/app/window/enabled", True) | ||
# create a new stage | ||
omni.usd.get_context().new_stage() | ||
# create environment | ||
env = ManagerBasedRLEnv(cfg=get_empty_base_env_cfg(device=device)) | ||
# close the environment | ||
env.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
run_tests() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters