I'm having some real issues figuring out multilateration. I'll start by saying I'm not a math whiz, but I am usually able to figure most things out, but this one has been throwing me through a loop for some time now. I got to this point after reading up on Time Difference of Arrival.
Here's what I have... Four wifi adapters. Each one taking a point in a three sided pyramid, so this should be able to take height into account, I believe. The relative positions to each other are fixed as well.
What I'm attempting to do is listen for wifi signals and find their origin. In theory, I believe I should be able to use the difference in time between each wifi adapter "hearing" a packet to find the origin of the packet.
I've paired a GPS into this. It allows me to give each wifi adapter an actual position (with a little math).
So here's what I have when I receive a packet...
- wlan1 (X, Y, Z, timestamp)
- wlan2 (X, Y, Z, timestamp)
- wlan3 (X, Y, Z, timestamp)
- wlan4 (X, Y, Z, timestamp)
X and Y are lat/lng. Z is the altitude in meters, and the timestamp is reflecting microseconds.
Some assumptions to make are that the XYZ are accurate. For all practical purposes, if they're off, then they're all consistently off, which should be reflected in finding the source.
I haven't been able to figure out how to apply any math to this, and I'd love if someone could help me through an example. I can provide some actual data if necessary. The end goal is working on a robotics project that'll let a robot follow you, or more accurately your cell phone. The reason I'm taking this approach is that it lets me log things in a way that in the end should be extremely easy to debug visually on a google map.
I believe that by taking a difference in time from each point and comparing it across the adapters, I should be able to have a somewhat accurate shot at the origin location. but this math is just too far beyond me right now.
EDIT: Here's how I imagine this working in my head... Each adapter receives a packet. If the difference between the time stamps upon receiving them, I know the source is on a 90 angle to the line connecting them, rotating it 360 degrees around the line to make a disc.
On the other hand, through a controlled test, I can get the maximum time it'll take to hit one point and then another by lining the source, and two adapters up, which is obviously a straight line back to the source.
It's my determination, that anything between 0 and the maximum would be an angle off the line between the two points. The angle should be a ratio of the measured difference and the maximum difference.
This would create a cone going outward, towards the adapter that heard it first. This isn't too useful on its own, but add 3 more adapters, and there should be a single point where all of these "cones" intercept each other. This should work with 4 minimum adapters. Adding more should make it increasingly more accurate. The theory looks good if I sketch it out on paper. but the mathmatical application of it... well it's beyond my capabilities.