Skip to content

Commit bd4cd3b

Browse files
author
David Hoeller
authored
Adds a validity check for configclasses (#1214)
# Description Added a mechanism to check for the validity of a configclass object. A configclass object is valid if it contains no MISSING attributes. ## 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 `./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
1 parent 6bc4d0a commit bd4cd3b

File tree

53 files changed

+414
-222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+414
-222
lines changed

.github/workflows/docs.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,29 @@ name: Build & deploy docs
22

33
on:
44
push:
5-
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
69

710
jobs:
11+
check-secrets:
12+
name: Check secrets
13+
runs-on: ubuntu-latest
14+
outputs:
15+
trigger-deploy: ${{ steps.trigger-deploy.outputs.defined }}
16+
steps:
17+
- id: trigger-deploy
18+
env:
19+
REPO_NAME: ${{ secrets.REPO_NAME }}
20+
BRANCH_REF: ${{ secrets.BRANCH_REF }}
21+
if: "${{ github.repository == env.REPO_NAME && github.ref == env.BRANCH_REF }}"
22+
run: echo "defined=true" >> "$GITHUB_OUTPUT"
23+
824
build-docs:
925
name: Build Docs
1026
runs-on: ubuntu-latest
27+
needs: [check-secrets]
1128

1229
steps:
1330
- name: Checkout code
@@ -24,8 +41,8 @@ jobs:
2441
run: pip install -r requirements.txt
2542

2643
- name: Check branch docs building
27-
if: ${{ github.event_name == 'pull_request' }}
2844
working-directory: ./docs
45+
if: needs.check-secrets.outputs.trigger-deploy != 'true'
2946
run: make current-docs
3047

3148
- name: Generate multi-version docs
@@ -40,19 +57,6 @@ jobs:
4057
name: docs-html
4158
path: ./docs/_build
4259

43-
check-secrets:
44-
name: Check secrets
45-
runs-on: ubuntu-latest
46-
outputs:
47-
trigger-deploy: ${{ steps.trigger-deploy.outputs.defined }}
48-
steps:
49-
- id: trigger-deploy
50-
env:
51-
REPO_NAME: ${{ secrets.REPO_NAME }}
52-
BRANCH_REF: ${{ secrets.BRANCH_REF }}
53-
if: "${{ github.repository == env.REPO_NAME && github.ref == env.BRANCH_REF }}"
54-
run: echo "defined=true" >> "$GITHUB_OUTPUT"
55-
5660
deploy-docs:
5761
name: Deploy Docs
5862
runs-on: ubuntu-latest

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262

263263
def skip_member(app, what, name, obj, skip, options):
264264
# List the names of the functions you want to skip here
265-
exclusions = ["from_dict", "to_dict", "replace", "copy", "__post_init__"]
265+
exclusions = ["from_dict", "to_dict", "replace", "copy", "validate", "__post_init__"]
266266
if name in exclusions:
267267
return True
268268
return None

docs/source/tutorials/03_envs/create_manager_rl_env.rst

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ For this tutorial, we use the cartpole environment defined in ``omni.isaac.lab_t
3636

3737
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
3838
:language: python
39-
:emphasize-lines: 63-68, 124-149, 152-162, 165-169, 187-192
39+
:emphasize-lines: 117-141, 144-154, 172-174
4040
:linenos:
4141

4242
The script for running the environment ``run_cartpole_rl_env.py`` is present in the
@@ -117,13 +117,8 @@ For various goal-conditioned tasks, it is useful to specify the goals or command
117117
handled through the :class:`managers.CommandManager`. The command manager handles resampling and updating the
118118
commands at each step. It can also be used to provide the commands as an observation to the agent.
119119

120-
For this simple task, we do not use any commands. This is specified by using a command term with the
121-
:class:`envs.mdp.NullCommandCfg` configuration. However, you can see an example of command definitions in the
122-
locomotion or manipulation tasks.
123-
124-
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
125-
:language: python
126-
:pyobject: CommandsCfg
120+
For this simple task, we do not use any commands. Hence, we leave this attribute as its default value, which is None.
121+
You can see an example of how to define a command manager in the other locomotion or manipulation tasks.
127122

128123
Defining curriculum
129124
-------------------
@@ -134,11 +129,6 @@ we provide a :class:`managers.CurriculumManager` class that can be used to defin
134129

135130
In this tutorial we don't implement a curriculum for simplicity, but you can see an example of a
136131
curriculum definition in the other locomotion or manipulation tasks.
137-
We use a simple pass-through curriculum to define a curriculum manager that does not modify the environment.
138-
139-
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
140-
:language: python
141-
:pyobject: CurriculumCfg
142132

143133
Tying it all together
144134
---------------------

source/extensions/omni.isaac.lab/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
# Note: Semantic Versioning is used: https://semver.org/
4-
version = "0.26.0"
4+
version = "0.27.0"
55

66
# Description
77
title = "Isaac Lab framework for Robot Learning"

source/extensions/omni.isaac.lab/docs/CHANGELOG.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
Changelog
22
---------
33

4+
0.27.0 (2024-10-14)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
Added
8+
^^^^^
9+
10+
* Added a method to :class:`~omni.isaac.lab.utils.configclass` to check for attributes with values of
11+
type ``MISSING``. This is useful when the user wants to check if a certain attribute has been set or not.
12+
* Added the configuration validation check inside the constructor of all the core classes
13+
(such as sensor base, asset base, scene and environment base classes).
14+
* Added support for environments without commands by leaving the attribute
15+
:attr:`omni.isaac.lab.envs.ManagerBasedRLEnvCfg.commands` as None. Before, this had to be done using
16+
the class :class:`omni.isaac.lab.command_generators.NullCommandGenerator`.
17+
* Moved the ``meshes`` attribute in the :class:`omni.isaac.lab.sensors.RayCaster` class from class variable to instance variable.
18+
This prevents the meshes to overwrite each other.
19+
20+
421
0.26.0 (2024-10-16)
522
~~~~~~~~~~~~~~~~~~~
623

source/extensions/omni.isaac.lab/omni/isaac/lab/assets/asset_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def __init__(self, cfg: AssetBaseCfg):
5959
Raises:
6060
RuntimeError: If no prims found at input prim path or prim path expression.
6161
"""
62+
# check that the config is valid
63+
cfg.validate()
6264
# store inputs
6365
self.cfg = cfg
6466
# flag for whether the asset is initialized

source/extensions/omni.isaac.lab/omni/isaac/lab/assets/asset_base_cfg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ class InitialStateCfg:
3939
Defaults to (1.0, 0.0, 0.0, 0.0).
4040
"""
4141

42-
class_type: type[AssetBase] = MISSING
43-
"""The associated asset class.
42+
class_type: type[AssetBase] = None
43+
"""The associated asset class. Defaults to None, which means that the asset will be spawned
44+
but cannot be interacted with via the asset class.
4445
4546
The class should inherit from :class:`omni.isaac.lab.assets.asset_base.AssetBase`.
4647
"""

source/extensions/omni.isaac.lab/omni/isaac/lab/envs/direct_marl_env.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def __init__(self, cfg: DirectMARLEnvCfg, render_mode: str | None = None, **kwar
7474
RuntimeError: If a simulation context already exists. The environment must always create one
7575
since it configures the simulation context and controls the simulation.
7676
"""
77+
# check that the config is valid
78+
cfg.validate()
7779
# store inputs to class
7880
self.cfg = cfg
7981
# store the render mode

source/extensions/omni.isaac.lab/omni/isaac/lab/envs/direct_rl_env.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def __init__(self, cfg: DirectRLEnvCfg, render_mode: str | None = None, **kwargs
7979
RuntimeError: If a simulation context already exists. The environment must always create one
8080
since it configures the simulation context and controls the simulation.
8181
"""
82+
# check that the config is valid
83+
cfg.validate()
8284
# store inputs to class
8385
self.cfg = cfg
8486
# store the render mode

source/extensions/omni.isaac.lab/omni/isaac/lab/envs/direct_rl_env_cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class DirectRLEnvCfg:
9898
Please refer to the :class:`omni.isaac.lab.scene.InteractiveSceneCfg` class for more details.
9999
"""
100100

101-
events: object = None
101+
events: object | None = None
102102
"""Event settings. Defaults to None, in which case no events are applied through the event manager.
103103
104104
Please refer to the :class:`omni.isaac.lab.managers.EventManager` class for more details.

0 commit comments

Comments
 (0)