WP-FE-ROUTE-NAV-COMPASS-01 — Navigation GPS + compass (Google-Maps-like)
Domain: D-ROUTE · Surface: CON · Status: IMP · Date: 2026-08-13
Goal
Màn RouteActive theo dõi vị trí + la bàn liên tục, căn camera/heading theo lộ trình (giống Google Maps turn-by-turn).
Acceptance
| AC | Result |
|---|---|
GPS watch ~ mỗi 3s (timeInterval + BestForNavigation) |
PASS |
La bàn watchHeadingAsync (trueHeading / magHeading) |
PASS |
| Snap GPS → polyline; remaining dọc tuyến; off-route >45m | PASS |
Camera follow: animateCamera heading + pitch; chevron user |
PASS |
| Heading ưu tiên: GPS course khi chạy · compass khi đứng · segment bearing | PASS |
Files
| Path | Change |
|---|---|
mobile/src/features/places/useDeviceLocation.ts |
timeIntervalMs default 3s · compassHeading · heading watch |
mobile/src/features/routing/routeSnap.ts |
snapToRoute · bearingDeg · resolveNavHeading |
mobile/src/features/routing/components/RoutePolylinePreview.tsx |
follow camera · traversed polyline · chevron · fill |
mobile/src/features/routing/screens/RouteActiveScreen.tsx |
wire snap + heading + off-route banner |
Out of scope
- Tự gọi lại
/routing/directionskhi lệch lộ trình (reroute API) — chưa làm. - Voice TTS (mute UI only).
Verify local
- Expo Go / device thật (compass cần hardware).
- Chỉ đường → Bắt đầu →
RouteActive. - Xoay máy: camera + mũi tên xoay; GPS hint cập nhật ~3s.
- Lệch tuyến >45m → banner “Quay lại lộ trình”.