schollz / find3

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

Signal classification crash #136

Closed jekkos closed 5 years ago

jekkos commented 5 years ago

Seeing following issue when trying to calibrate the classification algo on my data

2019-01-30 14:46:34 [DEBUG] [PID-18033] server.go parseRollingData:1259 [fam] saved reverse sensor data for wifi-b0:ca:68:52:4d:41
2019-01-30 14:37:48 [DEBUG] [PID-16629] db.go AddSensor:376 []] inserted sensor data, 6.808855ms
panic: interface conversion: interface {} is string, not float64
goroutine 1174 [running]:
Jan 30 14:32:50 main[16207]: github.com/schollz/find3/server/main/src/learning/nb1.(*Algorithm).Classify(0xc42025e1b0, 0x1689ef655b7, 0xc42061c9c8, 0x8, 0xc42062f5e0, 0x16, 0x0, 0x0, 0xc420b54de0, 0x0, ...)
Jan 30 14:32:50 main[16207]:         /home/jekkos/work/src/github.com/schollz/find3/server/main/src/learning/nb1/nb.go:91 +0x100a
Jan 30 14:32:50 main[16207]: github.com/schollz/find3/server/main/src/api.AnalyzeSensorData.func2(0x1689ef655b7, 0xc42061c9c8, 0x8, 0xc42062f5e0, 0x16, 0x0, 0x0, 0xc420b54de0, 0x0, 0x0, ...)
Jan 30 14:32:50 main[16207]:         /home/jekkos/work/src/github.com/schollz/find3/server/main/src/api/analysis.go:124 +0xd6
Jan 30 14:32:50 main[16207]: created by github.com/schollz/find3/server/main/src/api.AnalyzeSensorData
Jan 30 14:32:50 main[16207]:         /home/jekkos/work/src/github.com/schollz/find3/server/main/src/api/analysis.go:120 +0x1ce
Jan 30 14:32:50 systemd[1]: find3.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 30 14:32:50 systemd[1]: find3.service: Failed with result 'exit-code'.
Jan 30 14:32:55 systemd[1]: find3.service: Service hold-off time over, scheduling restart.
jekkos commented 5 years ago

I have already tried to remove all data in my db but this has no effect. The issue occurs again once I start calibrating

jekkos commented 5 years ago

Seems to be this line 91 in nb.go val := int(data.Sensors[sensorType][name].(float64))

My suspicion is that it can't convert the name to a float. Checked the database schema but didn't find a sensorType column in the schema there, so I wonder where this data actually comes from.

jekkos commented 5 years ago

Ok found the issue, was a bug in how my client submits the signal. This need to be integer type instead of string. The datamodel doesn't care as it seems to save payload in a json like format.