schollz / find3

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

Server should convert family case to lower #109

Closed chrzr closed 6 years ago

chrzr commented 6 years ago

Hello there!

I want to use Find3 on a Raspberry Pi 3 for a project I am working on, which requires determining the location of a moving object inside a quite large building. I managed to successfully install the Find3Server and import the test dataset. I also managed to get the cli-scanner running without any major problems. However, when I want to learn the location of a custom device for a custom family, the scanner runs without errors, the sqlite db file is showing up with the corresponding data, but it does not show up in the webinterface. When I try to scan data to the testdb with a new device and a new location it works without any problems and the entries show up in the webinterface. The main problem now is that I can't figure out how to set up a new family. I already tried it via http POST etc. but it just responds with "group does not exist ..." Thanks in advance!

kind regards,

Christoph

schollz commented 6 years ago

The main problem now is that I can't figure out how to set up a new family. I already tried it via http POST etc. but it just responds with "group does not exist ..."

Can you elaborate? What POST? What responds with group does not exist? What are you using to send fingerprints? Are you sure that the server address is correct? What is the output from the CLI scanner when sending the fingerprints (check with -debug)?

chrzr commented 6 years ago

Thanks for the quick response! Sorry for not including more information!

What POST?

sudo curl -X POST http://localhost:8005/data -H "Content-Type: application/json" -d '{"d":"RPi","f":"RasPi","t":1231232134,"l":"Desk","s":{"bluetooth":{},"wifi":{"aa:bb:cc:dd:ee:ff":-73}},"gps":{}}'

which returns:

{"message":"inserted data","success":true}

However, if I check the family via the web interface it responds with:

"You need to add learning data first: group 'RasPi' does not exist"

What are you using to send fingerprints?

I tried to use the the cli-scanner, as well as the manual way with POST to send fingerprints. Both times it does not show any errors, but the data also won't show up in the web ui. However, it does create the sqlite database file with the data I entered.

Are you sure that the server address is correct?

Yes, the address is correct. The same address also works if I use it to write my data to the testdb via the cli-scanner. This works perfectly fine. I can add new devices, locations and fingerprints and they show up in the web interface under the family testdb

What is the output from the CLI scanner when sending the fingerprints (check with -debug)?

sudo find3-cli-scanner -i wlan0 -device RPi -family RasPi -server http://localhost:8005 -scantime 10 -wifi -forever -location "desk" -debug

This results in:

2018-07-24 13:24:35 [INFO] main.go func1:175 scanning with wlan0 
2018-07-24 13:24:35 [DEBUG] utils.go RunCommand:15 /sbin/iw dev wlan0 scan -u 
2018-07-24 13:24:38 [DEBUG] utils.go RunCommand:41 /sbin/iw dev wlan0 scan -u done gracefully without error 
2018-07-24 13:24:38 [DEBUG] main.go basicCapture:331 {
 "t": 1532438675243,
 "f": "RasPi",
 "d": "RPi",
 "l": "desk",
 "s": {
  "wifi": {
  }
 },
 "gps": {}
} 
2018-07-24 13:24:38 [DEBUG] server-main.go postData:47 posting data 
2018-07-24 13:24:38 [DEBUG] server-main.go postData:75 {true inserted data} 
2018-07-24 13:24:38 [INFO] main.go func1:175 scanning with wlan0 
2018-07-24 13:24:38 [DEBUG] utils.go RunCommand:15 /sbin/iw dev wlan0 scan -u 
schollz commented 6 years ago

And how are you running the server (what command)?

Can you check the data/ folder to see if anything is there? What is the name of the files there?

What happens when you go to /view/dashboard/raspi? Does it say "Overall 0 data" or something else? WHat happens when you press calibrate?

Also I just realized /view/dashboard/RasPi will not work, it should be lower case.

chrzr commented 6 years ago

And how are you running the server (what command)?

I use sudo docker start find3server to start the server and sudo docker start scanner to start the scanner

Can you check the data/ folder to see if anything is there? What is the name of the files there?

The folder /FIND_DATA/data contains two .db files and two .ai files. Both with a seemingly random combination of lower- and uppercase letters as name. One .db file contains the data from testdb, the other contains the data, which I have posted manually.

What happens when you go to /view/dashboard/raspi?

This results in: "You need to add learning data first: group 'RasPi' does not exist"

Edit: Oh. So the family has to be lowercase? I think I have not tried that yet! I'll try it once I get home!

chrzr commented 6 years ago

Oh man ... It really was the name of the family. Entering lowercase raspi instead of RasPi did the trick! Thanks for the quick help! I would have never thought about that!

schollz commented 6 years ago

Ideally this wouldn't be an issue. I'm going to reopen this as a bug so all the case lowering can be done at the server side.

ifnull commented 6 years ago

Experiencing the same issue. Started with a camel case family name on the android app. Had issues when I tried to use the camel case family name on my Pi