Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determinate position of a point with triangulation

I am working on project of localization wireless sensors network. I am using triangulation method to estimate position of a wireless sensors, where I have two sensors its position is known :

A(x1,Y1)

and B(X2,Y2)

and the point that I want to locate is c(x,y)

and I have the distances between those points :

AB, AC & BC

How can I do that with triangulation ?

like image 237
kamal Hadj Hafsi Avatar asked Dec 04 '25 10:12

kamal Hadj Hafsi


1 Answers

Put

a := dist(B,C), b := dist(A,C).
A := (a1,a2), B := (b1,b2), C := (x,y).

We have

(x - a1)^2 + (y - a2)^2 = b^2           eq (1)
(x - b1)^2 + (y - b2)^2 = a^2

Thus:

x^2 -2(a1)x + (a1)^2 + y^2 -2(a2)y + (a2)^2 = b^2
x^2 -2(b1)x + (b1)^2 + y^2 -2(b2)y + (b2)^2 = a^2

Now subtract:

(2(b1) - 2(a1))x + (a1)^2 - (b1)^2 + 2((b2) - (a2))y + (a2)^2 - (b2)^2
    = b^2 - a^2

Solve for y:

y = u + vx                              eq (2)

where:

u := ((a1)^2 + (a2)^2 - ((b1)^2 + (b2)^2) + a^2 - b^2)/(2((a2) - (b2)))
v := (2((b1) - (a1)))/(2((a2) - (b2)))

Replace y with u + vx in eq 1 above:

(x - a1)^2 + (u + vx - a2)^2 = b^2 

rx^2 + sx + t = 0

where:

r := 1 + v^2
s := -2(a1) + 2uv - 2v(a2)
t := (a1)^2 + (uˆ2) - 2u(a2) + (a2)^2 - b^2

Solve for x

x = (-s +/- sqrt(s^2 - 4rt))/(2r)

From eq 2:

y = u + vx.

ALTERNATIVE APPROACH

Let a := dist(B,C) and b := dist(A,C) as above and put c := dist(A,B). Let theta be the angle BAC, as depicted below.

enter image description here

We have

cos(theta) = (b^2 + c^2 - a^2)/(2bc)    eq (3)

Then we can derive h and c1 as

h := b * sin(theta) = b * sqrt(1 - cost(theta)^2).
c1 := b * cos(theta)

So,

D := (d1, d2) = (B - A) * c1 / c + A    eq (4)

where

d1 := (b1 - a1)*c1/c + a1
d2 := (b2 - a2)*c1/c + a2

Now we can use the fact that C is at distance h on the perpendicular to AB intersecting at D:

C := (d1, d2) +/- ((a2 - b2)*h/c, (b1 - a1)*h/c) 

where +/- stands for the two possibilities of C being above or below the line AC.

or

C = (x, y)

where

x := d1 +/- (a2 - b2)*h/c
y := d2 +/- (b1 - a1)*h/c

Example

A = (2,3) - B = (5,4) - a = sqrt(5) - b = sqrt(5)

Compute c:

c := dist(A,B) = 3.16227766016838.

From eq (3)

cos(theta) = 0.70710678118655
theta := 0.78539816339745 radians

Compute h and c1:

h := b * sin(theta) = 1.58113883008419.
c1 := b * cos(theta) = 1.58113883008419.

From eq (4):

D = (3.5,3.5)

Now compute C:

C = ((a2 - b2)) * h / c , (b1 - a1) * h / c) + D
  = (-0.5,1.5) + (3.5,3.5)
  = (3,5)

Verify:

dist(A,C) = dist((2,3),(3,5)) = sqrt(1ˆ2 + 2^2) = b (OK)
dist(B,C) = dist((5,4),(3,5)) = sqrt(2^2 + 1^2) = a (OK)
like image 181
Leandro Caniglia Avatar answered Dec 07 '25 07:12

Leandro Caniglia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!