Skip to content

Group 8 Assignment 2 - Indoor positioning with particle filter fusion, map matching, and auto-floor detection#127

Open
JamesJiang1008 wants to merge 6 commits intoopenpositioning:developfrom
JamesJiang1008:develop
Open

Group 8 Assignment 2 - Indoor positioning with particle filter fusion, map matching, and auto-floor detection#127
JamesJiang1008 wants to merge 6 commits intoopenpositioning:developfrom
JamesJiang1008:develop

Conversation

@JamesJiang1008
Copy link
Copy Markdown

Summary
This PR implements a complete indoor positioning demonstrator extending the PositionMe app with three core components: positioning fusion, map matching, and enhanced data display.

Positioning Fusion

  • SIR particle filter (500 particles) fusing PDR, GNSS, WiFi API, and local KNN fingerprinting
  • 9-second autonomous calibration phase with multi-sample averaging
  • Automatic source selection: GNSS outdoors (<15 m accuracy), KNN/WiFi indoors, with seamless fallback
  • KNN WiFi positioning using 351 locally collected fingerprints (Nucleus GF/F1/F2/F3/Basement)
  • Stuck detection and particle reinitialisation when estimate diverges from PDR motion

Map Matching

  • Three-layer wall constraint: particle prediction, estimate correction, and measurement rejection
  • Wall segments extracted from FloorplanAPI and building outline polygons
  • Cross-product based line-segment intersection test with projection onto nearest wall
  • Sticky building detection (25 m radius) to prevent indoor map dropout from GPS drift
  • Automatic floor detection combining WiFi anchor, barometric elevation, transition zone constraints, and 2-second debounce
  • Stair/lift step scaling (20% horizontal on stairs, 0% in lifts)

Data Display

  • Real-time fused position arrow with 180 ms interpolated animation
  • Smooth trajectory rendering (EMA + Catmull-Rom spline interpolation)
  • Colour-coded observation dots: PDR (yellow), WiFi (green), GNSS (blue)
  • Particle cloud visualisation (80 sampled particles, 1 s refresh)
  • Positioning source indicator (KNN/WiFi/GPS)
  • Map controls: auto-follow with 5 s gesture pause, manual floor switching, map type selector
  • In-app KNN fingerprint collection UI

Working state with:
- Particle filter (500 particles, SIR, easting/northing coords)
- KNN WiFi positioning (290 fingerprints, GF/F1/F2)
- Map matching (wall + room + building outline)
- Auto-floor (WiFi anchor + barometric delta + transition zone)
- Data display (obs dots, source label, smooth animation)
- Heading: game rotation vector + one-time mag offset, no LPF
- PDR: Weiberg K=0.28, stair step scaling
- Floor order fix, debounce 2s, KNN collection UI in SET page
Added on top of 4c4c1ee:
- Sticky building detection (25m radius keeps indoor map active)
- KNN calibration phase (9s, 3 samples average) with countdown UI
- Trajectory only draws after calibration completes
- Camera follow pause on map drag (5s resume)
- Removed all external project references from comments
- KNN fingerprints: 443 points across Nucleus (BF/GF/F1/F2/F3) + Library (F1/F2/F3)
- Calibration: 9s multi-sample averaging, GNSS reliability check (<15m = outdoor)
- Trajectory only draws after calibration (no pre-calibration fly line)
- Sticky building detection (25m radius)
- Nucleus <-> Library building switch
- Transition zone radius: 5m
- Asymmetric floor dead zone: -2.1m to +2.6m
- WiFi scan interval: 1.5s
- Camera follow pause on drag (5s resume)
- Obs dots label: PDR/WiFi/GPS
- Removed all external project references
- STEP_COUNTER as fallback for slow walking (800ms threshold)
- 300ms debounce to prevent double-counting
- Null protection for sensor registration (prevents crash)
- Particle cloud visualization (80 sampled, 1s refresh, toggle switch)
- Local protobuf save on stopRecording (.pb + .txt)
- Floor dead zone: -2.1m to +3.5m (handles tall GF→F1)
- Step length K=0.25
- WiFi scan interval 1.5s
- Compact switch UI (36dp height, 12sp text)
- Debug logging for recording state
- Updated APP_ARCHITECTURE.md to match actual code values
  (Weiberg K=0.23, stair scale=0.20, heading LPF unused, debounce=200ms)
- Fixed SensorEventHandler debounce comment (300ms → 200ms)
- Removed separate library floor fingerprint files (merged into main JSON)
- KNN floor-specific mode + observation dot + particle viz refinements
…e cleanup)

- Import ordering: ServerCommunications, RecordingFragment, TrajectoryMapFragment (Google Java Style)
- Naming: N → PARTICLE_COUNT, K → KNN_NEIGHBORS
- Javadoc: added to 10+ public/private methods across RecordingFragment, ParticleFilter, CorrectionFragment
- Comments: algorithm explanations for wall projection, segment intersection, KNN warmup
- Cleanup: removed stale TODOs, dead code, restored failure Toast in MainActivity
- Performance: added onDestroyView() to RecordingFragment and TrajectoryMapFragment
  to stop leaked handlers, timers, and animators
- Performance: spline interpolation windowed to last 50 points (was full trajectory)
- Fix: building polygons now tracked in List for proper cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant