2014-09-22 28 views
0

我试图通过3个或更多iBeacons获得准确的位置。有两个步骤从iBeacon获取位置RSSI信号

  1. 从iBeacon的RSSI获得准确的距离。
  2. 应用Trilateration算法来计算位置。

现在我没有得到准确的距离。 iOS“精确度”并不是真正的距离。我正在应用不同的公式来计算距离,但我无法找到精确的距离。到目前为止,我可以获得长达10米的精确距离,但至少需要20米的距离。

(我使用的是默认iBeacon显示魔女TXPOWER是-59 DBM和我测量的C3的功率和300毫秒使用广播区间。

任何帮助,将不胜感激。谢谢!

回答

0

不幸的是,实际上不可能在10米以上获得非常精确的距离估计值,问题是在该距离信号变得相对较弱,并且噪声压倒了RSSI测量结果 - 至少对于快速响应来说,信噪比,因为它是众所周知的,在所有的无线电应用中都是一个普遍的问题,对于蓝牙LE应用,你必须接受更远距离处的不准确的距离估计,或者平均RSSI山姆在很长的一段时间内,它们会帮助滤除噪音。

0

一旦你得到你的距离,你可以使用下面的代码示例找到trilaterated点的坐标

{ 
    //Declarations 
    //include the math.h header file 

    double xa=0, ya=0;  //Co-ordinates of 1st ACCESS Point(preferably set as origin) 
    double xb=10,yb=0;  //Co-ordinates of 2nd ACCESS Point 
    double xc=5,yc=10;  //Co-ordinates of 3rd ACCESS Point 
    double triPt[2]={0,0}; //Trilaterated point 
    double p1[2]={xa,ya}; 
    double p2[2]={xb,yb}; 
    double p3[2]={xc,yc}; 
    double ex[2],ey[2],ez[2]; 
    double i=0,k=0,x=0,y=0; 
    double distA=5*1.41; //Distance from API 1 (Measured using RSSI values) 
    double distB=5*1.41; //"""""    2 
    double distC=5;   //"""""    3 

    //Transforms to find circles around the three access points 
    //Here it is assumed that all access points and the trilaterated point are in the same plane 

    for(int j=0;j<2;j++) 
     { 
     ex[j]=p2[j]-p1[j]; 
     } 
    double d=sqrt(pow(ex[0],2)+pow(ex[1],2)); 
    for(int j=0;j<2;j++) 
     { 
     ex[j]=ex[j]/(sqrt(pow(ex[0],2)+pow(ex[1],2))); 
     } 
    for(int j=0;j<2;j++) 
     { 
     i=i+(p3[j]-p1[j])*ex[j]; 
     } 
    for(int j=0;j<2;j++) 
     { 
     ey[j]=p3[j]-p1[j]-i*ex[j]; 
     } 
    for(int j=0;j<2;j++) 
     { 
     ey[j]=ey[j]/(sqrt(pow(ey[0],2)+pow(ey[1],2))); 
     } 
    for(int j=0;j<2;j++) 
     { 
     k=k+(ey[j]*(p3[j]-p1[j])); 
     } 
    x=(pow(distA,2)-pow(distB,2)+pow(d,2))/(2*d); 
    y=((pow(distA,2)-pow(distC,2)+pow(i,2)+pow(k,2))/(2*k))-((i/k)*x); 

    //Calculating the co-ordinates of the point to be trilaterated 

    for(int j=0;j<3;j++) 
     { 
     triPt[j]=p1[j]+x*ex[j]+y*ey[j]; 
     } 

    //Print the values 

    cout<<triPt[0]<<endl<<triPt[1]; 
    getch(); 
    return 0; 
}