Skip to content

Commit 7a489ad

Browse files
authored
Adds available RL library configs on error message if entry point is invalid (#2713)
# Description This PR show the available RL library (and algorithms) configs on error message when an entry point key is not available for a given task. Example: for `./isaaclab.sh -p scripts/reinforcement_learning/sb3/train.py --task=Isaac-Cart-Double-Pendulum-Direct-v0 --headless` Before: ``` ValueError: Could not find configuration for the environment: 'Isaac-Cart-Double-Pendulum-Direct-v0'. Please check that the gym registry has the entry point: 'sb3_cfg_entry_point'. ``` After ``` ValueError: Could not find configuration for the environment: 'Isaac-Cart-Double-Pendulum-Direct-v0'. Please check that the gym registry has the entry point: 'sb3_cfg_entry_point'. Existing RL library (and algorithms) config entry points: |-- rl_games: PPO |-- skrl: PPO, IPPO, MAPPO ``` ## 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 - [ ] 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 <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task -->
1 parent 924e1fe commit 7a489ad

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

source/isaaclab_tasks/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.10.33"
4+
version = "0.10.34"
55

66
# Description
77
title = "Isaac Lab Environments"

source/isaaclab_tasks/docs/CHANGELOG.rst

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

4+
0.10.34 (2025-06-16)
5+
~~~~~~~~~~~~~~~~~~~~
6+
7+
Changed
8+
^^^^^^^
9+
10+
* Show available RL library configs on error message when an entry point key is not available for a given task.
11+
12+
413
0.10.33 (2025-05-15)
514
~~~~~~~~~~~~~~~~~~~~
615

source/isaaclab_tasks/isaaclab_tasks/utils/parse_cfg.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"""Sub-module with utilities for parsing and loading configurations."""
77

8-
8+
import collections
99
import gymnasium as gym
1010
import importlib
1111
import inspect
@@ -55,9 +55,27 @@ def load_cfg_from_registry(task_name: str, entry_point_key: str) -> dict | objec
5555
cfg_entry_point = gym.spec(task_name.split(":")[-1]).kwargs.get(entry_point_key)
5656
# check if entry point exists
5757
if cfg_entry_point is None:
58+
# get existing agents and algorithms
59+
agents = collections.defaultdict(list)
60+
for k in gym.spec(task_name.split(":")[-1]).kwargs:
61+
if k.endswith("_cfg_entry_point") and k != "env_cfg_entry_point":
62+
spec = (
63+
k.replace("_cfg_entry_point", "")
64+
.replace("rl_games", "rl-games")
65+
.replace("rsl_rl", "rsl-rl")
66+
.split("_")
67+
)
68+
agent = spec[0].replace("-", "_")
69+
algorithms = [item.upper() for item in (spec[1:] if len(spec) > 1 else ["PPO"])]
70+
agents[agent].extend(algorithms)
71+
msg = "\nExisting RL library (and algorithms) config entry points: "
72+
for agent, algorithms in agents.items():
73+
msg += f"\n |-- {agent}: {', '.join(algorithms)}"
74+
# raise error
5875
raise ValueError(
5976
f"Could not find configuration for the environment: '{task_name}'."
60-
f" Please check that the gym registry has the entry point: '{entry_point_key}'."
77+
f"\nPlease check that the gym registry has the entry point: '{entry_point_key}'."
78+
f"{msg if agents else ''}"
6179
)
6280
# parse the default config file
6381
if isinstance(cfg_entry_point, str) and cfg_entry_point.endswith(".yaml"):

0 commit comments

Comments
 (0)