Draft Solution of the Tapping Localisation Problem

edit

Introduction

edit

This is a draft solution for what we are currently referring to as the tapping localisation problem. The problem relates to an experimental human-machine interface which is under development. A rectangular board sits on a horizontal surface. At each corner of the board is an accelerometer which senses vibrations. When the board is "tapped", vibrations propagate outwards in all directions from the point of impact. Because the distance from the point of impact to each corner is different, the vibrations are detected by each accelerometer at a different time. Knowing only the dimensions of the rectangle and the time at which each accelerometer sensed the impact, the objective is to calculate at what point on the board the tap occurred. This is the tapping localisation problem.


It is easy to think of many other problems which resemble this one - e.g. finding the epicentre of an earthquake using readings from multiple measurement stations or identifying the position of an audio source using a microphone array - so it must certainly have been solved before. However, since the problem seemed like a straightforward geometrical one, we tried to solve it ourselves from first principles. Unfortunately, although we have a working solution (as described below), it is not an entirely satisfactory one. Part of the solution is carried out using an iterative numerical method - something which my instinct tells me should not be necessary. Nevertheless, a purely analytical solution has so far eluded us, so what follows will have to do for the moment.


Assumptions and Notation

edit

The tapping area is assumed to be a rectangle of width   and height  . As shown in the diagram below, the four corners of the rectangle are as follows:


  • A is the bottom left corner, at coordinates (0,0)
  • B is the bottom right corner, at coordinates (w,0)
  • C is the top right corner, at coordinates (w,h)
  • D is the top left corner, at coordinates (0,h)


 


At time  , a "tap" occurs at a point   somewhere inside the rectangle. There is one accelerometer at each corner of the rectangle. Each accelerometer detects the tap only when the resulting vibrations have propagated out from   as far as its location. The speed of propagation,  , is assumed to be constant throughout the medium.


Initially,   is not known. Also, when a tap occurs, the time of impact is not known initially. All that we have to work with are the times at which the tap's vibrations reach each of the accelerometers. These four times are   and  .


Obviously,   and   are greater than   (i.e. no accelerometer can detect the tap before it occurs). Furthermore, the propagation speed,  , is constant and positive.


Finally,   and   are the distances from   to corners   and   respectively.


Applying Pythagoras' Theorem

edit

Using Pythagoras' theorem we can the following expressions for   and   in terms of   and  .


 
 
 
 


Combining these equations in two pairs yields the following two equations.


 
 


It is clear from these that


 


Propagation Delays

edit

We can also express a, b, c and d in terms of the detection times   and the unknowns   (the time at which the tap occurred) and   (the propagation speed).


 
 
 
 


As we did above with the corresponding pythagorean expressions, we now write expressions for   and  .


 
 
 
 


Now, since we know that  , we can write


 


We know that v, the propagation velocity cannot be zero. Therefore, we can say that


 


If we multiply out each square term above, then rearrange the equation, it yields the following expression for  , the first of our unknowns.


 


N.B. There are some problems with this formula.

Firstly, the denominator   will be equal to zero for certain tapping points in the rectangle (e.g. the centre). Secondly, when the denominator is non-zero but small, the expression will be very sensitive to small errors in the time measurements.

However, for the time being I'm not going to worry about these problems.


Since   and   are all known (i.e. they were detected directly from the accelerometer readings), we can now determine exactly how long before the first readings were detected the actual tap took place.


We define four new time variables,   and  , which record the actual propagation time taken for the tap vibrations to travel from   to each of the four corners.


 
 
 
 


Scale Replica Rectangle

edit

We now construct a scale replica of the original rectangle using   in place of the lengths  . The width and height of our scale replica (  and   respectively) are not known initially, but by specifying the lengths of the four lines joining   to each of the corners  , they will be uniquely determined.

The four corners of our scale replica rectangle are


  •   is the bottom left corner, at coordinates  
  •   is the bottom right corner, at coordinates  
  •   is the top right corner, at coordinates  
  •   is the top left corner, at coordinates  


 


The relative proportions of   and   are exactly the same as those of   and  . The point   within our replica rectangle corresponds to   within the original rectangle.


Applying Pythagoras' theorem again,


 


Therefore,


 


From the rectangle, we can also write these two equations:


 
 


Combining these two equations,


 


Multiplying all terms by   gives


 


Since our replica rectangle has the same proportions as the original one,  , we can write


 


Now, substitute in the previous expression for   in terms of  .


 


We should now be able to solve for  , the only unknown in the previous equation. However, I've spent quite a few hours trying to hammer out an expression for   in terms of   and   and I'm embarrassed to say that my efforts have been fruitless. Having been frustrated in my search for an elegant analytical solution, I've had to shelve my pride and settle for a numerical solution for the time being.


Numerical solution for  

edit

Since we know that   is real and positive (as are  ), we can immediately identify some bounds within which it must lie.


 
 
 
 


The first three of these conditions arise from the fact that if they are violated, square root terms in our equation will become imaginary (and we know   must be real).

The value of   can be estimated with arbitrary precision using the following iterative algorithm. First define a function  .


 


The desired value of x_s is that for which  . We define variables   and   and assign them the following initial values:


 


 


I'm making the assumption here that   is monotonic on the interval   (and hence that there is only one solution for   in that interval). Based on my visual inspection of the geometry in this problem, the solution is unique. However, it would probably be advisable to revisit this to confirm that the assumption is valid.

Now, perform the following steps as many times as necessary.


  1. Set  
  2. If   then set  . Otherwise, set  
  3. If   for some predefined tolerance   then cease iterating and take the current value of   as the final value. Otherwise, repeat from step 1 above.


What is happening here is that   and   begin on opposite sides of the zero-crossing point of  . Each iteration of the algorithm ratchets   and   closer to each other, but keeps the zero-crossing point in between them. At each iteration, the distance between   and   is reduced by half. After several iterations, there will only be a very short distance between   and   and the zero-crossing point is known to be somewhere in that very small range.


Finally, calculate  

edit

Now, we have the value of  , the x-coordinate of the point we seek in the scale replica square. To find  , we simply use the following equation from above.


 


We also need to find out the width and height of the replica rectangle. For this, we can use the following equations from above.


 


 


Now that we know the values   and  , we can easily find the actual point,  , at which the tap occurred in the original (unscaled) rectangle. Simply scale   using the ratio of the dimensions of the replica rectangle to those of the original rectangle.


 


 


These are the coordinates of  , the point at which the tap occurred.


Summary of calculation

edit

To recap, here is the sequence of calculations required to find   when   and   are given.

First, find  :


 


Next calculate   and  :


 
 
 
 


Define the function  :


 


Calculate initial values for   and  :


 


 


Perform the following steps as many times as necessary.


  1. Set  
  2. If   then set  . Otherwise, set  
  3. If   for some predefined tolerance   then cease iterating and take the current value of   as the final value. Otherwise, repeat from step 1 above.


Calculate  :


 


Calculate  :


 


Finally, calculate  :