Skip to content

Pull Request for Assignment2 by Group10#121

Open
ning-gogo wants to merge 97 commits intoopenpositioning:developfrom
ning-gogo:develop
Open

Pull Request for Assignment2 by Group10#121
ning-gogo wants to merge 97 commits intoopenpositioning:developfrom
ning-gogo:develop

Conversation

@ning-gogo
Copy link
Copy Markdown

##Positioning Fusion##
Implemented an Extended Kalman Filter (EKF) fusing PDR, WiFi and GNSS. A direction-consistency check rejects fixes that contradict the current walking trend. A gating approach (Mahalanobis distance) further filters out outlier observations. A particle filter is also available as an alternative fusion mode, selectable from Settings.

##Map Matching##
Used the IndoorMap GeoJSON to constrain movement at runtime. The EKF position is wall-slid after each PDR step so the path follows corridors naturally. Floor changes are detected via the barometer and are only accepted near stairs or lifts identified in the map data.

##Data Display##
Live fused trajectory is drawn every second with an optional low-pass filter for smoother rendering. Colour-coded observation dots show the last N fixes from each source (GNSS/WiFi/PDR) independently. An uncertainty circle around the fused marker reflects current filter confidence.

ning-gogo and others added 30 commits February 8, 2026 01:27
Major Changes:
- Add trajectory_id field for trajectory identification
- Add initial_position field (GNSSPosition)
- Add test_points field for teammate positioning algorithms
- Add 7 sensor_info fields (accelerometer, gyroscope, etc.)
- Add WiFi RTT support (rtt_enabled field)
- Add detailed BLE fields (mac_address, name, tx_power, etc.)

API Changes:
- Rename Proto classes: Pdr_Sample→RelativePosition, GNSS_Sample→GNSSReading, etc.
- Use Vector3/Quaternion for IMU data
- Nest position data in GNSSReading.position
- Update method names: addWifiData→addWifiFingerprints, etc.

Dependencies:
- Update protobuf-java to 4.29.6 (matches protoc version)
Files Modified:
- Traj.java (regenerated from proto)
- SensorFusion.java (updated API calls)
- ServerCommunications.java (updated API calls)
- app/build.gradle (protobuf dependency updated)
Features:
- Show input dialog when user clicks Set button
- User enters trajectory name before recording starts
- Name saved to trajectory_id field in Proto
- Auto-generate name with timestamp if empty

Implementation:
- Added showTrajectoryNameDialog() in StartLocationFragment
- Added setTrajectoryName() and getTrajectoryName() in SensorFusion
- Set trajectoryId when creating Trajectory object
Features:
- Capture initial GPS position when recording starts
- Save latitude, longitude, altitude to initial_position field
- Log initial position for verification

Implementation:
- Added altitude member variable in SensorFusion
- Added initialLatitude, initialLongitude, initialAltitude variables
- Added setInitialPositionData() method
- Set initial_position in Trajectory.newBuilder()
- Call setInitialPositionData() before startRecording()
Features:
- Capture initial orientation (rotation vector) when recording starts
- Save quaternion (x, y, z, w) as first IMU reading
- Initial orientation has timestamp 0 (starting point)

Implementation:
- Added initialRotation[4] array to store initial quaternion
- Modified setInitialPositionData() to capture rotation vector
- Add first IMU reading with initial orientation in startRecording()
- Log initial orientation for verification
Added missing sensor info:
- rotation_vector_info
- proximity_info

All 7 sensor info fields now recorded:
✅ accelerometer_info
✅ gyroscope_info
✅ rotation_vector_info
✅ magnetometer_info
✅ barometer_info
✅ light_sensor_info
✅ proximity_info
Features:
- Prevent duplicate WiFi fingerprints when user is stationary
- Use 80% overlap ratio instead of exact match
- Handle unstable WiFi signals intelligently

Implementation:
- Added lastWifiFingerprint to store previous fingerprint
- Added isSameFingerprintAs() to compare fingerprints
- Modified update() to check for duplicates before adding
- Reset lastWifiFingerprint in startRecording()

Logic:
- If overlap ratio >= 90%, skip duplicate
- If WiFi count < 3, always record (need more data)
- Calculate overlap based on common MAC addresses
Optimizations:
✅ BLE device list deduplication with dynamic thresholds
✅ WiFi fingerprint RSSI change detection

BLE Deduplication:
- Dynamic overlap thresholds based on device count:
  * Many devices (≥20): 50% overlap or 15+ common devices
  * Medium devices (≥10): 60% overlap or 8+ common devices
  * Few devices (<10): 70% overlap or 5+ common devices
- Prevents recording identical BLE device lists when stationary
- Adapts to different BLE environments automatically

WiFi RSSI Comparison:
- Added RSSI change detection (5 dBm threshold)
- Considers fingerprint duplicate if:
  * MAC overlap ≥ 80% AND
  * RSSI changes < 30% (fewer than 30% of APs changed significantly)
- More accurate duplicate detection for stationary users
- Prevents false positives from minor signal fluctuations

Implementation:
- Modified SensorFusion.java:
  * Added lastBleDeviceList variable
  * Added isSameBleDeviceList() with dynamic thresholds
  * Enhanced isSameFingerprintAs() with RSSI comparison
  * Updated updateBleData() with deduplication logic
  * Reset deduplication state in startRecording()
Features:
✅ Real-time trajectory info card with collapse/expand functionality
✅ Display trajectory name in card header
✅ Show initial position (Lat, Lon, Alt) - single line format
✅ Show initial orientation (quaternion)
✅ Live data counters: WiFi Fingerprints, BLE Devices, IMU Readings
✅ Card defaults to collapsed state to maximize map view
✅ Click header to toggle card expansion

Implementation:
- Modified fragment_recording.xml: Added collapsible trajectoryInfoCard
- Modified RecordingFragment.java:
  * Added card UI bindings and collapse functionality
  * Added updateInitialPosition/Orientation methods with delayed updates
  * Added live data tracking (WiFi/BLE/IMU counts)
  * Integrated with SensorFusion to get real-time data
- Added getter methods in SensorFusion.java:
  * getBleDeviceList()
  * getTrajectory()

UI Design:
- Collapsed: Shows only trajectory name and expand arrow
- Expanded: Shows all initial data and live statistics
- Uses text arrows (▶/▼) for expand/collapse indicator
- Compact single-line format for position data
- Monospace font for better number alignment

Data Tracking:
- WiFi Fingerprints: Actual recorded fingerprints (cumulative)
- BLE Devices: Actual recorded device lists (cumulative)
- IMU Readings: Total sensor readings count
- All counters update in real-time during recording
Add lastGnssLatLon, lastWifiLatLon, lastPdrLatLon fields and getters
so Data Display can show colour-coded dots for GNSS, WiFi and PDR.
Fix lastPdrLatLon off-by-one-step bug. Null all three on reset.
…tstrap \

1.expose getSigmaMetres() and getPositionUncertainty() for UI confidence circle \
2.reduce motion noise when stationary to prevent particle drift \
3.initialise particle filter from first WiFi position if GNSS unavailable
B3: add resetAroundPosition() to ParticleFilter, track lastKnownFloor
in SensorFusion and widen particle cloud by 8m on barometer floor change
sydneysavarese and others added 30 commits March 30, 2026 19:13
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.

3 participants