Skip to content

Commit 4207530

Browse files
committed
fix: sync to IsaacLab-9d17b52
1 parent a7ac2f9 commit 4207530

20 files changed

Lines changed: 94 additions & 100 deletions

File tree

.vscode/tools/setup_vscode.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Copyright (c) 2024-2025, The Isaac Lab Project Developers.
1+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
22
# All rights reserved.
33
#
4-
# SPDX-License-Identifier: Apache-2.0
4+
# SPDX-License-Identifier: BSD-3-Clause
55

66
"""This script sets up the vs-code settings for the Isaac Lab project.
77
@@ -49,11 +49,11 @@
4949
# check if the isaac-sim directory exists
5050
if not os.path.exists(isaacsim_dir):
5151
raise FileNotFoundError(
52-
f"Could not find the isaac-sim directory: {isaacsim_dir}. There are two possible reasons for this:"
53-
"\n\t1. The Isaac Sim directory does not exist as provided CLI path."
54-
"\n\t2. The script could import the 'isaacsim' package. This could be due to the 'isaacsim' package not being "
55-
"installed in the Python environment.\n"
56-
"\nPlease make sure that the Isaac Sim directory exists or that the 'isaacsim' package is installed."
52+
f"Could not find the isaac-sim directory: {isaacsim_dir}. There are two possible reasons for this:\n\t1. The"
53+
" Isaac Sim directory does not exist as provided CLI path.\n\t2. The script couldn't import the 'isaacsim'"
54+
" package. This could be due to the 'isaacsim' package not being installed in the Python"
55+
" environment.\n\nPlease make sure that the Isaac Sim directory exists or that the 'isaacsim' package is"
56+
" installed."
5757
)
5858

5959
ISAACSIM_DIR = isaacsim_dir

scripts/reinforcement_learning/rsl_rl/cli_args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright (c) 2024-2025 Ziqi Fan
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Copyright (c) 2024-2025, The Isaac Lab Project Developers.
4+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
55
# All rights reserved.
66
#
7-
# SPDX-License-Identifier: Apache-2.0
7+
# SPDX-License-Identifier: BSD-3-Clause
88

99
from __future__ import annotations
1010

scripts/reinforcement_learning/rsl_rl/play.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
# Copyright (c) 2024-2025 Ziqi Fan
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Copyright (c) 2024-2025, The Isaac Lab Project Developers.
4+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
55
# All rights reserved.
66
#
7-
# SPDX-License-Identifier: Apache-2.0
7+
# SPDX-License-Identifier: BSD-3-Clause
88

99
"""Script to play a checkpoint if an RL agent from RSL-RL."""
1010

1111
"""Launch Isaac Sim Simulator first."""
1212

1313
import argparse
14-
import os
1514
import sys
1615

1716
from isaaclab.app import AppLauncher
1817

1918
# local imports
20-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
2119
import cli_args # isort: skip
22-
from rl_utils import camera_follow
2320

2421
# add argparse arguments
2522
parser = argparse.ArgumentParser(description="Train an RL agent with RSL-RL.")
@@ -61,6 +58,7 @@
6158
"""Rest everything follows."""
6259

6360
import gymnasium as gym
61+
import os
6462
import time
6563
import torch
6664

@@ -78,11 +76,17 @@
7876
from isaaclab.utils.assets import retrieve_file_path
7977
from isaaclab.utils.dict import print_dict
8078
from isaaclab.utils.pretrained_checkpoint import get_published_pretrained_checkpoint
79+
8180
from isaaclab_rl.rsl_rl import RslRlBaseRunnerCfg, RslRlVecEnvWrapper, export_policy_as_jit, export_policy_as_onnx
81+
82+
import robot_lab.tasks # noqa: F401 # isort: skip
8283
from isaaclab_tasks.utils import get_checkpoint_path
8384
from isaaclab_tasks.utils.hydra import hydra_task_config
8485

85-
import robot_lab.tasks # noqa: F401
86+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
87+
from rl_utils import camera_follow
88+
89+
# PLACEHOLDER: Extension template (do not remove this comment)
8690

8791

8892
@hydra_task_config(args_cli.task, args_cli.agent)

scripts/reinforcement_learning/rsl_rl/play_cs.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
# Copyright (c) 2024-2025 Ziqi Fan
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Copyright (c) 2024-2025, The Isaac Lab Project Developers.
4+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
55
# All rights reserved.
66
#
7-
# SPDX-License-Identifier: Apache-2.0
7+
# SPDX-License-Identifier: BSD-3-Clause
88

99
"""Script to play a checkpoint if an RL agent from RSL-RL."""
1010

1111
"""Launch Isaac Sim Simulator first."""
1212

1313
import argparse
14-
import os
1514
import sys
1615

1716
from isaaclab.app import AppLauncher
1817

1918
# local imports
20-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
2119
import cli_args # isort: skip
22-
from rl_utils import camera_follow
2320

2421
# add argparse arguments
2522
parser = argparse.ArgumentParser(description="Train an RL agent with RSL-RL.")
@@ -62,6 +59,7 @@
6259
"""Rest everything follows."""
6360

6461
import gymnasium as gym
62+
import os
6563
import time
6664
import torch
6765

@@ -80,11 +78,17 @@
8078
from isaaclab.utils.assets import retrieve_file_path
8179
from isaaclab.utils.dict import print_dict
8280
from isaaclab.utils.pretrained_checkpoint import get_published_pretrained_checkpoint
81+
8382
from isaaclab_rl.rsl_rl import RslRlBaseRunnerCfg, RslRlVecEnvWrapper, export_policy_as_jit, export_policy_as_onnx
83+
84+
import robot_lab.tasks # noqa: F401 # isort: skip
8485
from isaaclab_tasks.utils import get_checkpoint_path
8586
from isaaclab_tasks.utils.hydra import hydra_task_config
8687

87-
import robot_lab.tasks # noqa: F401
88+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
89+
from rl_utils import camera_follow
90+
91+
# PLACEHOLDER: Extension template (do not remove this comment)
8892

8993

9094
@hydra_task_config(args_cli.task, args_cli.agent)

scripts/reinforcement_learning/rsl_rl/train.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# Copyright (c) 2024-2025 Ziqi Fan
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Copyright (c) 2024-2025, The Isaac Lab Project Developers.
4+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
55
# All rights reserved.
66
#
7-
# SPDX-License-Identifier: Apache-2.0
7+
# SPDX-License-Identifier: BSD-3-Clause
88

99
"""Script to train RL agent with RSL-RL."""
1010

1111
"""Launch Isaac Sim Simulator first."""
1212

1313
import argparse
14-
import os
1514
import sys
1615

1716
from isaaclab.app import AppLauncher
@@ -35,6 +34,9 @@
3534
"--distributed", action="store_true", default=False, help="Run training with multiple GPUs or nodes."
3635
)
3736
parser.add_argument("--export_io_descriptors", action="store_true", default=False, help="Export IO descriptors.")
37+
parser.add_argument(
38+
"--ray-proc-id", "-rid", type=int, default=None, help="Automatically configured by Ray integration, otherwise None."
39+
)
3840
# append RSL-RL cli arguments
3941
cli_args.add_rsl_rl_args(parser)
4042
# append AppLauncher cli args
@@ -55,14 +57,18 @@
5557
"""Check for minimum supported RSL-RL version."""
5658

5759
import importlib.metadata as metadata
60+
import platform
5861

5962
from packaging import version
6063

6164
# check minimum supported rsl-rl version
6265
RSL_RL_VERSION = "3.0.1"
6366
installed_version = metadata.version("rsl-rl-lib")
6467
if version.parse(installed_version) < version.parse(RSL_RL_VERSION):
65-
cmd = [r"python", "-m", "pip", "install", f"rsl-rl-lib=={RSL_RL_VERSION}"]
68+
if platform.system() == "Windows":
69+
cmd = [r".\isaaclab.bat", "-p", "-m", "pip", "install", f"rsl-rl-lib=={RSL_RL_VERSION}"]
70+
else:
71+
cmd = ["./isaaclab.sh", "-p", "-m", "pip", "install", f"rsl-rl-lib=={RSL_RL_VERSION}"]
6672
print(
6773
f"Please install the correct version of RSL-RL.\nExisting version is: '{installed_version}'"
6874
f" and required version is: '{RSL_RL_VERSION}'.\nTo install the correct version, run:"
@@ -73,10 +79,12 @@
7379
"""Rest everything follows."""
7480

7581
import gymnasium as gym
82+
import logging
83+
import os
84+
import time
7685
import torch
7786
from datetime import datetime
7887

79-
import omni
8088
from rsl_rl.runners import DistillationRunner, OnPolicyRunner
8189

8290
from isaaclab.envs import (
@@ -88,11 +96,17 @@
8896
)
8997
from isaaclab.utils.dict import print_dict
9098
from isaaclab.utils.io import dump_yaml
99+
91100
from isaaclab_rl.rsl_rl import RslRlBaseRunnerCfg, RslRlVecEnvWrapper
101+
102+
import robot_lab.tasks # noqa: F401 # isort: skip
92103
from isaaclab_tasks.utils import get_checkpoint_path
93104
from isaaclab_tasks.utils.hydra import hydra_task_config
94105

95-
import robot_lab.tasks # noqa: F401
106+
# import logger
107+
logger = logging.getLogger(__name__)
108+
109+
# PLACEHOLDER: Extension template (do not remove this comment)
96110

97111
torch.backends.cuda.matmul.allow_tf32 = True
98112
torch.backends.cudnn.allow_tf32 = True
@@ -147,7 +161,7 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
147161
if isinstance(env_cfg, ManagerBasedRLEnvCfg):
148162
env_cfg.export_io_descriptors = args_cli.export_io_descriptors
149163
else:
150-
omni.log.warn(
164+
logger.warning(
151165
"IO descriptors are only supported for manager based RL environments. No IO descriptors will be exported."
152166
)
153167

@@ -177,6 +191,8 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
177191
print_dict(video_kwargs, nesting=4)
178192
env = gym.wrappers.RecordVideo(env, **video_kwargs)
179193

194+
start_time = time.time()
195+
180196
# wrap around environment for rsl-rl
181197
env = RslRlVecEnvWrapper(env, clip_actions=agent_cfg.clip_actions)
182198

@@ -202,6 +218,8 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
202218
# run training
203219
runner.learn(num_learning_iterations=agent_cfg.max_iterations, init_at_random_ep_len=True)
204220

221+
print(f"Training time: {round(time.time() - start_time, 2)} seconds")
222+
205223
# close the simulator
206224
env.close()
207225

scripts/reinforcement_learning/skrl/play.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright (c) 2024-2025 Ziqi Fan
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Copyright (c) 2024-2025, The Isaac Lab Project Developers.
4+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
55
# All rights reserved.
66
#
7-
# SPDX-License-Identifier: Apache-2.0
7+
# SPDX-License-Identifier: BSD-3-Clause
88

99
"""
1010
Script to play a checkpoint of an RL agent from skrl.
@@ -71,7 +71,6 @@
7171

