You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.6 KiB
44 lines
1.6 KiB
@echo off
|
|
setlocal
|
|
|
|
:: -----------------------------------------------------------------
|
|
:: dashboard.bat — BATL CARLA Orchestrator launcher
|
|
:: Place this file anywhere in the project root.
|
|
:: It activates the carla312 conda env and starts dashboard/app.py
|
|
:: -----------------------------------------------------------------
|
|
|
|
:: Resolve the project root to the directory containing THIS .bat file
|
|
set "PROJECT_ROOT=%~dp0"
|
|
:: Remove trailing backslash
|
|
if "%PROJECT_ROOT:~-1%"=="\" set "PROJECT_ROOT=%PROJECT_ROOT:~0,-1%"
|
|
|
|
echo -------------------------------------------------
|
|
echo BATL CARLA Orchestrator
|
|
echo Project root: %PROJECT_ROOT%
|
|
echo -------------------------------------------------
|
|
|
|
:: Activate conda environment
|
|
call C:\ProgramData\miniconda3\Scripts\activate.bat carla312
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Failed to activate conda environment 'carla312'.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
:: Open browser to dashboard (slight delay lets Flask start first)
|
|
timeout /t 1 /nobreak >nul
|
|
start "" "http://127.0.0.1:5000"
|
|
|
|
:: Auto-minimize this terminal to keep the workspace clean
|
|
powershell -Command "$t = '[DllImport(\"user32.dll\")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport(\"kernel32.dll\")] public static extern IntPtr GetConsoleWindow();'; $type = Add-Type -MemberDefinition $t -Name 'Win32Utils' -Namespace 'Win32' -PassThru; [void]$type::ShowWindow($type::GetConsoleWindow(), 2)"
|
|
|
|
:: Launch the Flask app — always from PROJECT_ROOT so run.bat is reachable
|
|
cd /d "%PROJECT_ROOT%"
|
|
python dashboard\app.py
|
|
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Application crashed or failed to start.
|
|
pause
|
|
)
|
|
|
|
endlocal
|