pow-cli 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pow_cli/__init__.py ADDED
File without changes
@@ -0,0 +1,21 @@
1
+ [sim]
2
+ version = "5.1.0"
3
+ # add paths to additional extension folders
4
+ ext_folder = []
5
+ # Path to Isaac Sim assets, leave empty to use from default nvidia cloud
6
+ # if path is provided, it will use the local assets path
7
+ isaacsim_assets_path = ""
8
+
9
+ [sim.ros]
10
+ enable_ros = true
11
+ isaacsim_ros_ws = ""
12
+ # support: humble, jazzy
13
+ ros_distro = "humble"
14
+
15
+ [[sim.profiles]]
16
+ name = "default"
17
+ cpu_performance_mode = true
18
+ headless = false
19
+ extensions = ["isaacsim.code_editor.vscode"]
20
+ raw_args = ["--/renderer/raytracingMotion/enabled=false"]
21
+ open_scene_path = ""
pow_cli/init/TODO.md ADDED
@@ -0,0 +1,12 @@
1
+ # TODO
2
+
3
+ add init command for initial project for both sim and ros
4
+
5
+ ```bash
6
+ # init project both sim and ros,
7
+ # call 'pow sim init' and 'pow ros init' under the hood
8
+ pow init
9
+
10
+ pow init --type [sim, ros, both]
11
+ pow init -t [sim, ros, both]
12
+ ```
@@ -0,0 +1,3 @@
1
+ from .path import get_isaacsim_path
2
+
3
+ __all__ = ["get_isaacsim_path"]
pow_cli/lib/path.py ADDED
@@ -0,0 +1,15 @@
1
+ from pathlib import Path
2
+
3
+
4
+ def get_isaacsim_path() -> Path | None:
5
+ """Get the installation path of Isaac Sim.
6
+
7
+ Returns:
8
+ Path | None: Path to the Isaac Sim installation if found, None otherwise.
9
+ """
10
+ try:
11
+ import isaacsim
12
+
13
+ return Path(isaacsim.__file__).parent
14
+ except ImportError:
15
+ return None
pow_cli/main.py ADDED
@@ -0,0 +1,45 @@
1
+ """Isaac Powerpack CLI - Main entry point."""
2
+
3
+ import click
4
+
5
+ from .sim.add.local_assets import add_local_assets
6
+ from .sim.check.check import check_compatibility
7
+ from .sim.init.init_sim import init_sim
8
+ from .sim.run.run import run
9
+
10
+
11
+ @click.group()
12
+ def pow():
13
+ """Isaac Powerpack CLI for Isaac Sim workflows."""
14
+ pass
15
+
16
+
17
+ # Sim commands
18
+ @pow.group(invoke_without_command=True)
19
+ @click.pass_context
20
+ def sim(ctx):
21
+ """Isaac Sim related commands.
22
+
23
+ Defaults to 'pow sim run' when no subcommand is specified.
24
+ """
25
+
26
+ # simulation command run only in x86_64 environment workstation, not in jetson device
27
+
28
+ if ctx.invoked_subcommand is None:
29
+ ctx.invoke(run)
30
+
31
+
32
+ @sim.group()
33
+ def add():
34
+ """Add resources to Isaac Sim."""
35
+ pass
36
+
37
+
38
+ # Register commands
39
+ add.add_command(add_local_assets)
40
+ sim.add_command(run)
41
+ sim.add_command(init_sim)
42
+ sim.add_command(check_compatibility)
43
+
44
+ if __name__ == "__main__":
45
+ pow()
@@ -0,0 +1,3 @@
1
+ from .local_assets import add_local_assets
2
+
3
+ __all__ = ["add_local_assets"]
@@ -0,0 +1,308 @@
1
+ import re
2
+ import subprocess
3
+ from pathlib import Path
4
+
5
+ import click
6
+
7
+
8
+ def get_isaacsim_kit_path():
9
+ """Get the path to isaacsim.exp.base.kit file.
10
+
11
+ Returns:
12
+ Path | None: Path to the kit file if isaacsim is installed, None otherwise.
13
+ """
14
+ try:
15
+ import isaacsim
16
+
17
+ return Path(isaacsim.__file__).parent / "apps" / "isaacsim.exp.base.kit"
18
+ except ImportError:
19
+ return None
20
+
21
+
22
+ def update_pow_toml_assets_path(pow_toml_path: Path, asset_path: Path) -> None:
23
+ """Update pow.toml with isaacsim_assets_path.
24
+
25
+ Makes the path relative if inside cwd, or uses ~/ for home directory.
26
+
27
+ Args:
28
+ pow_toml_path: Path to the pow.toml file.
29
+ asset_path: Absolute path to the isaacsim_assets directory.
30
+
31
+ Returns:
32
+ str: The asset path string that was written to pow.toml.
33
+ """
34
+ # Update pow.toml with isaacsim_assets_path
35
+ content = pow_toml_path.read_text()
36
+ content = re.sub(
37
+ r"^(\s*isaacsim_assets_path\s*=\s*).*$",
38
+ rf'\g<1>"{asset_path}"',
39
+ content,
40
+ flags=re.MULTILINE,
41
+ )
42
+ pow_toml_path.write_text(content)
43
+
44
+
45
+ def generate_settings_block(asset_base: Path) -> str:
46
+ """Generate the settings block to add to the kit file.
47
+
48
+ Args:
49
+ asset_base: Base path where Isaac assets are located.
50
+
51
+ Returns:
52
+ str: Formatted settings block string to append to the kit file.
53
+ """
54
+ return f'''
55
+
56
+ # Local asset settings (added by pow cli)
57
+ [settings]
58
+ exts."isaacsim.asset.browser".visible_after_startup = true
59
+ persistent.isaac.asset_root.default = "{asset_base}"
60
+
61
+ exts."isaacsim.gui.content_browser".folders = [
62
+ "{asset_base}/Isaac/Robots",
63
+ "{asset_base}/Isaac/People",
64
+ "{asset_base}/Isaac/IsaacLab",
65
+ "{asset_base}/Isaac/Props",
66
+ "{asset_base}/Isaac/Environments",
67
+ "{asset_base}/Isaac/Materials",
68
+ "{asset_base}/Isaac/Samples",
69
+ "{asset_base}/Isaac/Sensors",
70
+ ]
71
+
72
+ exts."isaacsim.asset.browser".folders = [
73
+ "{asset_base}/Isaac/Robots",
74
+ "{asset_base}/Isaac/People",
75
+ "{asset_base}/Isaac/IsaacLab",
76
+ "{asset_base}/Isaac/Props",
77
+ "{asset_base}/Isaac/Environments",
78
+ "{asset_base}/Isaac/Materials",
79
+ "{asset_base}/Isaac/Samples",
80
+ "{asset_base}/Isaac/Sensors",
81
+ ]
82
+ # End: Local asset settings (added by pow cli)
83
+ '''
84
+
85
+
86
+ def update_kit_settings(asset_root: Path, version: str = "5.1.0") -> Path:
87
+ """Update the isaacsim.exp.base.kit file with local asset paths.
88
+
89
+ Args:
90
+ asset_root: Root directory containing the extracted Isaac assets.
91
+ version: Isaac Sim asset version string (e.g., "5.1.0").
92
+
93
+ Returns:
94
+ Path: Path to the asset base directory on success.
95
+
96
+ Raises:
97
+ FileNotFoundError: If isaacsim.exp.base.kit file is not found.
98
+ """
99
+ kit_path = get_isaacsim_kit_path()
100
+ if not kit_path or not kit_path.exists():
101
+ raise FileNotFoundError(
102
+ "Could not find isaacsim.exp.base.kit file. Is isaacsim installed?"
103
+ )
104
+
105
+ version_short = ".".join(version.split(".")[:2]) # 5.1.0 -> 5.1
106
+ asset_base = asset_root / "Assets" / "Isaac" / version_short
107
+ settings_block = generate_settings_block(asset_base)
108
+
109
+ # Read existing content and remove previous settings block if present
110
+ content = kit_path.read_text()
111
+ start_marker = "# Local asset settings (added by pow cli)"
112
+ end_marker = "# End: Local asset settings (added by pow cli)"
113
+
114
+ start_idx = content.find(start_marker)
115
+ end_idx = content.find(end_marker)
116
+
117
+ # Remove existing if both start and end marker is found
118
+ if start_idx != -1 and end_idx != -1:
119
+ end_idx += len(end_marker)
120
+ content = content[:start_idx].rstrip("\n") + content[end_idx:].lstrip("\n")
121
+ click.echo("Removing existing local asset settings...")
122
+
123
+ with open(kit_path, "w") as f:
124
+ f.write(content + settings_block)
125
+
126
+ click.echo(f"Added local asset settings this kit file:\n {kit_path}")
127
+ return asset_base
128
+
129
+
130
+ def download_assets(target_path: Path, version: str = "5.1.0") -> None:
131
+ """Download Isaac Sim asset zip parts using aria2c.
132
+
133
+ Downloads three zip parts from NVIDIA's Isaac Sim asset server.
134
+ Supports resuming incomplete downloads.
135
+
136
+ Args:
137
+ target_path: Directory to download the zip files to.
138
+ version: Isaac Sim asset version string (e.g., "5.1.0").
139
+
140
+ Returns:
141
+ None
142
+
143
+ Raises:
144
+ subprocess.CalledProcessError: If aria2c download fails.
145
+ """
146
+ for i in range(1, 4):
147
+ zip_file = target_path / f"isaac-sim-assets-complete-{version}.zip.00{i}"
148
+ aria2_file = (
149
+ target_path / f"isaac-sim-assets-complete-{version}.zip.00{i}.aria2"
150
+ )
151
+
152
+ if aria2_file.exists():
153
+ click.echo(f"Incomplete download detected: {zip_file.name}. Resuming...")
154
+ elif not zip_file.exists():
155
+ click.echo(f"Missing asset: {zip_file.name}. Downloading...")
156
+ else:
157
+ click.echo(f"Found complete asset part: {zip_file.name}.")
158
+ continue
159
+
160
+ subprocess.run(
161
+ [
162
+ "aria2c",
163
+ f"https://download.isaacsim.omniverse.nvidia.com/isaac-sim-assets-complete-{version}.zip.00{i}",
164
+ "-d",
165
+ str(target_path),
166
+ ],
167
+ check=True,
168
+ )
169
+
170
+ click.echo(f"All isaac sim asset v{version} parts are present.")
171
+
172
+
173
+ def extract_assets(
174
+ target_path: Path, version: str = "5.1.0", keep_zip: bool = False
175
+ ) -> None:
176
+ """Merge and extract Isaac Sim asset zip files.
177
+
178
+ Combines three zip parts into a single archive, extracts it to
179
+ target_path/isaacsim_assets, and optionally cleans up the zip files.
180
+
181
+ Args:
182
+ target_path: Directory containing the downloaded zip parts.
183
+ version: Isaac Sim asset version string (e.g., "5.1.0").
184
+ keep_zip: If True, keep zip files after extraction.
185
+
186
+ Returns:
187
+ None
188
+
189
+ Raises:
190
+ subprocess.CalledProcessError: If unzip extraction fails.
191
+ """
192
+ merged_zip = target_path / f"isaac-sim-assets-complete-{version}.zip"
193
+ zip_parts = [
194
+ target_path / f"isaac-sim-assets-complete-{version}.zip.001",
195
+ target_path / f"isaac-sim-assets-complete-{version}.zip.002",
196
+ target_path / f"isaac-sim-assets-complete-{version}.zip.003",
197
+ ]
198
+
199
+ if merged_zip.exists():
200
+ click.echo(f"Removing existing merged archive: {merged_zip}")
201
+ merged_zip.unlink()
202
+
203
+ click.echo("Merging zip parts...")
204
+
205
+ total_size = sum(p.stat().st_size for p in zip_parts)
206
+ written = 0
207
+
208
+ with open(merged_zip, "wb") as outfile:
209
+ for part in zip_parts:
210
+ with open(part, "rb") as infile:
211
+ while chunk := infile.read(1024 * 1024 * 10): # 10MB chunks
212
+ outfile.write(chunk)
213
+ written += len(chunk)
214
+ pct = (written / total_size) * 100
215
+ click.echo(f"\r Progress: {pct:.1f}%", nl=False)
216
+ click.echo() # newline after progress
217
+ click.echo(f"Created merged archive: {merged_zip}")
218
+
219
+ click.echo("Extracting assets...")
220
+ subprocess.run(
221
+ ["unzip", str(merged_zip), "-d", str(target_path / "isaacsim_assets")],
222
+ check=True,
223
+ )
224
+ click.echo("Extraction complete.")
225
+
226
+ version_short = ".".join(version.split(".")[:2]) # 5.1.0 -> 5.1
227
+ click.echo(
228
+ f"Isaac Sim assets installed to: {target_path}/isaacsim_assets/Assets/Isaac/{version_short}"
229
+ )
230
+
231
+ click.echo("Cleaning up zip files parts...")
232
+ for part in zip_parts:
233
+ if part.exists():
234
+ part.unlink()
235
+
236
+ if merged_zip.exists() and not keep_zip:
237
+ merged_zip.unlink()
238
+ else:
239
+ click.echo(f"Keeping zip files at: {target_path}")
240
+
241
+ click.echo("Cleanup complete.")
242
+
243
+
244
+ @click.command("local-assets")
245
+ @click.argument("path", required=True)
246
+ @click.option(
247
+ "-s",
248
+ "--skip-download",
249
+ is_flag=True,
250
+ help="Skip downloading and use existing files",
251
+ )
252
+ @click.option(
253
+ "-v",
254
+ "--version",
255
+ default="5.1.0",
256
+ help="Isaac Sim asset version (default: 5.1.0)",
257
+ )
258
+ @click.option(
259
+ "-k",
260
+ "--keep-zip",
261
+ is_flag=True,
262
+ help="Keep zip files after extraction",
263
+ )
264
+ def add_local_assets(
265
+ path: str, skip_download: bool, version: str, keep_zip: bool
266
+ ) -> None:
267
+ """Download Isaac Sim assets and install at target path.
268
+
269
+ Main CLI command that orchestrates downloading, extracting, and configuring
270
+ Isaac Sim local assets.
271
+
272
+ Args:
273
+ path: Target directory path for asset installation.
274
+ skip_download: If True, skip download and use existing files.
275
+ version: Isaac Sim asset version string (e.g., "5.1.0").
276
+ keep_zip: If True, keep zip files after extraction.
277
+
278
+ Returns:
279
+ None
280
+ """
281
+
282
+ # Check if project is initialized
283
+ pow_toml_path = Path.cwd() / "pow.toml"
284
+ if not pow_toml_path.exists():
285
+ raise click.ClickException(
286
+ "pow.toml not found. Please run 'pow sim init' first to initialize the workspace."
287
+ )
288
+
289
+ target_path = Path(path).resolve()
290
+
291
+ if not skip_download:
292
+ download_assets(target_path, version)
293
+ extract_assets(target_path, version, keep_zip)
294
+
295
+ # Update kit settings with local asset paths
296
+ update_kit_settings(target_path / "isaacsim_assets", version)
297
+
298
+ # Update pow.toml with isaacsim_assets_path
299
+ asset_path = target_path / "isaacsim_assets"
300
+ update_pow_toml_assets_path(pow_toml_path, asset_path)
301
+
302
+ click.echo(f"Updated isaacsim_assets_path settings in pow.toml:\n {asset_path}")
303
+ click.echo(
304
+ click.style(
305
+ f"Isaac sim local assets version {version} installation complete.",
306
+ fg="green",
307
+ )
308
+ )
File without changes
@@ -0,0 +1,25 @@
1
+ import subprocess
2
+
3
+ import click
4
+
5
+ from ...lib.path import get_isaacsim_path
6
+
7
+
8
+ @click.command("check")
9
+ def check_compatibility() -> None:
10
+ isaacsim_path = get_isaacsim_path()
11
+ if isaacsim_path is None:
12
+ click.echo("Error: Isaac Sim not found. Please install Isaac Sim first.")
13
+ return False
14
+
15
+ try:
16
+ subprocess.run(
17
+ ["uv", "run", "isaacsim", "isaacsim.exp.compatibility_check"],
18
+ check=True,
19
+ text=True,
20
+ )
21
+
22
+ return True
23
+ except subprocess.CalledProcessError as e:
24
+ click.echo(f"Compatibility check failed: {e.stderr}")
25
+ return False
File without changes
@@ -0,0 +1,324 @@
1
+ import json
2
+ import re
3
+ import subprocess
4
+ from importlib.resources import files
5
+ from pathlib import Path
6
+
7
+ import click
8
+ import toml
9
+
10
+ from ...lib import get_isaacsim_path
11
+
12
+
13
+ def generate_vscode_settings() -> bool:
14
+ """Generate VS Code settings for Isaac Sim development.
15
+
16
+ Runs 'python -m isaacsim --generate-vscode-settings' to create
17
+ VS Code configuration for Isaac Sim extensions and Python paths.
18
+
19
+ Returns:
20
+ bool: True if settings were generated successfully, False otherwise.
21
+ """
22
+ try:
23
+ settings_path = Path.cwd() / ".vscode" / "settings.json"
24
+ if settings_path.exists():
25
+ click.echo("Skipped creating vscode settings, already exists.")
26
+ return True
27
+
28
+ # run isaacsim script to generate settings
29
+ subprocess.run(
30
+ ["uv", "run", "python", "-m", "isaacsim", "--generate-vscode-settings"],
31
+ check=True,
32
+ capture_output=True,
33
+ text=True,
34
+ )
35
+ click.echo("Generated vscode settings for Isaac Sim")
36
+
37
+ # replace absolute paths with ${workspaceFolder} in settings.json
38
+
39
+ settings_path = Path.cwd() / ".vscode" / "settings.json"
40
+ content = settings_path.read_text()
41
+
42
+ # Replace absolute paths before .venv with ${workspaceFolder}
43
+ # Pattern matches: "/any/path/.venv" -> "${workspaceFolder}/.venv"
44
+ updated_content = re.sub(
45
+ r'"[^"]+/\.venv/',
46
+ r'"${workspaceFolder}/.venv/',
47
+ content,
48
+ )
49
+
50
+ if content != updated_content:
51
+ settings_path.write_text(updated_content)
52
+ else:
53
+ click.echo(
54
+ "No absolute paths to replace with ${workspaceFolder} in VS Code settings"
55
+ )
56
+
57
+ return True
58
+
59
+ except subprocess.CalledProcessError as e:
60
+ click.echo(f"Error generating VS Code settings: {e.stderr}")
61
+ return False
62
+ except FileNotFoundError:
63
+ click.echo("Error: Python not found in PATH")
64
+ return False
65
+
66
+
67
+ def fix_asset_browser_cache(isaacsim_path: Path) -> bool:
68
+ """Fix the Isaac Sim asset browser cache issue by creating an empty cache file.
69
+
70
+ The asset browser extension requires a cache.json file to exist. If it doesn't,
71
+ the browser may fail to load. This function creates an empty cache structure.
72
+
73
+ Args:
74
+ isaacsim_path: Path to the Isaac Sim installation directory.
75
+
76
+ Returns:
77
+ bool: True if cache was created or already exists, False otherwise.
78
+ """
79
+ cache_path = (
80
+ isaacsim_path
81
+ / "exts"
82
+ / "isaacsim.asset.browser"
83
+ / "cache"
84
+ / "isaacsim.asset.browser.cache.json"
85
+ )
86
+
87
+ if cache_path is None:
88
+ click.echo("Warning: Could not find isaacsim installation")
89
+ return False
90
+
91
+ # Create cache directory if it doesn't exist
92
+ cache_path.parent.mkdir(parents=True, exist_ok=True)
93
+
94
+ if cache_path.exists():
95
+ click.echo(
96
+ f"Skipped creating Asset browser cache, already exists:\n {cache_path}"
97
+ )
98
+ return True
99
+
100
+ # Create empty cache structure
101
+ empty_cache = {}
102
+
103
+ with open(cache_path, "w") as f:
104
+ json.dump(empty_cache, f, indent=4)
105
+
106
+ click.echo(f"Created asset browser cache: {cache_path}")
107
+ return True
108
+
109
+
110
+ def create_pow_config_toml() -> tuple[dict, bool]:
111
+ """Create pow.toml config file in the project root.
112
+
113
+ Copies the default pow.toml template to the current working directory.
114
+ If pow.toml already exists, it will not be overwritten.
115
+
116
+ Returns:
117
+ tuple[dict, bool]: A tuple containing:
118
+ - dict: The parsed pow.toml configuration dictionary.
119
+ - bool: True if pow.toml already existed, False if newly created.
120
+ """
121
+ pow_toml_path = Path.cwd() / "pow.toml"
122
+
123
+ if pow_toml_path.exists():
124
+ click.echo("Skipped creating pow.toml config, already exists.")
125
+ return (toml.load(pow_toml_path), True)
126
+
127
+ try:
128
+ default_toml = files("pow_cli").joinpath("data", "pow.default.toml")
129
+ content = default_toml.read_text()
130
+ pow_toml_path.write_text(content)
131
+ click.echo("Created pow.toml config")
132
+ return (toml.load(pow_toml_path), False)
133
+ except FileNotFoundError:
134
+ click.echo("Error: Default template not found in package")
135
+ return ({}, False)
136
+
137
+
138
+ def update_pow_config_toml(pow_config: dict) -> None:
139
+ """Update pow.toml config file with ROS settings.
140
+
141
+ Uses regex replacement to preserve file formatting and comments.
142
+
143
+ Args:
144
+ pow_config: The pow.toml configuration dictionary with updated values.
145
+ """
146
+ pow_toml_path = Path.cwd() / "pow.toml"
147
+ content = pow_toml_path.read_text()
148
+
149
+ # Replace enable_ros value
150
+ enable_ros = str(pow_config["sim"]["ros"]["enable_ros"]).lower()
151
+ content = re.sub(
152
+ r"^(\s*enable_ros\s*=\s*).*$",
153
+ rf"\g<1>{enable_ros}",
154
+ content,
155
+ flags=re.MULTILINE,
156
+ )
157
+
158
+ # Replace ros_distro value
159
+ ros_distro = pow_config["sim"]["ros"]["ros_distro"]
160
+ content = re.sub(
161
+ r"^(\s*ros_distro\s*=\s*).*$",
162
+ rf'\g<1>"{ros_distro}"',
163
+ content,
164
+ flags=re.MULTILINE,
165
+ )
166
+
167
+ # Replace isaacsim_ros_ws value
168
+ isaacsim_ros_ws = pow_config["sim"]["ros"].get("isaacsim_ros_ws", "")
169
+ content = re.sub(
170
+ r"^(\s*isaacsim_ros_ws\s*=\s*).*$",
171
+ rf'\g<1>"{isaacsim_ros_ws}"',
172
+ content,
173
+ flags=re.MULTILINE,
174
+ )
175
+
176
+ pow_toml_path.write_text(content)
177
+
178
+
179
+ def setup_ros_workspace(pow_config: dict, is_existing: bool) -> dict:
180
+ """Setup ROS workspace for Isaac Sim project.
181
+
182
+ Prompts the user to enable ROS integration and select a ROS distro.
183
+ If enabled, clones and installs isaac_ros_common in .pow/ directory.
184
+
185
+ Args:
186
+ pow_config: The pow.toml configuration dictionary.
187
+ is_existing: True if pow.toml already existed, False if newly created.
188
+
189
+ Returns:
190
+ dict: Updated pow_config with ros settings:
191
+ - sim.ros.enable_ros (bool): Whether ROS is enabled
192
+ - sim.ros.ros_distro (str): Selected ROS distro or empty string if disabled
193
+ """
194
+
195
+ # Ensure nested structure exists
196
+ if "sim" not in pow_config:
197
+ pow_config["sim"] = {}
198
+ if "ros" not in pow_config["sim"]:
199
+ pow_config["sim"]["ros"] = {}
200
+
201
+ if not is_existing:
202
+ # Ask if user wants to use ROS
203
+ enable_ros = click.confirm(
204
+ click.style(
205
+ "Do you want to enable ROS integration in IsaacSim?",
206
+ fg="bright_black",
207
+ ),
208
+ default=True,
209
+ )
210
+ if not enable_ros:
211
+ click.echo("Skipping ROS setup.")
212
+ pow_config["sim"]["ros"]["enable_ros"] = False
213
+ pow_config["sim"]["ros"]["ros_distro"] = ""
214
+ return pow_config
215
+
216
+ pow_config["sim"]["ros"]["enable_ros"] = True
217
+
218
+ # Select ROS distro
219
+ ros_distros = ["humble", "jazzy"]
220
+ click.echo(click.style("Available ROS distributions:", fg="bright_black"))
221
+ for i, distro in enumerate(ros_distros, 1):
222
+ click.echo(click.style(f" {i}. {distro}", fg="bright_black", bold=True))
223
+
224
+ choice = click.prompt(
225
+ click.style("Select ROS distro", fg="bright_black"),
226
+ type=click.IntRange(1, len(ros_distros)),
227
+ default=1, # humble
228
+ )
229
+ selected_distro = ros_distros[choice - 1]
230
+ pow_config["sim"]["ros"]["ros_distro"] = selected_distro
231
+ click.echo(f"Selected ROS distro: {selected_distro}")
232
+
233
+ # Setup .pow directory in user home
234
+ pow_dir = Path.home() / ".pow"
235
+ pow_dir.mkdir(parents=True, exist_ok=True)
236
+
237
+ # Clone IsaacSim-ros_workspaces
238
+ ros_workspace_path = pow_dir / "IsaacSim-ros_workspaces"
239
+
240
+ if ros_workspace_path.exists():
241
+ click.echo("IsaacSim-ros_workspaces already exists")
242
+ else:
243
+ click.echo("Cloning IsaacSim-ros_workspaces...")
244
+ try:
245
+ subprocess.run(
246
+ [
247
+ "git",
248
+ "clone",
249
+ "-b",
250
+ "IsaacSim-5.1.0",
251
+ "--quiet",
252
+ "https://github.com/isaac-sim/IsaacSim-ros_workspaces.git",
253
+ str(ros_workspace_path),
254
+ ],
255
+ check=True,
256
+ capture_output=True,
257
+ )
258
+ click.echo(f"Cloned IsaacSim-ros_workspaces to: {ros_workspace_path}")
259
+ except subprocess.CalledProcessError as e:
260
+ click.echo(f"Error cloning IsaacSim-ros_workspaces: {e}")
261
+ pow_config["sim"]["ros"]["enable_ros"] = False
262
+ return pow_config
263
+
264
+ # Install the selected ROS workspace base on this guide
265
+ # https://docs.isaacsim.omniverse.nvidia.com/5.1.0/installation/install_ros.html
266
+ ros_distro = pow_config["sim"]["ros"].get("ros_distro", "")
267
+ if ros_distro in ["humble", "jazzy"]:
268
+ # Install ROS dependencies
269
+ click.echo(f"Building ROS {ros_distro} workspace...")
270
+ try:
271
+ subprocess.run(
272
+ ["./build_ros.sh", "-d", ros_distro, "-v", "22.04"],
273
+ cwd=ros_workspace_path,
274
+ check=True,
275
+ )
276
+ click.echo(f"Built ROS {ros_distro} workspace.")
277
+ except subprocess.CalledProcessError as e:
278
+ click.echo(
279
+ f"Skipped build: failed to build ROS {ros_distro} workspace ({e})"
280
+ )
281
+ pow_config["sim"]["ros"]["enable_ros"] = False
282
+ return pow_config
283
+
284
+ # Store the ROS workspace path in config (use ~/ for home directory)
285
+ pow_config["sim"]["ros"]["isaacsim_ros_ws"] = str(ros_workspace_path).replace(
286
+ str(Path.home()), "~"
287
+ )
288
+
289
+ click.echo(f"Setup ROS workspace complete at path:\n {ros_workspace_path}")
290
+
291
+ return pow_config
292
+
293
+
294
+ @click.command("init")
295
+ def init_sim() -> None:
296
+ """Initialize a new Isaac Sim project.
297
+
298
+ Returns:
299
+ None
300
+ """
301
+
302
+ # Check if isaacsim is installed
303
+
304
+ isaacsim_path = get_isaacsim_path()
305
+ if isaacsim_path is None:
306
+ click.echo("Error: Isaac Sim not found. Please install Isaac Sim first.")
307
+ return
308
+
309
+ # Create pow.toml config if not exists in root
310
+ pow_config, is_existing = create_pow_config_toml()
311
+
312
+ # Generate VS Code settings for Isaac Sim
313
+ generate_vscode_settings()
314
+
315
+ # Fix: isaacsim browser cache issue
316
+ fix_asset_browser_cache(isaacsim_path)
317
+
318
+ # Setup ROS workspace if user agrees
319
+ updated_powconfig = setup_ros_workspace(pow_config, is_existing)
320
+
321
+ # Update pow.toml with ROS settings
322
+ update_pow_config_toml(updated_powconfig)
323
+
324
+ click.echo(click.style("🎉 Successfully initialized Sim project 🎉", fg="green"))
File without changes
pow_cli/sim/run/run.py ADDED
@@ -0,0 +1,109 @@
1
+ """Run Isaac Sim App command."""
2
+
3
+ import platform
4
+ from pathlib import Path
5
+
6
+ import click
7
+ import toml
8
+
9
+
10
+ def find_project_root(start_path: Path | None = None) -> Path | None:
11
+ """Find the project root by locating pow.toml.
12
+
13
+ Searches from the start path upward through parent directories
14
+ until pow.toml is found or the filesystem root is reached.
15
+
16
+ Args:
17
+ start_path: Directory to start searching from (default: current directory).
18
+
19
+ Returns:
20
+ Path | None: Path to the directory containing pow.toml, or None if not found.
21
+ """
22
+ if start_path is None:
23
+ start_path = Path.cwd()
24
+
25
+ current = start_path.resolve()
26
+
27
+ while current != current.parent:
28
+ if (current / "pow.toml").exists():
29
+ return current
30
+ current = current.parent
31
+
32
+ # Check root as well
33
+ if (current / "pow.toml").exists():
34
+ return current
35
+
36
+ return None
37
+
38
+
39
+ def load_config(project_root: Path) -> dict:
40
+ """Load pow.toml configuration.
41
+
42
+ Args:
43
+ project_root: Path to the project root directory.
44
+
45
+ Returns:
46
+ dict: Parsed TOML configuration.
47
+
48
+ Raises:
49
+ FileNotFoundError: If pow.toml is not found.
50
+ """
51
+ config_path = project_root / "pow.toml"
52
+ if not config_path.exists():
53
+ raise FileNotFoundError(f"Config file not found: {config_path}")
54
+
55
+ return toml.load(config_path)
56
+
57
+
58
+ @click.command(
59
+ context_settings={"ignore_unknown_options": True, "allow_extra_args": True}
60
+ )
61
+ @click.pass_context
62
+ def run(ctx) -> None:
63
+ """Run an Isaac Sim App.
64
+
65
+ Loads configuration from pow.toml in the project root.
66
+ Supports passing arbitrary flags to Isaac Sim.
67
+
68
+ Args:
69
+ ctx: Click context containing extra arguments.
70
+
71
+ Returns:
72
+ None
73
+ """
74
+ project_root = find_project_root()
75
+ if project_root is None:
76
+ raise click.ClickException(
77
+ click.style(
78
+ "Could not find pow.toml in current directory or any parent directory.",
79
+ fg="red",
80
+ )
81
+ )
82
+
83
+ config = load_config(project_root)
84
+ click.echo(f"Loaded config: {config}")
85
+
86
+ # Check x86_64 environment
87
+ if platform.machine().lower() not in ("x86_64", "amd64"):
88
+ raise click.ClickException(
89
+ click.style(
90
+ "This command is not supported on Jetson devices; it is intended for x86_64 systems.",
91
+ fg="red",
92
+ )
93
+ )
94
+
95
+ # check if system is Ubuntu Linux
96
+ os_release = Path("/etc/os-release")
97
+ if not os_release.exists() or "id=ubuntu" not in os_release.read_text().lower():
98
+ raise click.ClickException(
99
+ click.style("This command is supported only on Ubuntu.", fg="red")
100
+ )
101
+
102
+ # TODO: implement the actual run logic
103
+ click.echo("TODO: check and source isaac ros workspace")
104
+
105
+ click.echo(
106
+ f"TDO: Pass Extra arguments to isaacsim command (support for example --reset-user): {ctx.args}"
107
+ )
108
+
109
+ click.echo("TODO: ")
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.4
2
+ Name: pow-cli
3
+ Version: 0.0.1
4
+ Summary: Command line interface for Isaac Powerpack
5
+ Author: Titiwat Munintravong, Isaac Powerpack Contributors
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ License-File: NOTICE
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: click>=8.1.7
11
+ Requires-Dist: toml>=0.10.2
12
+ Description-Content-Type: text/markdown
13
+
14
+ # 👋 Isaac Powerpack Commandline
15
+
16
+ This is early preview of the Isaac Powerpack Commandline Interface (CLI) tool, `pow-cli`, designed to to streamline Isaac ROS and Isaac Sim project setup and management
17
+
18
+ ### Current Features and Roadmap
19
+
20
+ - CLI
21
+ - [x] Install Isaac Sim local assets (`sim add local-assets`, v5.1.0)
22
+ - [ ] Isaac Sim commands: `sim init`, `sim run` for simplified setup workflows
23
+ - [ ] Isaac ROS commands: `ros init`, `ros run`, `ros build` for streamlined Docker workflows
@@ -0,0 +1,20 @@
1
+ pow_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pow_cli/main.py,sha256=pU_MbiaxdailQegtlGml12k7sRR-nD2uShVGvJKx_Ts,926
3
+ pow_cli/data/pow.default.toml,sha256=ozkZYTctxNU70Yv7d1YFr1JEI1k-SycfADGIYDaZqgM,541
4
+ pow_cli/init/TODO.md,sha256=MergzyLTPLlkN3o7N3a8x1GnkyJuKsaFS08erDQwe4Y,240
5
+ pow_cli/lib/__init__.py,sha256=DGGA4cjVSPSYoaWPH9t0fmlVXpKtmH7WK3zpgcNAmmQ,69
6
+ pow_cli/lib/path.py,sha256=YTEKg0x8kqYOwHUtwlVm8jxKTlIawJdr5Ou9swOpui4,342
7
+ pow_cli/sim/add/__init__.py,sha256=KGviq8twm0yU3lgLFnt3cAx_3CKAI0dOFzXagChwwHM,75
8
+ pow_cli/sim/add/local_assets.py,sha256=mlirZnBWrOefRgLVSqYJtnXD2Jvu61BtF4sVe7v0CNI,9633
9
+ pow_cli/sim/check/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ pow_cli/sim/check/check.py,sha256=zhi33XwuYkTIbTVlZuIkjUb-rrodaK5CJjhHRO5p5ZA,626
11
+ pow_cli/sim/init/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ pow_cli/sim/init/init_sim.py,sha256=DOCpTPDkcdvFiItFrYxGPmbkjE5jjdhAx70ynTlzOo4,10646
13
+ pow_cli/sim/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ pow_cli/sim/run/run.py,sha256=W91itBo2Vru6upg_lIotR4eE9V17flVRCMJNzVueg9s,2957
15
+ pow_cli-0.0.1.dist-info/METADATA,sha256=0Tiu7-ZZ-49_LlraYFr7VL7nIniyapWZmPC_DKmbLac,852
16
+ pow_cli-0.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ pow_cli-0.0.1.dist-info/entry_points.txt,sha256=yitjxOGWTr-M9ax2tOD9N7YTuWeyuIcCroVgNufTWZc,41
18
+ pow_cli-0.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
+ pow_cli-0.0.1.dist-info/licenses/NOTICE,sha256=sJSYngRyeqzG5IHl-HaKRWFerfTZmBdTpl_YWGlgDks,202
20
+ pow_cli-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pow = pow_cli.main:pow
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ Isaac Powerpack
2
+ Copyright (c) 2025-present, Titiwat Munintravong and Isaac Powerpack contributors
3
+
4
+ This product includes software developed by
5
+ Titiwat Munintravong and the Isaac Powerpack contributors.