This week’s focus was trying to fully understand the mathematical approach for my localization software.
I genuinely spentĀ >10 hours reading papers. Based a lot of research and looking at results, I feel confident that our best approach right now is the following.
- Simulate player movements on a bball court in a variety of patterns and speeds (Straight line, zigzag, random, circular).
- Use the simulated distance between anchors and player to calculate TOAs at each anchor
- Send data to server program via sockets
- Calculate time differences (Taus) and other measurements
- Use the iterative Gauss-Newton method to solve the set of non-linear hyperbolic equations by least squares approximation to get (x,y) location with least residual
- Smooth these values by using a recursive extended Kalman filter
We are working to start off implementing this with perfect data from steps 1-2. Shiva is working on collecting experimental data from the hardware to give us an idea of high error and consistency will be in reading these numbers. We will add in simulated error based on that experimental error as our next step.
Once we get this stack working with decent success on simulations, we can replace steps 1 and 2 with the real hardware with Shiva sending packets from his simulated setup to our server code.
Step 5 is what I am in charge of and step 6 is what Rhea is in charge of.
I spent many hours reading multiple papers that offer strategies to solve the equations needed in step 5 but typos and slightly incorrect equations has slowed down the process. But here is the math I have thus far:
For each anchor i there is a (x_i, y_i) known location with an unknown (x,y) tag location.
R_i = v*T_i where v is speed of light in air and T_i is the TOF from tag to anchor i (unknown value)
tau_ij = T_i-T_j (tau is known because you can subtract timestamps)
R_i-R_j = v*T_i-v*T_j=v(T_i-T_j)=v(tau_ij)
Via algebraic manipulation, plugging in the distance formula (R_i = sqrt((x_i-x)^2+(y_i-y)^2)), and using 2 anchors as a reference, you get an equation
alpha_i*x+beta_i*y+C_i = 0 for i in {3,4} where alpha, beta and C are values calculated from v, tau_1i, x_1, y_1, x_i, y_i, tau_12, x_2, y_2 (which are all known constants or values from data).
alpha_i*x+beta_i*y+C_i = 0 for i in {3,4} gives us 2 linear equations with 2 unknowns that can be easily solved using an inverse matrix assuming perfect data. Because we don’t have perfect data, we have to use the hyperbolic equations and use a Gauss-newton least squares approximator.
I don’t fully understand the least squares method (especially how to implement it in code) and what are the exact hyperbolic equations that need to be approximated. Right now, I don’t see why we can’t estimate using the linear equation but that is my task for the next day or so.