7272
# clear out sys.argv for Hydra
7373
sys.argv = [sys.argv[0]] + hydra_args
74-
7574
# launch omniverse app
7675
app_launcher = AppLauncher(args_cli)
7776
simulation_app = app_launcher.app
@@ -88,7 +87,7 @@
8887
from packaging import version
8988

9089
# check for minimum supported skrl version
91-
SKRL_VERSION = "1.4.2"
90+
SKRL_VERSION = "1.4.3"
9291
if version.parse(skrl.__version__) < version.parse(SKRL_VERSION):
9392
skrl.logger.error(
9493
f"Unsupported skrl version: {skrl.__version__}. "
@@ -110,11 +109,14 @@
110109
)
111110
from isaaclab.utils.dict import print_dict
112111
from isaaclab.utils.pretrained_checkpoint import get_published_pretrained_checkpoint
112+
113113
from isaaclab_rl.skrl import SkrlVecEnvWrapper
114+
115+
import robot_lab.tasks # noqa: F401 # isort: skip
114116
from isaaclab_tasks.utils import get_checkpoint_path
115117
from isaaclab_tasks.utils.hydra import hydra_task_config
116118

117-
import robot_lab # noqa: F401
119+
# PLACEHOLDER: Extension template (do not remove this comment)
118120

