Find: High-precision indoor positioning framework for most wifi-enabled devices

@LeXLuther422, the MQTT server posts on any incoming /track fingerprint, and your device should be sending a fingerprint every 2-3 seconds, so that sounds about right! Its a lot better than the polling I have to do on the dashboard which pings every 2 seconds no matter what…

Btw, thanks for adding an Application integration page - it looks great! :slight_smile:

@schollz I’ve emailed you the database. I also checked the console logs and noticed the webserver is still receiving /track requests so you may be correct with it being server-based rather than client.

I asked the question before but still haven’t got my head around this…
I’ve got a local (but not the same server as Find) MQTT server. Does the Find server need mosquitto installed to post to the local mosquitto server? Or does Find contain a MQTT client?

I failed to get the ‘fingerprint’ client running on my OH machine (a RPi2 running jessie).
fingerprint tries to execute /sbin/iw dev wlan0 scan -u, but that fails. iwlist works meanwhile. Found that to be a somewhat known bug of the iw package, but have not found any solution.
@danielwalters86, can you provide any hint?

@mstormi As of version 0.4, you can use the fingerprint client with iw or iwlist. Currently iw is default. To use iwlist just run

sudo ./fingerprint --iwlist

What version of jessie are you using? I didn’t have that problem using the image from earlier this year.

Currently, yes, mosquitto needs to be installed if you want to use MQTT. When you start FIND you also need to set flags to tell it how to talk to mosquitto.

Not yet…would this be useful for you? There is a great MQTT library by Jeff Allen that could be incorporated I think. mosquitto was more of a quicky and easy (read: lazy) way. :smile:

@danielwalters86, Sorry I don’t know whats going on! I went through your fingerprints. Nothing out of the ordinary - I was able to track all of them just fine. Please let me know if you hit the problem again so I can track this bug down.

Definitely still happening. Can you differentiate between fingerprints sent whilst the app is foreground and background?

Here’s my console log:
May 14 12:32:29 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:29 | 200 | 1.331302ms | 192.168.0.100 | POST /track May 14 12:32:32 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:32 | 200 | 893.802µs | 192.168.0.100 | POST /track May 14 12:32:35 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:35 | 200 | 822.708µs | 192.168.0.100 | POST /track May 14 12:32:38 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:38 | 200 | 832.969µs | 192.168.0.100 | POST /track May 14 12:32:41 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:41 | 200 | 826.458µs | 192.168.0.100 | POST /track May 14 12:32:44 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:44 | 200 | 820.156µs | 192.168.0.100 | POST /track May 14 12:32:47 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:47 | 200 | 823.177µs | 192.168.0.100 | POST /track May 14 12:32:47 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:47 | 200 | 1.044584ms | 192.168.0.14 | GET /location May 14 12:32:50 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:50 | 200 | 824.063µs | 192.168.0.100 | POST /track May 14 12:32:53 raspberrypi find-2.1-linux-arm[15721]: [GIN] 2016/05/14 - 12:32:53 | 200 | 1.325573ms | 192.168.0.100 | POST /track

So it seems like the client is sending track requests every 3 seconds or so but the server isn’t updating the timestamp. Here’s the response from the location route:

{"message":"Correctly found locations.","success":true,"users":{"daniel":[{"time":"2016-05-14 12:30:50.960632715 +0100 BST","location":"","bayes":{},"svm":{}}]}}

It’s 2 minutes out of date and there’s no location information.

Okay, that’s a good error! The empty location is a giveaway - it means that either it has a single empty location in its brain (which would be weird) or that the cache hasn’t reset. I think there are a couple things to try now.

  1. Stop and start the find server (this will reset the cache which might be a culprit).
  2. Goto the Dashboard and hit “Update” and try again. When the dashboard reloads,verify that your locations have numbers in the parentheses. If it doesn’t work, do some learning for that location and then switch to tracking (it will auto-update).
  3. Check what is returned from a track fingerprint on the client. Is it also give you an empty location?
  1. Done
  2. Dashboard shows:
    bedroom (15) 100% bathroom (18) 100%
  3. Any ideas for capturing the /track fingerprint payload?

