ESPresense / ad-espresense-ips

DEAD: See https://github.com/ESPresense/ESPresense-companion
64 stars 9 forks source link

Precision improvement - Wrong values polluting calculations #14

Closed stan69b closed 2 years ago

stan69b commented 2 years ago

Hey, I've been playing a lot lately and have been having precision issues. I have 10 esp32 for 90m2. some walls are thick concrete, some in construction bricks (thiner) and juste small separations as well.
I found out that most of the time, the beacon closest to the device has the right measurement,
but a beacon from a "far away" room and a thick wall in between will return a wrong value that is also very close (1m/1.5m).
Given this, I supposed that the algorithm was miscalculating the position because 2 opposite (or more) beacons are giving small values which tends to put my devices in the center of my floorplan.

I had some ideas to approach this problem :

I suppose other ways are possible, I'm planning on trying to code it and make a Pull Request but I would like a little help on understanding the current code and have other ideas if you have any so we can come up with a robust and reliable solution.

Hope I made sense in all this, It's all guess work above, I might be wrong on some things.

DTTerastar commented 2 years ago

We minimize the error to find the "likely" position, we could weight the error by the rank of distance to correct for that effect.

DTTerastar commented 2 years ago

The other factor is i use an absorption factor of 3.5 and I do think that is too high. We should allow the ESPs to have a different value.

stan69b commented 2 years ago

It is worth a try indeed :) To be honest, I looked at the python code, it is soooo small, it seems to be mostrly shorthand code and I'm kinda lost. I'm used to basic python. Any info on how to achieve that ? I'll gladly look into it if you want but you surely will get it done before me xD

DTTerastar commented 2 years ago

It's numpy. Numpy is all matrix stuff. I don't understand it either. I just found it while googling...

DTTerastar commented 2 years ago

I'm focused on the C++ atm so I'm quite sure you'll get this done sooner :)

stan69b commented 2 years ago

Yeah different absorption factor would be nice.
Hahaha I'll try to play with it then and see what happens

DTTerastar commented 2 years ago

I added absorption, have you had a chance to play?

stan69b commented 2 years ago

Hey, I started looking into the python code to add it but got taken by something else lately. Thank you very much for the update, I will try it asap :)

stan69b commented 2 years ago

Hey, started playing with the absorbsion values a little. I did find something weird but It could be coming from the floorplan creator... I'm not sure yet. I turned off all esp32 but 3 near the office. Checked the values returned by each. From what I calculate from those 3 mesures it seems pretty accurate and in the office but i see that the final device position is no where near that and shows in the livingroom. The mqtt message for that device also gives livingroom as the current room. Any ideas ? Could there be a miscalculation somewhere or in some special cases ? (Mqtt giving the wrong room as well makes me believe the floorplan is not the problem though I could be wrong. If you can have a try on your side and see if the floorplan gives you the same result maybe.) Have a nice week end, if you are an F1 fan, enjoy qualifying today and the race tomorrow :)

DTTerastar commented 2 years ago

Yeah, I'm still struggling w/ getting anything even close to correct. I need to make an offline test because using live data just drives you mad.

DTTerastar commented 2 years ago

Master has inversely proportional to the distance squared, can @stan69b you test this?

DTTerastar commented 2 years ago

I've tested this and it works, closing!