forked from UAVLab-SLU/DRV_public
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathstart_enviroment.ps1
More file actions
57 lines (36 loc) · 1.59 KB
/
Copy pathstart_enviroment.ps1
File metadata and controls
57 lines (36 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#security permissions for npm start, if you dont allow just type "npm start" after the script runs
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
function Write-Info($msg) {
Write-Host "`n[INFO] $msg`n" -ForegroundColor Cyan
}
#create or check if airsim doc is existing
$documentsPath = [Environment]::GetFolderPath('MyDocuments')
$airsimPath = Join-Path $documentsPath "AirSim"
if (-Not (Test-Path $airsimPath)) {
New-Item -ItemType Directory -Path $airsimPath | Out-Null
Write-Host "Created AirSim folder at: $airsimPath" -ForegroundColor Green
} else {
Write-Host "AirSim folder already exists at: $airsimPath" -ForegroundColor Yellow
}
#check if venv is made, otherwise do the whole install
if (-Not (Test-Path "venv")) {
Write-Host "Creating virtual enviroment 'venv' " -ForegroundColor Green
py -3.10 -m venv venv
} else {
Write-Host "Found exisitng virtual enviroment 'venv' " -ForegroundColor Yellow
}
.\venv\Scripts\Activate.ps1
Set-Location -Path ".\backend"
Write-Info "installing requirements..."
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd $(Get-Location); "
pip install -r requirements.txt
#back end starting
Write-Info "Starting backend..."
#open another shell for backend
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd $(Get-Location)\PythonClient\server; py simulation_server.py"
# front end starting
Write-Info "Starting frontend..."
Set-Location -Path "..\frontend"
npm install
#open another shell for frontend
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd $(Get-Location); npm start"