Indoor Positioning System(Trilateration)
In geometry, trilateration is the process of determining absolute or relative locations of points by measurement of distances, using the geometry of circles, spheres or triangles.
In addition to its interest as a geometric problem, trilateration does have practical applications in surveying and navigation, including global positioning systems (GPS). In contrast to triangulation, it does not involve the measurement of angles.
The major disadvantage of GPS navigation is that it does’nt work inside, i.e., inside any building, mall, theatre, mueseums etc.
With the help of Beacons, Indoor positioning can be implemented.
We are assuming here that three Beacons are placed at (0,0), (5.28,0), (0,6.5) points respectively.
The distance to the device is say, 1.2, 2.1, 2.1. All figures in metres.
[code language=”java”]
/**
* Calculates the distance from Beacon to device.
**/
private void calculateBeaconDistance(Beacon beacon) {
float txPower = -74.0; // Manufacture set this power in the device
if (beacon .rssi == 0){
return -1.0; // if we cannot determine accuracy, return -1.
}
double ratio = beacon.rssi*1.0 / txPower;
if (ratio < 1.0){
return pow(ratio,10);
}
else{
double accuracy = (0.89976)*pow(ratio,7.7095) + 0.111;
return accuracy;
}
}
/**
* It needs distanceA, distanceB, distanceC, pointA1, pointA2, pointB1, pointB2, pointC1, pointC2
*/
private void getMeetingPoints(distanceA, distanceB, distanceC, pointA1, pointA2, pointB1, pointB2, pointC1, pointC2) {
double w,z,x,y,y2;
w = distanceA * distanceA – distanceB * distanceB – pointA1 * pointA1 – pointA2* pointA2 + pointB1 * pointB1 + pointB2 * pointB2;
z = distanceB * distanceB – distanceC * distanceC – pointB1* pointB1 – pointB2 * pointB2 + pointC1 * pointC1 + pointC2 * pointC2;
x = (w * ( pointC2 – pointB2) – z * ( pointB2 – pointA2)) / (2 * (( pointB1 – pointA1) * ( pointC1 – pointB2) – ( pointC1 – pointB1) * ( pointB2 – pointA2)));
y = (w – 2 * x * (pointB1 – pointA1)) / (2 * ( pointB2 – pointA2));
y2 = (z – 2 * x * ( pointC1 -pointB1)) / (2 * ( pointC1 – pointB2));
y = (y + y2) / 2;
}
[/code]
Please verify the above second method “getMeetingPoints”. I’ve tested this with some dummy value but it’s not working. Please help me on that
i also stuck in that second method. please help me any one.
please help me.
waiting for your answer….
function getMeetingPoints(distanceA, distanceB, distanceC, pointA1, pointA2, pointB1, pointB2, pointC1, pointC2) {
var w, z, x, y, y2;
w = distanceA * distanceA – distanceB * distanceB – pointA1 * pointA1 – pointA2 * pointA2 + pointB1 * pointB1 + pointB2 * pointB2;
z = distanceB * distanceB – distanceC * distanceC – pointB1 * pointB1 – pointB2 * pointB2 + pointC1 * pointC1 + pointC2 * pointC2;
x = (w * (pointC2 – pointB2) – z * (pointB2 – pointA2)) / (2 * ((pointB1 – pointA1) * (pointC2 – pointB2) – (pointC1 – pointB1) * (pointB2 – pointA2)));
y = (w – 2 * x * (pointB1 – pointA1)) / (2 * (pointB2 – pointA2));
y2 = (z – 2 * x * (pointC1 – pointB1)) / (2 * (pointC2 – pointB2));
y = (y + y2) / 2;
return { x: x, y: y };
}