Group 9 — Assignment 2#117
Open
Saleh-AlMulla wants to merge 34 commits intoopenpositioning:developfrom
Open
Conversation
Implemented observation-based trajectory visualisation for PDR, GNSS, and WiFi: 1. Added distance-based filtering (1m for PDR, 3m for GNSS) to suppress noisy updates 2. Introduced capped observation markers (PDR: 20, GNSS/WiFi: 5) to prevent map clutter 3. Implemented continuous PDR trajectory polyline (orange) 4. Added WiFi observation integration with graceful null handling 5. Ensured full reset of markers and trajectories between recordings
Introduce a MapMatchingEngine and Particle classes implementing a particle-filter based indoor map-matching (PDR propagation, wall/stairs/lift constraints, WiFi/GNSS likelihoods and systematic resampling). Integrate the engine into the app lifecycle: SensorFusion now owns the engine and exposes initialise/getter methods; SensorEventHandler calls predict() on each PDR step (uses new lastPdrX/Y in SensorState); WifiPositionManager forwards WiFi fixes to the engine; StartLocationFragment initialises the filter when recording begins inside a known building. Includes utilities for geometry checks, floor transition logic and estimated position/floor outputs.
Commented out a Log.d debug statement inside the particle prediction loop in MapMatchingEngine to reduce log noise during normal runs while preserving the code for future debugging.
Refactor and harden the map-matching engine: reorganised tunable parameters and comments, lowered wall penalty, increased initial spread, added resample jitter and a lift horizontal threshold. Improved floor-transition logic to use barometric baseline deltas and accumulated horizontal movement to distinguish stairs vs lifts, with clamped floor updates and safer polygon/wall checks (guard against zero-length closing rings). Added systematic-resampling jitter, weight-collapse recovery, small performance/cleanup changes (loop/variable inlining), and various debug logging counters/TODOs. Integrations and bugfixes: WiFiPositionManager now feeds WiFi fixes into both FusionManager and the MapMatchingEngine (previously missing), and includes Volley callback handling and logging. SensorFusion and SensorEventHandler reset PDR baselines to avoid a large initial step spike after map-matching initialisation. RecordingFragment UI cleanup: minor layout/flow adjustments, dialog handling simplifications, periodic logging of position source, and other small UI/refresh fixes.
Adjust map-matching tuning and robustness: reduce WIFI_SIGMA (8->5) and resample jitter (0.5->0.2); add floor-transition guards (raised floor change threshold 2->4m, warmup period, sustained-steps requirement, min steps between changes) to avoid barometric false positives; classify lift vs stairs by horizontal motion and always apply barometric floor assignment while penalising particles not near transitions. Improve resampling and particle handling: wall-aware jitter (discard jitter that would cross walls), harsher wall-crossing penalty in predict, trigger resample on GNSS/low ESS, and reduce WiFi floor-mismatch penalty (0.1->0.4) so WiFi corrections pull particles. Add position output improvements: wall-aware fallback to best particle if mean lies across a wall, plus EMA smoothing with snap threshold for large corrections. Also update WifiPositionManager to use the tighter 5.0f WiFi parameter. Changes affect MapMatchingEngine.java and WifiPositionManager.java.
Adjust MapMatchingEngine parameters and behaviour to improve stability and UX: reduce EMA alpha to 0.25, increase snap threshold to 20m and wall-fallback threshold to 5m. Add lost-filter recovery on WiFi updates (reinitialise particles around WiFi fix and reset EMA to prevent trace smearing). Simplify/rescue wall-cross handling and make resampling wall-aware. Update RecordingFragment to prioritise MapMatchingEngine as the primary position source, wait for the engine to be active before drawing traces, initialise raw PDR from the engine start to keep traces consistent, and streamline GNSS/WiFi observation display logic and logging. Miscellaneous comment cleanups and small formatting/refactor changes across both files.
Refactor and harden map-matching and fusion logic. MapMatchingEngine: - Large overhaul: clarify Javadoc, reorganise constants/state and add section comments (§3.2). - Tuned particle filter parameters (NUM_PARTICLES, PDR noise, WIFI/GNSS sigma, WALL_PENALTY, etc.). - Add building-outline support (setBuildingOutline + constrainPosition) with ray-casting point-in-polygon to hard-snap FM output when outside the building. - Implement wall-aware particle propagation: penalise particles that cross walls, improve wall-segment intersection checks, and add post-resample jitter guarded by wall checks. - Improve lost-filter recovery on WiFi fixes (higher outlier threshold, reinit with WiFi and reset smoothed output/outline tracker). - Revise floor transition logic: warmup, sustained-step guard, min-gap between transitions, stair vs lift classification by horizontal displacement, and proximity bonuses/penalties for transition features. - Simplify and optimise utility functions (segment intersection, cross/on-seg helpers), smoothing (EMA) and effective sample size/resampling. FusionManager: - Documented and added §3.1 summary for the fusion component. - Adjust display smoothing alpha and add WiFi/GNSS handling improvements. - Add WiFi death-spiral recovery counters and WiFi outlier gate logic to force re-centre after consecutive rejections. - Minor API and reset/state hygiene changes. Overall: these changes implement map- and barometer-based floor/fence guards, improve robustness to drift and weight collapse, and tighten GNSS/WiFi integration for indoor scenarios.
Adjust various heuristics and smoothing values to make floor detection and pose updates more responsive and stable. Changes: - MapMatchingEngine: lower FLOOR_CHANGE_ELEVATION_THRESHOLD 4.0->2.0m, ELEVATION_SUSTAIN_STEPS 5->2, MIN_STEPS_BETWEEN_FLOOR_CHANGES 10->3, FLOOR_TRANSITION_WARMUP_MS 30000->5000ms to detect floor transitions faster. - ParticleFilter: increase WIFI_SIGMA_DEFAULT 10.0->14.0 to reduce over-correction from WiFi observations. - RecordingFragment: increase HEADING_SMOOTHING_ALPHA 0.20->0.40 for stronger heading smoothing. - TrajectoryMapFragment: reduce AUTO_FLOOR_DEBOUNCE_MS 3000->500ms and cap observation lists (PDR/GNSS/WIFI) from 3/5/5 to 2/2/2 to limit displayed markers. These are tuning changes to improve responsiveness; be aware they may increase sensitivity to noisy measurements and should be validated on-device.
Added SwitchMaterial toggle (Smooth Path) to fragment_trajectory_map.xml Catmull-Rom smoothing applies only to orange (fused) polyline, never red (raw PDR) Mid-recording toggle only smooths future points via catmullStartIndex, history stays raw rawPdrPoints stores accepted orange-line waypoints as smoothing source Segments >5m apart drawn as straight lines to prevent spikes on sharp turns/GNSS dropouts clearMapAndReset() clears rawPdrPoints and resets catmullStartIndex for new sessions
Adjust particle filter and UI smoothing constants: lower WIFI_SIGMA_DEFAULT from 14.0 to 10.0 in ParticleFilter to make WiFi observations slightly more confident, and reduce HEADING_SMOOTHING_ALPHA from 0.4f to 0.20f in RecordingFragment to increase heading smoothing and further reduce arrow jitter on the map. These are small tuning changes to balance responsiveness and stability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.