如何解决BLE标签从一个位置移动到另一位置
我一直在做一些实验以获得精确的位置,所以我确实遵循了
-
获取一楼的地图图像,并基于仪表,我为图像设置了像素,以便可以找到放置在地图上的BLE扫描仪的正确位置
public static PointF GetLocationWithCenterOfGravity(PointF a,PointF b,PointF c,float dA,float dB,float dC)
{
//http://stackoverflow.com/questions/20332856/triangulate-example-for-ibeacons
var METERS_IN_COORDINATE_UNITS_RATIO = 1.0f;
//http://stackoverflow.com/a/524770/663941
//Find Center of Gravity
var cogX = (a.X + b.X + c.X) / 3;
var cogY = (a.Y + b.Y + c.Y) / 3;
var cog = new PointF(cogX,cogY);
//Nearest Beacon
PointF nearestBeacon;
float shortestdistanceInMeters;
if (dA < dB && dA < dC)
{
nearestBeacon = a;
shortestdistanceInMeters = dA;
}
else if (dB < dC)
{
nearestBeacon = b;
shortestdistanceInMeters = dB;
}
else
{
nearestBeacon = c;
shortestdistanceInMeters = dC;
}
//http://www.mathplanet.com/education/algebra-2/conic-sections/distance-between-two-points-and-the-midpoint
//distance between nearest beacon and COG
var distancetoCog = (float)(Math.Sqrt(Math.Pow(cog.X - nearestBeacon.X,2)
+ Math.Pow(cog.Y - nearestBeacon.Y,2)));
//Convert shortest distance in meters into coordinates units.
var shortestdistanceInCoordinationUnits = shortestdistanceInMeters * METERS_IN_COORDINATE_UNITS_RATIO;
//http://math.stackexchange.com/questions/46527/coordinates-of-point-on-a-line-defined-by-two-other-points-with-a-kNown-distance?rq=1
//On the line between Nearest Beacon and COG find shortestdistance point apart from Nearest Beacon
var t = shortestdistanceInCoordinationUnits / distancetoCog;
var pointsDiff = new PointF(cog.X - nearestBeacon.X,cog.Y - nearestBeacon.Y);
var tTimesDiff = new PointF(pointsDiff.X * t,pointsDiff.Y * t);
//Add t times diff with nearestBeacon to find coordinates at a distance from nearest beacon in line to COG.
var userLocation = new PointF(nearestBeacon.X + tTimesDiff.X,nearestBeacon.Y + tTimesDiff.Y);
return userLocation;
}
-
计算三角形的重心(3 BLE扫描仪)
-
计算最短距离/最近的信标
-
计算信标与重心之间的距离
-
将最短距离转换为坐标单位 常数,他曾经用来预测准确性。
-
您可以通过更改常数进行测试
-
计算距离增量
-
添加带有最近信标
x,y
的增量。
测试后,我发现使用BLE标签移动时,它没有显示位置移动。但是,如果我站在某个地方,则4-5秒后标记会跳到该位置。 BLE标签从一个位置移动到另一位置如何显示适当的移动性?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。