Combining Android WiFi-RTT (802.11mc) with multilateration to determine position
This project has been tested with the following:
You need to define a configuration associating the access point mac addresses with the physical location of those access points according to some cartesian coordinate system which you have previously defined. Personally, I used millimeters from the bottom left corner of my house (0,0,0) with x+ going right and y+ going up along the ground floor. This app does NOT have the ability to place APs on a map as it is just used for testing purposes.
(Optional) You then also need to provide a map of the area being ranged and then determine the scaling factor between that map, as displayed in the app and the physical locations of the APs on that map, according to your coordinate system. If you do not provide a map, you can still see your estimated position as text in the MainActivity.
This application will scan for nearby access points that support 802.11mc and determine the distances to any AP which has had its location defined in the app's configuration, according to a user-defined coordinate system. The estimated location of a user will be determined with a 3rd party trilateration algorithm and the resulting estimate.
Several of these estimated positions are averaged together with a weighted mean to determine a more accurate position, avoiding some jitter in the measurements.
The estimated position is then broadcast to interested parties: The MainActivity will display the positions in textual form and the MapActivity will update a pin on a map.
A lot of the calculations to scale my coordinate system to display the pin on my map are hand-coded and would benefit from better commenting (MapActivity.java)
See the Configuration.java file for example AP layouts I used in my testing. You can also adjust the frequency between ranging requests as well as the number of historical points to included in the moving average.