-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
138 lines (119 loc) · 5.36 KB
/
Copy pathsetup.ps1
File metadata and controls
138 lines (119 loc) · 5.36 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# FitQuest -- first-run setup for a fresh machine.
#
# powershell -ExecutionPolicy Bypass -File setup.ps1
#
# Creates the virtual environment, installs dependencies, verifies the install
# against the test suite, and reports what still needs doing by hand. Safe to
# re-run: every step checks its own precondition first.
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $root
$py = Join-Path $root "ironquest_env\Scripts\python.exe"
function Step($n, $text) { Write-Host "`n[$n] $text" -ForegroundColor Cyan }
function Ok($text) { Write-Host " OK $text" -ForegroundColor Green }
function Warn($text) { Write-Host " !! $text" -ForegroundColor Yellow }
function Fail($text) { Write-Host " XX $text" -ForegroundColor Red }
Write-Host "FitQuest setup" -ForegroundColor White
Write-Host ("=" * 60)
# --- 1. Python ---------------------------------------------------------------
Step 1 "Checking Python"
try {
$ver = (& python --version 2>&1) -replace 'Python ', ''
$maj, $min = $ver.Split('.')[0..1]
if ([int]$maj -lt 3 -or ([int]$maj -eq 3 -and [int]$min -lt 12)) {
Fail "Python $ver found. This project needs 3.12 or newer."
Write-Host " Install from https://www.python.org/downloads/ and tick 'Add Python to PATH'."
exit 1
}
Ok "Python $ver"
} catch {
Fail "Python is not on PATH."
Write-Host " Install from https://www.python.org/downloads/ and tick 'Add Python to PATH'."
exit 1
}
# --- 2. Virtual environment --------------------------------------------------
Step 2 "Virtual environment"
if (Test-Path $py) {
Ok "ironquest_env already exists"
} else {
Write-Host " Creating ironquest_env ..."
& python -m venv ironquest_env
if (-not (Test-Path $py)) { Fail "Could not create the virtual environment."; exit 1 }
Ok "created"
}
# --- 3. Dependencies ---------------------------------------------------------
Step 3 "Installing dependencies (several minutes; PyTorch is large)"
& $py -m pip install --upgrade pip --quiet
& $py -m pip install -r requirements.txt --quiet
if ($LASTEXITCODE -ne 0) { Fail "pip install failed. Scroll up for the reason."; exit 1 }
Ok "installed"
# --- 4. Model weights --------------------------------------------------------
Step 4 "Model weights"
$poseW = "weights\yolo26n-pose.pt"
$dumbW = "runs\detect\dumbbell_combined_yolo26n\weights\best.pt"
$missing = @()
foreach ($w in @($poseW, $dumbW)) {
if (Test-Path $w) {
Ok ("{0} ({1:N1} MB)" -f $w, ((Get-Item $w).Length / 1MB))
} else {
Fail "missing: $w"
$missing += $w
}
}
if ($missing.Count -gt 0) {
Warn "Weights are committed to the repository. If they are missing, the clone"
Write-Host " was incomplete -- try: git lfs pull, or re-clone."
}
# --- 5. Test suite -----------------------------------------------------------
Step 5 "Verifying the install"
& $py -m pytest tests\ -q
if ($LASTEXITCODE -ne 0) {
Fail "Tests failed. Fix this before connecting any hardware --"
Write-Host " a software problem here will look like a hardware problem later."
exit 1
}
Ok "test suite passes"
# --- 6. Wi-Fi configuration --------------------------------------------------
Step 6 "ESP32 Wi-Fi configuration"
$cfg = "firmware\esp32_s3_bno08x_udp\wifi_config.h"
$example = "firmware\esp32_s3_bno08x_udp\wifi_config.example.h"
if (Test-Path $cfg) {
Ok "wifi_config.h exists"
if ((Get-Content $cfg -Raw) -match 'YOUR_WIFI_SSID') {
Warn "still contains the placeholder SSID -- edit it before flashing"
}
} else {
Copy-Item $example $cfg
Ok "created wifi_config.h from the example"
Warn "EDIT IT: set WIFI_SSID and WIFI_PASSWORD to your phone hotspot"
}
# --- Summary -----------------------------------------------------------------
Write-Host "`n$("=" * 60)"
Write-Host "Software is ready." -ForegroundColor Green
Write-Host @"
Remaining steps, in this order -- each one gives a verifiable result
before the next can hide a failure inside it:
1. Try it with no hardware at all:
.\ironquest_env\Scripts\python.exe -m tools.simulate_game_control_stream
Open the printed URL. The full client should work.
2. Flash the ESP32 (Arduino IDE, board 'ESP32S3 Dev Module',
USB CDC On Boot DISABLED, connected via the UART port):
firmware\esp32_s3_bno08x_udp\esp32_s3_bno08x_udp.ino
3. Close the Arduino Serial Monitor -- it holds the port, and the
failure looks exactly like a disconnected board. Then:
.\ironquest_env\Scripts\python.exe -m ironquest check-esp32 --port auto --seconds 10 --list-ports
4. Connect this laptop to the phone hotspot. The campus network will
not carry the telemetry: enterprise authentication the firmware
does not implement, and no UDP broadcast between clients.
5. On the watch, two separate things must be on:
a) wrist heart-rate monitoring
Settings > Health & Wellness > Heart Rate > Wrist Heart Rate
the app reads the sensor, it does not turn it on
b) the FitQuest Telemetry app, open and on screen
it transmits from its view -- closing it stops the stream
No rebuild needed. 'Broadcast Heart Rate' is a different setting and
is only for the BLE fallback (--garmin-bridge), off by default.
6. Run everything:
.\run_ironquest.bat
Full detail: docs/reports section 15, Reproduction and Handover.
"@