I’m thinking if this doesn’t work I’ll reinstall from scratch and see if it still happens.

Do you have wifi on any of your computer devices? If so you can just just run the fingerprint client and watch the output, as it prints the payload each /track. (There is a client for the Pi if you’ve got Wifi for it).

All my machines are connected with ethernet but luckily I had a spare USB dongle that I’ve connected to my Windows machine.

Ran the fingerprint client and output is a bit strange:

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\xxxxxx\Downloads\fingerprint-0.41-windows-amd64>fingerprint.exe --server xxx.xxx.x.xxx:8003 -g xxxx -u xxxxxx -c 100
13:31:08.734 main - NOTI 001 You can see fewer messages by adding --nodebug
13:31:08.734 main - NOTI 002 User: xxxxxx
13:31:08.735 main - NOTI 003 Group: xxxx
13:31:08.736 main - NOTI 004 Server: xxx.xxx.x.xxx:8003/track
13:31:08.736 main - NOTI 005 Running 100 times (you can run more using '-c SOMENUM'). Please wait...
13:31:08.737 main - INFO 006 Scanning Wifi
13:31:08.738 scanWifi - INFO 007 Gathering fingerprint with 'netsh wlan show network mode=bssid'
13:31:08.768 main - INFO 008 Processing 27 lines out output
13:31:08.768 main - INFO 009 Sending fingerprint to xxx.xxx.x.xxx:8003/track
13:31:08.769 main - CRIT 00a Post xxx.xxx.x.xxx:8003/track: unsupported protocol scheme ""

Seems to abort due to a critical error.

Edit: realised from error message it needs the http. I was being a bit thick.
Response looks normal:

13:38:00.987 main - INFO 010 Sending fingerprint to http://xxx.xxx.x.xxx:8003/track
13:38:01.087 sendFingerprint - INFO 011 {"bayes":{"bathroom":-0.7071067811865475,"bedroom":0.7071067811865475},"location":"bedroom","message":"Current location: bedroom","success":true,"svm":{}}
13:38:01.090 sendFingerprint - CRIT 012 bedroom
13:38:01.090 main - INFO 013 Response: Current location: bedroom
13:38:02.091 main - INFO 014 Scanning Wifi
13:38:02.091 scanWifi - INFO 015 Gathering fingerprint with 'netsh wlan show network mode=bssid'
13:38:02.123 main - INFO 016 Processing 27 lines out output
13:38:02.123 main - INFO 017 Sending fingerprint to http://xxx.xxx.x.xxx:8003/track
13:38:02.146 sendFingerprint - INFO 018 {"bayes":{"bathroom":-0.7071067811865475,"bedroom":0.7071067811865475},"location":"bedroom","message":"Current location: bedroom","success":true,"svm":{}}
13:38:02.148 sendFingerprint - CRIT 019 bedroom
13:38:02.149 main - INFO 01a Response: Current location: bedroom

I think the blank location may have been a red herring. I’ve stopped the PC tracking and left the Android app running in the background (I’d like to stress this only happens after 30s or so of background tracking) and I’m still seeing the server acknowledge the /track posts but the /location route isn’t being updated.

Haha okay. :wink: I have another idea. The location is blank, but the timestamp is not. Currently getCurrentPositionOfUser() will load the timestamp, but it will not load the location/bayes if an error is thrown. An error is thrown if it can’t find the user, which could happen with weird case mismatches, but probably shouldn’t. Anyways, I fixed the code and updated the releases so it will force it to load all the data. So please download/compile the new version, and try again! Thanks for bearing with me!

I have a question about learning locations.
Is it better to stand in the middle of a location and keep the phone at a fixed point for all learning or move around the room/area to catch the variations of identifiable ap’s?

Thanks, now that part works.
But now fingerprint terminates saying

14:37:04.960 main - INFO 009 Sending fingerprint to http://tvpi:8003/learn
14:37:04.974 main - CRIT 00a Something wrong with server

Server tells me:
[GIN] 2016/05/14 - 15:54:28 | 200 | 40.10108ms | 192.168.178.27 | POST /learn
DEBUG: 2016/05/14 15:54:29 fingerprint.go:137: No fingerprints found to insert, see API
DEBUG: 2016/05/14 15:54:29 fingerprint.go:139: {mstormis mstormi wohnzimmer 0 []}