119121
# config shortcuts
120122
if args_cli.agent is None:

scripts/reinforcement_learning/skrl/train.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright (c) 2024-2025 Ziqi Fan
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Copyright (c) 2024-2025, The Isaac Lab Project Developers.
4+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
55
# All rights reserved.
66
#
7-
# SPDX-License-Identifier: Apache-2.0
7+
# SPDX-License-Identifier: BSD-3-Clause
88

99
"""
1010
Script to train RL agent with skrl.
@@ -57,7 +57,9 @@
5757
choices=["AMP", "PPO", "IPPO", "MAPPO"],
5858
help="The RL algorithm used for training the skrl agent.",
5959
)
60-
60+
parser.add_argument(
61+
"--ray-proc-id", "-rid", type=int, default=None, help="Automatically configured by Ray integration, otherwise None."
62+
)
6163
# append AppLauncher cli args
6264
AppLauncher.add_app_launcher_args(parser)
6365
# parse the arguments
@@ -76,11 +78,12 @@
7678
"""Rest everything follows."""
7779

7880
import gymnasium as gym
81+
import logging
7982
import os
8083
import random
84+
import time
8185
from datetime import datetime
8286

83-
import omni
8487
import skrl
8588
from packaging import version
8689

@@ -108,10 +111,16 @@
108111
from isaaclab.utils.assets import retrieve_file_path
109112
from isaaclab.utils.dict import print_dict
110113
from isaaclab.utils.io import dump_yaml
114+
111115
from isaaclab_rl.skrl import SkrlVecEnvWrapper
116+
117+
import robot_lab.tasks # noqa: F401 # isort: skip
112118
from isaaclab_tasks.utils.hydra import hydra_task_config
113119

114-
import robot_lab # noqa: F401
120+
# import logger
121+
logger = logging.getLogger(__name__)
122+
123+
# PLACEHOLDER: Extension template (do not remove this comment)
115124

116125
# config shortcuts
117126
if args_cli.agent is None:
@@ -183,7 +192,7 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
183192
if isinstance(env_cfg, ManagerBasedRLEnvCfg):
184193
env_cfg.export_io_descriptors = args_cli.export_io_descriptors
185194
else:
186-
omni.log.warn(
195+
logger.warning(
187196
"IO descriptors are only supported for manager based RL environments. No IO descriptors will be exported."
188197
)
189198

@@ -209,6 +218,8 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
209218
print_dict(video_kwargs, nesting=4)
210219
env = gym.wrappers.RecordVideo(env, **video_kwargs)
211220

221+
start_time = time.time()
222+
212223
# wrap around environment for skrl
213224
env = SkrlVecEnvWrapper(env, ml_framework=args_cli.ml_framework) # same as: `wrap_env(env, wrapper="auto")`
214225

@@ -224,6 +235,8 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
224235
# run training
225236
runner.run()
226237

238+
print(f"Training time: {round(time.time() - start_time, 2)} seconds")
239+
227240
# close the simulator
228241
env.close()
229242

0 commit comments

Comments
 (0)