Open
Conversation
On app start, wait for either a GNSS fix or a WiFi positioning result — whichever comes first Set that as the origin of the easting/northing frame Initialise the particle filter particles spread around that origin (Gaussian spread based on the accuracy of the source — GNSS accuracy field, or ~20–30m for WiFi) No button press or user selection needed
On app start, wait for either a GNSS fix or a WiFi positioning result — whichever comes first Set that as the origin of the easting/northing frame Initialise the particle filter particles spread around that origin (Gaussian spread based on the accuracy of the source — GNSS accuracy field, or ~20–30m for WiFi) No button press or user selection needed
Reduce particle count and add step-based prediction for the particle filter. ParticleFilter: NUM_PARTICLES lowered from 1000 to 200 for performance, added HEADING_NOISE_STD and STRIDE_LENGTH_NOISE_STD, and a predict(deltaEasting, deltaNorthing) method that updates particles using noisy heading/stride. SensorEventHandler: introduced a StepListener, tracks last easting/northing and emits delta steps to the listener when new PDR coordinates arrive. SensorFusion: instantiate WifiDataProcessor before registering observers and register wifiPositionManager on it; wire eventHandler.setStepListener to call particleFilter.predict when initialized. These changes connect PDR step outputs to the particle filter and reorder WiFi observer registration.
Implement updateGNSS in ParticleFilter: convert WGS84 GNSS fix to ENU, compute Gaussian likelihood weights using provided accuracy (variance = sigma^2), normalize and perform systematic resampling, then reset weights and log the update. Integrate into SensorFusion: use GNSS fix and accuracy to initialize the particle filter on first fix or call updateGNSS on subsequent fixes. Small cleanup of commented initialization code.
Wire up a ParticleFilter-based fusion pipeline and use its fused position in the UI. Key changes: - RecordingFragment: replace commented PDR/GNSS sample code with use of sensorFusion.getFusedPosition() to update the map with the fused location and orientation. - ParticleFilter: format/cleanup, add updateWiFi(...) to weight/resample particles using a WiFi measurement, add getFusedPosition() to compute a weighted mean and convert ENU->WGS84. Implements weight normalization and resampling. - SensorFusion: instantiate a single ParticleFilter instance, hook the step listener to call predict(...), register a WiFi observer that initializes the particle filter on first WiFi fix (20m spread) and calls updateWiFi(...) afterwards, and initialize/update the particle filter on GNSS fixes (using reported accuracy or 20m default). Add a getFusedPosition() wrapper. These changes enable fused-position output from particle filtering (GNSS + WiFi + PDR predict) and simplify map updates to use the fused estimate.
Particle filter
All working except wifi. and will change the UI a little bit to make it neater
Introduce wall-aware particle filtering and automatic floor-change detection. - ParticleFilter: add walls list and setWalls(), increase heading/stride noise, detect segment-wall intersections during predict(), reflect particles on collision, normalize weights and centralize resampling logic, and change GNSS/WiFi weight updates to multiply likelihoods (keep prior weight). Adds helper functions doIntersect, intersectsWall, normalizeWeightsAndResample, and resample. - SensorFusion: hook pressure sensor updates to new floor logic; add updateFloorLogic() that inspects barometer buffer, compares against configured floor height and building floor shapes, and classifies transitions (lift vs stairs) to update PDR floor. Add getParticleFilter() and setPdrWalls() to convert polyline PointF lists into float[] wall segments for the particle filter. - PdrProcessing: remove in-class wall collision correction and related setWalls(), simplify constructor and map-matching dependency, expose start elevation, elevation buffer, floor getters/setters, and use a fixed default floor height fallback (4m). Rationale: move wall collision handling into the particle filter for centralized collision correction and resampling, and add floor-change detection using pressure/barometer data and floorplan geometry so the fusion can update PDR floor state automatically. Also cleans up resampling and weight handling.
Data_Display_wifi_not_working
Map data guards
Parse and apply API-provided visual properties (stroke_color, fill_color, stroke_width) to MapShapeFeature and use them when drawing polygons/polylines. Add clickable building polygons with tags and Toasts, and introduce one-shot floorplan fetching that caches BuildingInfo into SensorFusion and updates IndoorMapManager. Support pre-rendered PNG ground overlays for Nucleus/Library (with bounds and transparency) and fall back to vector shapes for other buildings; clear overlays correctly. Harden auto-floor logic: only trust WiFi floor when the last WiFi fix is fresh (30s), record WiFi fix timestamps, expose isWifiPositionFresh(), add horizontal acceleration magnitude to distinguish LIFT vs STAIRS and reject UNKNOWN mode. Misc: reset fetch state on stop, center camera on building when indoor map first appears, and minor UI/stroke defaults and robustness fixes.
Make GNSS/WiFi/PDR switches checked-by-default in the layout and set isGnssOn to true in TrajectoryMapFragment to match the UI default. Also call updateWallsForPdr() immediately after a floorplan is fetched so wall geometry is available to the particle filter as soon as the floorplan arrives (improves PDR/wall constraint behavior even when auto-flooring is disabled).
Added setting button and then all switches, gnss, etc are visible
Prevent duplicate WiFi points and empty API calls: RecordingFragment now tracks lastSentWifiPosition to avoid flooding history with identical fixes; WifiPositionManager skips requests when no APs were scanned and improves debug logging with AP count. Allow reinitialisation of particle filter: ParticleFilter.reset() clears state so the filter can be re-seeded. SensorFusion.setStartGNSSLatitude now resets and re-seeds the particle filter at the user-chosen start location (5 m spread) and updates lastGnssForFilter. PDR initialization tweaks: PdrProcessing now has a non-null MapMatchingConfig (initialized with defaults) and reset logic clears elevation/setup indices so elevation baseline is recalibrated on reset.
Remove special-case PNG ground overlays for Nucleus/Library and always use API vector drawing. setCurrentFloor now requires currentFloorShapes to be present, uses currentFloorShapes.size() for bounds, and always calls drawFloorShapes. The building-detection path was simplified to always draw vector shapes when available and no longer calls showGroundOverlay.
Multiple changes to reduce visual drift indoors, improve wall handling and show uncertainty. - RecordingFragment: remove time-based forced updates; only update displayed fused point on first point or when movement exceeds 0.5 m (prevents 1s drift updates). Simplified logging and removed last-update timestamp tracking. - TrajectoryMapFragment: add an accuracy circle (radius = particle-cloud RMS) and fade/orient marker when stationary; animate camera instead of jumpy moveCamera; sync floorplan color with trajectory toggle; change history dot rendering to higher base alpha and smaller dots; prevent drawing trajectory segments that would cross floorplan walls by consulting particleFilter.wouldCrossWall(); clean up accuracy circle on reset. - ParticleFilter: reduce roughening std (0.3 -> 0.08 m) to limit stationary drift; avoid reversing particles on wall intersection (keep particle at old position); ensure roughening doesn't place particles through walls; add public wouldCrossWall(LatLng,LatLng) for map-layer collision checks; inflate GNSS measurement uncertainty indoors (×3) to avoid pulling particles through walls; add getPositionUncertaintyMeters() to compute RMS particle spread. - SensorFusion: implement stationary detection using rolling variance of linear-acceleration (window=20) and expose isStationary(); suppress PDR step-prediction and WiFi-driven particle updates while stationary to avoid WiFi/GNSS jitter moving the dot; expose getPositionUncertaintyMeters() for UI. - IndoorMapManager: remove hard overlay shifts, add dynamic floorPlanColor with setter and redrawCurrentFloor(), and use the active color for wall/room stroke & fill so floorplan visuals match trajectory color. These changes reduce perceived jitter when the device is still, prevent trajectories from being drawn through walls, and surface position uncertainty for improved map UX.
Have TrajectoryMapFragment.updateUserLocation return a boolean indicating whether the GoogleMap was ready and the update was rendered, and only update RecordingFragment.lastSentFusedPosition when that call returns true. This prevents losing the "first-point" slot if gMap is still null during the fragment creation → onMapReady window, allowing the next tick to retry the initial render instead of skipping it.
Rework floor-change and map-matching behavior and harden the particle filter. - SensorFusion: rewrite updateFloorLogic to use a fixed Nucleus floor height (5.5 m), require a 40% floor-height threshold before considering a change, compute absolute target floor, and only commit lift changes when barometric elevation is within a snap tolerance (0.8 m) and horizontal movement is low. Adds constants for nucleus floor height and lift snap tolerance and logs committed changes. - TrajectoryMapFragment: add a lift snap guard that prevents committing floor transitions mid-ascent/descent unless barometer is within 15% of the target level when horizontal accel is very low. - RecordingFragment: display barometric elevation immediately (no PDR needed) by moving elevation UI update earlier in updateUIandPosition(). - ParticleFilter: add per-particle heading bias (initial bias and slow random-walk drift), apply bias when predicting headings, persist bias during resampling, and switch GNSS/WiFi likelihoods to a robust Student-t (nu=4) formulation with tighter weight-underflow thresholds. Keep wall intersection handling and propagation logic. - IndoorMapManager & MapMatchingConfig: update default Nucleus floor height to 5.5 m and adjust map-matching defaults (baro threshold and feature proximity) to better match the new floor-height assumptions. These changes aim to reduce false floor detections (especially in lifts), improve resilience to GNSS/WiFi outliers, and model systematic compass/heading bias in the particle filter.
Tighten and clarify sensor-fusion behaviour and add debug logging. Imports android.util.Log and adjusts WiFi initialization to prefer WiFi indoors (initial spread 15m). Adds divergence recovery: compares fused position vs WiFi anchor using particle uncertainty and resets+re-initialises the filter if distance > max(2.5×uncertainty, 20m), otherwise applies WiFi update. Slightly changes WiFi update flow to guard null fused state. Inflate GNSS initialization spread aggressively (initSpread = max(accuracy*4, 25m) ) to account for indoor multipath so WiFi corrections can converge without frequent resets. Add debug TAGs/logs for floor-change handling and temporarily comment out stairs floor-set to avoid unintended updates.
Ensure wall geometry is built in the same ENU frame as the particle filter by using the particle filter origin when available (prevents particles appearing to pass through walls). Add SensorEventHandler.resetStepOrigin() and call it when starting recording so the PDR step-delta baseline is synced after resetPDR(), avoiding a large spurious first-step delta. Add GNSS outlier gating in SensorFusion: when filter uncertainty is low, reject GNSS fixes that are implausibly far from the fused position (offset > max(2.5×accuracy, 20m)) and log rejections. Minor comments and formatting adjustments included.
Ensure wall geometry is built in the same ENU frame as the particle filter by using the particle filter origin when available (prevents particles appearing to pass through walls). Add SensorEventHandler.resetStepOrigin() and call it when starting recording so the PDR step-delta baseline is synced after resetPDR(), avoiding a large spurious first-step delta. Add GNSS outlier gating in SensorFusion: when filter uncertainty is low, reject GNSS fixes that are implausibly far from the fused position (offset > max(2.5×accuracy, 20m)) and log rejections. Minor comments and formatting adjustments included.
Multiple fixes and enhancements to positioning, map rendering, and autofloor behavior: - RecordingFragment: increased UI refresh rate from 200ms to 16ms for ~60fps marker/camera animation. - TrajectoryMapFragment: - Track particle-filter origin and rebuild wall geometry when PF origin changes to keep ENU frames aligned. - Use lastPolylinePoint as the drawn-anchor so rejected segments don't advance the anchor; prevents permanent stuck trajectories when wall collisions occur. - Reset lastPolylinePoint and lastWallBuildOrigin when clearing state. - applyImmediateFloor and evaluateAutoFloor: remove WiFi priority; auto-floor now uses PDR/barometric floor only and is restricted to lift proximity with low horizontal accel and snap-to-floor tolerance (prevents staircase/adjacent-floor WiFi false triggers). Debounce retained. - ParticleFilter: when a simulated step intersects a wall, attempt sliding the particle along the first blocking wall's tangent (if clear) instead of freezing — reduces particle clustering at boundaries. - SensorFusion: set rotation sensor sampling to 10000 (100 Hz) so heading updates faster than step rate. - IndoorMapManager: added isNearLift(radius) used by auto-floor guards; feature stroke/fill colors adjusted so walls/stairs/lifts are visually distinct (wall=red, stairs=yellow, lift=green). Rationale: smoother UI animation, correct wall-intersection behavior by keeping ENU frames in sync, avoid false floor changes near stairs or due to WiFi bleed, reduce particle-filter bias at walls, and ensure heading is sampled quickly enough for PDR accuracy.
Multiple fixes and improvements across sensor fusion, PDR, mapping and utilities: - TrajectoryMapFragment: add floor transition sentinel, minimum polyline distance, use position uncertainty to gate wall-cross checks, auto-enable auto-floor switch when indoor map is set, tighten barometer->floor thresholds and skip auto-floor during transition zone, add logging. - ParticleFilter: add hasWalls(), make GNSS variance much larger when walls present to avoid dragging particles through walls. - SensorEventHandler: robust step handling — debounce min step interval, heading jump smoothing/acceptance, require peak acceleration, clear/reset step origin/state updates and avoid spurious updates during noisy input; reorder and simplify logic. - SensorFusion: heading-bias calibration while stationary, expose getHeadingBias(), reset calibration on session start, stricter GNSS rejection indoors, call heading calibration update on rotation-vector events. - IndoorMapManager: simplify auto-floor bias (now 0), more defensive setCurrentFloor handling when floor shapes missing, default currentFloor adjustments for detected buildings. - PdrProcessing: add simple Kalman-style smoothing for step length with process/measurement noise and bounds, safe bounce calc, reset KF state on init, return sensible default average step length when none recorded. - UtilFunctions: fix degreesToMetersLng math (use cos instead of divide). These changes aim to improve trajectory drawing stability, reduce false floor switches and GNSS-induced jumps indoors, and stabilize step length estimation.
…into good_branch
Author
|
team 15 |
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.