Meanwhile, server is happily confirming 'learn’s from an Android client.
iwlist show three networks. Not many, possibly not enough to be of use, but at least the output works.

@schollz no problem! Thanks for bearing with me too. Downloaded again and same issue. This time I ran the server in my ssh session rather than as a service and noticed something interesting:

DEBUG: 2016/05/14 15:15:14 fingerprint.go:206: Tracking fingerprint containing 5 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:15:14 | 200 |  958.739735ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:15:16 fingerprint.go:206: Tracking fingerprint containing 5 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:15:16 | 200 |    8.643221ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:15:19 fingerprint.go:206: Tracking fingerprint containing 4 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:15:19 | 200 |   12.215093ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:15:22 fingerprint.go:206: Tracking fingerprint containing 4 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:15:22 | 200 |   10.708481ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:15:25 fingerprint.go:206: Tracking fingerprint containing 4 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:15:25 | 200 |   33.515336ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:15:28 fingerprint.go:206: Tracking fingerprint containing 4 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:15:28 | 200 |   20.123628ms | 192.168.0.100 |   POST    /track
[GIN] 2016/05/14 - 15:15:32 | 200 |     677.083µs | 192.168.0.100 |   POST    /track
[GIN] 2016/05/14 - 15:15:35 | 200 |     676.145µs | 192.168.0.100 |   POST    /track
[GIN] 2016/05/14 - 15:15:38 | 200 |     680.207µs | 192.168.0.100 |   POST    /track
[GIN] 2016/05/14 - 15:15:41 | 200 |     713.281µs | 192.168.0.100 |   POST    /track
[GIN] 2016/05/14 - 15:15:44 | 200 |     813.697µs | 192.168.0.100 |   POST    /track

As soon as I pressed the home button to put the app into background mode then I no longer saw the following line:

DEBUG: 2016/05/14 15:15:28 fingerprint.go:206: Tracking fingerprint containing 4 APs for daniel (home) at bedroom (guess)

As soon as I opened the app again they started to re-appear:

[GIN] 2016/05/14 - 15:18:28 | 200 |   11.496605ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:31 fingerprint.go:206: Tracking fingerprint containing 5 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:31 | 200 |    9.791814ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:34 fingerprint.go:206: Tracking fingerprint containing 5 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:34 | 200 |   10.598012ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:37 fingerprint.go:206: Tracking fingerprint containing 5 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:37 | 200 |   35.217573ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:40 fingerprint.go:206: Tracking fingerprint containing 6 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:40 | 200 |   20.151129ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:43 fingerprint.go:206: Tracking fingerprint containing 6 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:43 | 200 |   13.793634ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:46 fingerprint.go:206: Tracking fingerprint containing 8 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:46 | 200 |   14.439728ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:49 fingerprint.go:206: Tracking fingerprint containing 8 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:49 | 200 |   29.547735ms | 192.168.0.100 |   POST    /track
DEBUG: 2016/05/14 15:18:52 fingerprint.go:206: Tracking fingerprint containing 10 APs for daniel (home) at bedroom (guess)
[GIN] 2016/05/14 - 15:18:52 | 200 |   14.733373ms | 192.168.0.100 |   POST    /track

Does that give you a better clue?

@schollz: is there any way to define where to persist server-learnt data ?
find server mentions ‘-db’ option as an example, but using it results in flag provided but not defined: -db
I do see learnt data is recovered, though, on restart.

Got it to work now (to display my room in openhab).
Cool stuff, @schollz, thanks!
Needs to improve on accuracy, but I hope that it’ll do when I recreate the DB and add SVM support (find server still keeps telling me it ain’t installed, although it is. Do I need to put the svm-XXX binaries somewhere specific ?).

After I got it to work, I briefly updated your Wiki page: how to run your own FIND server, how to configure MQTT.
(@danielwalters86: using MQTT instead of HTTP polling, updates have become as fast as they can be)

Okay, so now I’m thinking you were right - it might be your phone. Could you send me your phone info (make/model/software)? Also which App version is it?