schollz / find3

High-precision indoor positioning framework, version 3.
https://www.internalpositioning.com/doc
MIT License
4.63k stars 363 forks source link

Passive Tracking Broken(?, Missing) #181

Open Sammy1Am opened 4 years ago

Sammy1Am commented 4 years ago

I've been struggling for a day or two with this, and digging through the code most of today, but I'm at the limits of my understanding I think. Here's the issues I'm running into, but unless I'm missing something obvious, it seems like passive tracking is... like almost entirely missing (I'm a little perplexed to be honest; has anyone else successfully used passive tracking?)

Steps I've followed:

  1. Install find3 (not straightforward, see #180).
  2. Start find3 server (either through the Docker instance, or manually from source).
  3. Turn on passive learning for a device using the /settings/passive API and specifying a location.
  4. Submit passive data via the /passive API.

Issues:

And there's where I'm at now, because I'm not sure how devices are supposed to get added to the database, and why they're not currently being added.

This largely seems to be an issue with passive tracking, as when I used the Android app to track itself, things seems to work a little better for the active tracking results (but doesn't seem to magically fix passive tracking).

Am I missing some sort of required setup step to initialize the database for passive tracking?

schollz commented 4 years ago

Did you follow these directions?

Sammy1Am commented 4 years ago

Yes.

There are really only two steps I can see on that page for the server:

  1. Start learning by using /settings/passive with a location.
  2. Stop learning by using /setting/passive without a location.

Edit: As far as I can tell, these commands work fine as I get back a response indicating that learning has started and that learning has stopped, respectively.

Just so there's no misunderstanding, I'm not using the find3-cli-scanner to do the scanning, I'm either using some code I wrote myself on some ESP8266s, or just manually POSTing the data directly. In either case the server seems to have issues.

schollz commented 4 years ago

I see. Can you try using find3-cli-scanner and see if that works?

Sammy1Am commented 4 years ago

Unfortunately I don't have any hardware suitable to run it (my WiFi devices are all ESP boards, and my actual computers don't have WiFi). I hadn't thought to dig through the cli-scanner code to see if maybe it's doing something different, so I might give that a look though.

For what it's worth, here's the actual data I'm sending to the server (MACs and Family names changed).

POST to http://server/api/v1/settings/passive

{
"family":"Samily",
"location":"office",
"device":"wifi-40:4e:ab:cd:ef:12",
"window": 10
}

RESPONSE

{
  "message": "Set location to 'office' for samily for learning with device 'wifi-40:4e:ab:cd:ef:12'. Now learning on 1 devices: map[wifi-40:4e:ab:cd:ef:12:office]with time block of 10 seconds",
  "success": true
}

POST to http://server/passive (Sent several times manually for testing, when using devices the value of d changes)

{"s":{"wifi":{"40:4E:AB:CD:EF:12":-53}},"d":"tol-mc001","f":"Samily"}

RESPONSE

{
  "message": "inserted 1 fingerprints for samily",
  "success": true
}

POST to http://server/api/v1/settings/passive

{
"family":"Samily",
"device":"wifi-40:4e:ab:cd:ef:12",
"window": 10
}

RESPONSE

{
  "message": "switched to tracking for samily. Now learning on 0 devices: map[]with time block of 10 seconds",
  "success": true
}
schollz commented 4 years ago

Did you learn multiple locations?

Sammy1Am commented 4 years ago

Simultaneously, or serially?

I think the answer to either is probably "yes, at some point," but I only stepped through the code to debug while learning a single location (after clearing the database, so it would have been the first location). I did initially try two locations serially (but found neither had worked), and also tried two in parallel (with sort of the same result; by that time I'd tried a little active-tracking so some locations were showing up from the active tracking).

Hellowlol commented 4 years ago

@SammyIAm Im intersted getting this to work on esp32. have you posted your code somewhere?

Sammy1Am commented 4 years ago

@Hellowlol I haven't, but I could fairly easily-- just need to sanitize some hard-coded passwords and such. I'll try to get around to that soonish.

Unforunately, my code's specifically designed for passive scanning (i.e. the esps track just my phone, not themselves), which doesn't seem to be working in find3 at the moment (hence this ticket). If you're looking for something with active scanning (i.e. tracking the location of the esp32 itself) then you should take a look here instead.

Hellowlol commented 4 years ago

Passiv scanning is what im interessed in. I don’t care about tracking the esp. Cool, thanks for posting it.

Sammy1Am commented 4 years ago

@Hellowlol I've uploaded my code (for the esp8266) here. If you connect to the serial port it should prompt you for most of the configuration information. The only places (I think) you'll need to modify are these lines to include the MAC addresses of the devices you want to track, and this line to specify the family name to use in find3.

For my usecase the esp8266s also have BME280 temperature/humidity sensors. If you're not also using these sensors (it would be quite a coincidence if you were), you should also comment out this line to prevent compiling / using the BME280 code.

If you manage to get find3 passive tracking working, I would be very interested to hear about how you did it since I've been unable to.

nash-stokes commented 4 years ago

So I'm working with Raspberry Pi's as the scanners and hoping to track bluetooth beacons. I've attached a picture of what I see on the dashboard. It's showing the beacons, but never assigns them the location that I set in learning command. Should the "DEVICE" flag be the mac address of the scanning wifi adapter (monitor mode adapter on RPi in this case) in both the HTTP POST and the passive scanner command? Have tried training with more than one location and more than one device, but no luck. @schollz Capture

IoTThinks commented 3 years ago

It works for me after a day of trying.

In setting-passive endpoint, the device must be wifi-kkk. kkk can be anything. No need to be MAC address.

In passive endpoint, the d is xx:xx:xx:xx:xx:xx. The content in wifi is: "wifi":{"kkk":-80}

kkk might be case-sensitive, btw.