forked from openpositioning/DataCollectionTeam2
-
Notifications
You must be signed in to change notification settings - Fork 30
G13 - WiFi Positioning, Fusion Engine (EKF/PF), Real-Time Display & Tagging Tools, UI update, etc. #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Bol-C14
wants to merge
97
commits into
openpositioning:develop
Choose a base branch
from
Bol-C14:commit_back
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Added WiFi-based EKF update to refine PDR trajectory. Updated `updateFusionWifi()` to convert WiFi location to ENU and apply EKF correction.
Added WiFi-based EKF update to refine PDR trajectory. Updated `updateFusionWifi()` to convert WiFi location to ENU and apply EKF correction.
- Investigated issue where WiFi fingerprint sent to server remained unchanged - Verified WifiDataProcessor was not calling startScan() properly - Confirmed BroadcastReceiver was registered and scanning timer active - Checked wifiScanReceiver and verified it was receiving results correctly - Found that avgRssi in SensorFusion.updateFusion() was always hardcoded to -70 - Refactored SensorFusion#createWifiPositioningRequest to accept real-time RSSI - Updated update(Object[] wifiList) to calculate and pass avgRssi dynamically - Ensured updateFusion uses correct avgRssi from latest WiFi scan results - Improved EKF update precision based on realistic WiFi signal strength
This commit introduces the `CollectionActivity` and `CollectionFragment` to support passive sensor data collection and calibration. - `CollectionActivity`: - Collects sensor data using SensorFusion (IMU, GNSS, PDR, WiFi). - Stores data in a buffer and flushes to a JSON file in the public Downloads folder. - Handles calibration triggers from `CollectionFragment`. - Manages file output (MediaStore for API >= Q, File API for older). - Includes logic for sensor update loop and data flushing. - `CollectionFragment`: - Displays a `TrajectoryMapFragment` for location updates. - UI for calibration: marker placement, floor level, indoor state, building name. - Triggers calibration via the parent's `onCalibrationTriggered` method. - Uses spinners for floor level and indoor state, EditText for building name. - `TrajectoryMapFragment`: - add a public getter method for the underlying GoogleMap instance. - `fragment_collection.xml`: - Layout for `CollectionFragment`, including map container, spinners, and buttons. - `activity_collection.xml`: - Layout for `CollectionActivity`, to hold the `CollectionFragment`. - `arrays.xml`: - Added string-arrays for floor levels and indoor states. - `strings.xml`: - Added strings for floor level, indoor state, and building name. - `SensorFusion`: - Added `getAllSensorData()` for unified sensor data retrieval as a JSON object. - `HomeFragment`: - added a button to open `CollectionActivity`. - `AndroidManifest.xml`: - declare `CollectionActivity`.
- Updated `CollectionFragment` to support multi-point calibration and improve marker handling. - Modified `TrajectoryMapFragment` to handle calibration pin placement and confirmation. - Refactored `IndoorMapManager` to improve overlay refresh logic and track building context. - Added new drawable `ic_baseline_assignment_turned_in_24_red` for tagged position. - Updated floor and indoor state arrays for better labeling. - Modified `CollectionActivity` to pass `floorLevel` as `-255` for outdoor.
Feat: Tagging system first done
TODO: fix wifi data collection - Modify the data output file name to include the device model. - Update the label of `FloorTransitional` to `Stairs`. - Add sensor data for filtered acceleration, rotation vector, orientation, step count, proximity, light, pressure, WiFi positioning, device model. - Add a heading computation method. - Log errors in sensor data JSON construction.
# Conflicts: # build.gradle
This commit integrates WiFi positioning into the data collection and fusion process, alongside improvements to the alignment strategy. Key changes include: - In CollectionActivity.java, WiFi positioning requests are now made periodically (every 8 seconds) using the available WiFi BSSID and RSSI values. - The machine learning pipeline (main.py) now supports selecting either WiFi or GNSS for positioning. It also incorporates a new piecewise Procrustes alignment for better accuracy. - EKF fusion (ekf.py) can now use either GNSS or WiFi data based on the chosen option. - The plotting script (plotting.py) has been updated to visualize WiFi positions and calibration points more clearly. - SensorFusion.java and related files have been modified to handle and process WiFi data, including a new utility class SensorFusionUtils for organizing sensor data.
introduction of caching mechanism with step-synchronised updates, addition of fusion latency logs
β¦_Dev_CW2 into tagging_system
β¦script This commit introduces an LSTM model for indoor positioning using WiFi RSSI data and includes a script to check RSSI data quality. - Implemented an LSTM model to predict latitude and longitude coordinates from WiFi BSSID and RSSI data. - Added a script `rssi_check.py` to analyze RSSI data, checking for inconsistencies between RSSI similarity and location proximity, and RSSI variance at the same location. - Included visualization of RSSI data in PCA space colored by latitude. - Updated the main script to preprocess data, train the LSTM model, evaluate performance, and visualize results. - Added normalization of latitude and longitude coordinates and saved normalization parameters. - Implemented a custom loss function considering both MSE and distance penalty.
Replaced unused elevation-based auto floor logic with Wi-Fi floor detection
β¦terface Provided `getGnssAccuracy()` accessor for external use;
- Implemented RSSI conversion from dB to linear scale in `rssi_check.py`. - Added a multi-input (WiFi + sensor) time-series LSTM model in `embedding_train_LSTM.py`. - Modified data loading and preprocessing to include sensor features and build time-series samples with a sliding window in `embedding_train_LSTM.py`. - Refactored `embedding_train.py` to include normalization of RSSI and coordinates, and to calculate and print mean and standard deviation of prediction errors. - Updated UI layouts (`fragment_collection.xml`, `fragment_home.xml`, `strings.xml`) to align with indoor positioning features. - Added a predictor for indoor positioning in `SensorDataPredictor.java`, including loading a TFLite model and bssid index mapping, and performing inference with WiFi data. - Updated map display in `TrajectoryMapFragment.java`.
Fixed the ENU trajectory update after PDR step detection by ensuring the correct heading reference and conversion to radians. The update formula now uses ΞE = L * sin(ΞΈ) and ΞN = L * cos(ΞΈ), where ΞΈ is the heading relative to true north. - Improved the EKF.predict() method to use the same step length and heading as the PDR module for state updates, ensuring consistency and avoiding duplicate or lagged updates. - Adjusted EKF.getEstimatedPosition() to consistently use refLat, refLon, and refAlt as the reference point, and corrected the coordinate transformation between ENU and geodetic coordinates so that the EKF output aligns with the pure PDR trajectory when no GNSS/WiFi corrections are available. - Reviewed and fixed the drawing logic in TrajectoryMapFragment/PathView to correctly accumulate trajectory points and perform proper coordinate conversion, thereby eliminating jump or discontinuity issues in the displayed path. - Ensured proper EKF initialization and state maintenance to avoid sudden jumps due to reference point changes or reinitialization issues.
- Refactored PDR processing for better elevation handling, including filtering invalid elevation readings and using a median-based initialization. - Improved trajectory map display by optimizing camera tracking and marker updates. - Updated sensor fusion logic to include WiFi data in trajectory recording. - Enhanced recording fragment to ensure context validity and delay the start of sensor fusion recording. - Added a loading fragment layout for UI feedback during initialization. - Improved data flushing in DataFileManager, reducing verbosity of logs. - Minor improvements in trajectory plotting and trajectory file management.
β¦dates - Updated SensorFusion to retrieve the latest GNSS position from `sensorFusion.getSensorValueMap()` instead of `gnssProcessor.getLastKnownLocation()`. - Modified GNSS location instantiation to use values from the sensor value map. - Adjusted the condition for using GNSS updates in the EKF, increasing the GNSS update interval to 3 seconds and checking `!useWiFi`. - Updated initial location retrieval to use GNSS coordinates from the sensor value map, ensuring the usage of the latest available GNSS data.
β¦rrors for PDR, GNSS, and WiFi This commit enhances the calibration process by providing real-time feedback on the accuracy of different positioning methods (PDR, GNSS, and WiFi). It introduces a new utility class for error calculation and updates the CalibrationFragment to display both current and average errors, aiding users in assessing system performance. - Added `CalibrationUtils` class with methods to calculate distances between LatLng points using the Haversine formula and to compute calibration errors for GNSS, PDR, and WiFi positions relative to a marked location. - Modified `CalibrationFragment` to: - Display current and average errors for PDR, GNSS, and WiFi. - Calculate and accumulate errors upon each calibration tag. - Update UI to show these error metrics in real-time. - Updated `fragment_calibration.xml` layout to include a `TextView` for displaying error information. - Adjusted UI elements in `fragment_calibration.xml` for better layout and readability. - Modified navigation flow in `CorrectionFragment.java` to move to `RecordingFragment` after correction. - Adjusted Handler usage in `MainActivity.java` to ensure proper execution on the main thread. - Added text size and input type to building name edit text in `fragment_calibration.xml`
- Updated `CalibrationFragment.java` to convert PDR positions from meters to latitude/longitude degrees for accurate error calculation. - Modified `SensorFusion.java` to use the latest GNSS accuracy and added a temporary GNSS location to set the accuracy for the fused location.
- Added closing of the data file in `CalibrationFragment.java`. - Replaced the hardcoded Google Maps API key with a placeholder in `googlemaps_api.xml` and added a string resource for the placeholder. - Moved `EKF.java` and `ParticleFilter.java` from `FusionAlgorithms` package to `domain` package. - Updated references to `EKF` and `ParticleFilter` in `SensorFusion.java` to reflect the package change. - Updated `build.gradle` to use `resValue` for the Google Maps API key and removed the `buildConfigField` for it. - Updated `build.gradle` to remove optional loading of secrets file.
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.
π°οΈ Pull Request β Indoor Positioning Project Contribution
Author: Shu Gu
Team Members: Lin Chen, Lai Gan, Aaniket Nayak
Date: April 3, 2025
π Summary
This PR introduces the following major improvements and extensions to the PositionMe app, in response to the assignment requirements:
These contributions significantly improve both the positioning accuracy and user experience of the app.
π¦ Whatβs New
1. β Integrated: WiFi Positioning Module for #17
2. β¨ New: Fusion Engine
Implemented sensor fusion combining:
Two fusion modes are implemented:
EKF.java) for EKF positioning fusionΒ #20ParticleFilter.java) for Particle filter Positioning fusionΒ #21Both are coordinated through the
SensorFusion.javaclass:Code files modified/added:
SensorFusion.javaEKF.javaParticleFilter.javaDomainUtils.java3. πΊοΈ Updated: Data Display and Tracking
TrajectoryMapFragment.javaStatusBottomSheetFragment.javaSmoothingFilter.javaCalibrationFragment.java(Not implemented with protobuf due limited time constraints and ML training requirement, but can be easily migrated)/downloadfolder using .json for Improve file savingΒ #1 seeDataFileManager.javaandSensorFusionUtils.javaπ§ Notes
/assetsmachine_learning/π Checklist
πΈ Screenshots