Skip to content
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

Passive Tracking Broken(?, Missing) #181

Open
Sammy1Am opened this issue Jan 21, 2020 · 12 comments
Open

Passive Tracking Broken(?, Missing) #181

Sammy1Am opened this issue Jan 21, 2020 · 12 comments

Comments

@Sammy1Am
Copy link

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 Cython module not found building on arm64 #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:

  • Any sort of learning process started by the main server dies in ai/classify because the <base58family>.find3.ai file doesn't exist. As far as I can tell, the only code that can create this file is the ai's /learn function, but this isn't called as part of the passive learning / tracking. I can work around this issue by creating an "empty" ai and calling ai.save(), but I'm not sure this is intended and it's not clear how this file should have been created.
  • After creating the find3.ai file, calls to ai/classify succeed now. However no tracking data seems to ever show up on the dashboard. Manually calling "Calibrate Machine Learning" results in an error of problem analyzing: no predictions which appears to be related to the fact that there are no devices in the sqlite database.

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
Copy link
Owner

schollz commented Jan 22, 2020

Did you follow these directions?

@Sammy1Am
Copy link
Author

Sammy1Am commented Jan 22, 2020

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
Copy link
Owner

schollz commented Jan 22, 2020

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

@Sammy1Am
Copy link
Author

Sammy1Am commented Jan 22, 2020

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
Copy link
Owner

schollz commented Jan 29, 2020

Did you learn multiple locations?

@Sammy1Am
Copy link
Author

Sammy1Am commented Jan 29, 2020

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
Copy link

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

@Sammy1Am
Copy link
Author

Sammy1Am commented Feb 5, 2020

@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
Copy link

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

@Sammy1Am
Copy link
Author

Sammy1Am commented Feb 7, 2020

@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
Copy link

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
Copy link

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.

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

No branches or pull requests

5 participants