Skip to content

Commit 1cc8e21

Browse files
committed
simplify logic in windows
1 parent bdd772e commit 1cc8e21

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

isaaclab.bat

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,33 @@ rem Helper functions
1414

1515
rem extract Isaac Sim directory
1616
:extract_isaacsim_path
17-
rem Check if IsaacSim directory manually specified
18-
if not "%ISAACSIM_PATH%"=="" (
19-
rem Use local build
20-
set isaac_path=%ISAACSIM_PATH%
21-
) else (
22-
rem check if isaacsim is installed
23-
pip show isaacsim-rl > nul 2>&1
17+
rem check if conda environment is activated and isaacsim package is installed
18+
if not "%CONDA_PREFIX%"=="" (
19+
rem use conda python
20+
set python_exe=%CONDA_PREFIX%\python
21+
call %python_exe% -m pip show isaacsim-rl > nul 2>&1
2422
if errorlevel 1 (
25-
rem Use TeamCity build or pip install
26-
set isaac_path=%ISAACLAB_PATH%\_isaac_sim
23+
rem set isaac path to empty
24+
set isaac_path=
2725
) else (
28-
rem use the python executable to get the path
29-
call :extract_python_exe
30-
rem retrieve the isaacsim path
26+
rem retrieve the isaacsim path from the installed package
3127
set "isaac_path="
3228
for /f "delims=" %%i in ('!python_exe! -c "import isaacsim; import os; print(os.environ['ISAAC_PATH'])"') do (
3329
if not defined isaac_path (
3430
set "isaac_path=%%i"
3531
)
3632
)
3733
)
34+
) else (
35+
rem Use the sym-link path to Isaac Sim directory
36+
set isaac_path=%ISAACLAB_PATH%\_isaac_sim
3837
)
3938
rem Check if the directory exists
4039
if not exist "%isaac_path%" (
41-
echo [ERROR] Isaac Sim directory not found at path: %isaac_path%
42-
echo [ERROR] Please specify the path to Isaac Sim directory using 'ISAACSIM_PATH' environment variable.
40+
echo [ERROR] Unable to find the Isaac Sim directory: %isaac_path%
41+
echo /tThis could be due to the following reasons:
42+
echo /t1. Conda environment with Isaac Sim pip package is not activated.
43+
echo /t2. Isaac Sim directory is not available at the default path: %ISAACLAB_PATH%\_isaac_sim
4344
exit /b 1
4445
)
4546
goto :eof
@@ -51,26 +52,17 @@ if not "%CONDA_PREFIX%"=="" (
5152
rem use conda python
5253
set python_exe=%CONDA_PREFIX%\python
5354
) else (
54-
rem check if isaacsim is installed
55-
pip show isaacsim-rl > nul 2>&1
56-
if errorlevel 1 (
57-
rem obtain isaacsim path
58-
call :extract_isaacsim_path
59-
rem use python from kit if Isaac Sim not installed from pip
60-
set python_exe=%isaac_path%\python.bat
61-
) else (
62-
rem use current python if Isaac Sim is installed from pip
63-
set "python_exe="
64-
for /f "delims=" %%i in ('where python') do (
65-
if not defined python_exe (
66-
set "python_exe=%%i"
67-
)
68-
)
69-
)
55+
rem obtain isaacsim path
56+
call :extract_isaacsim_path
57+
rem use python from kit if Isaac Sim not installed from pip
58+
set python_exe=%isaac_path%\python.bat
7059
)
7160
rem check if there is a python path available
7261
if "%python_exe%"=="" (
73-
echo [ERROR] No python executable found at path: %isaac_path%
62+
echo [ERROR] Unable to find any Python executable at path: %isaac_path%
63+
echo /tThis could be due to the following reasons:
64+
echo /t1. Conda environment is not activated.
65+
echo /t2. Python executable is not available at the default path: %ISAACLAB_PATH%\_isaac_sim\python.bat
7466
exit /b 1
7567
)
7668
goto :eof
@@ -257,8 +249,6 @@ if "%arg%"=="-i" (
257249
)
258250
rem install the rl-frameworks specified
259251
call !python_exe! -m pip install -e %ISAACLAB_PATH%\source\extensions\omni.isaac.lab_tasks[!framework_name!]
260-
rem setup vscode settings
261-
call :update_vscode_settings
262252
shift
263253
) else if "%arg%"=="--install" (
264254
rem install the python packages in omni.isaac.rl/source directory

0 commit comments

Comments
 (0)