无法手动创建正确的位置 - 它总是显示错误的位置。有人可以告诉我如何正确地做并显示我的代码中哪里有错误的值吗?谢谢。
ESTLocationBuilder *locationBuilder = [ESTLocationBuilder new];
[locationBuilder setLocationBoundaryPoints:@[
[ESTPoint pointWithX:0 y:0],
[ESTPoint pointWithX:0 y:7.46],
[ESTPoint pointWithX:7.6 y:7.46],
[ESTPoint pointWithX:7.6 y:0]
]];
[locationBuilder setLocationOrientation:275];
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
atBoundarySegmentIndex:0
inDistance:0
fromSide:ESTLocationBuilderLeftSide];
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac2
atBoundarySegmentIndex:1
inDistance:0
fromSide:ESTLocationBuilderLeftSide];
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac3
atBoundarySegmentIndex:2
inDistance:0
fromSide:ESTLocationBuilderRightSide];
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac4
atBoundarySegmentIndex:3
inDistance:0
fromSide:ESTLocationBuilderRightSide];
self.location = [locationBuilder build];
最佳答案
您设置点和方向的方式看起来不错。
唯一需要改变的是:
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
atBoundarySegmentIndex:0
inDistance:0
fromSide:ESTLocationBuilderLeftSide];
这段代码是这样的:
I have a beacon with MAC addreses
kBeaconMac1
placed on the first wall (atBoundarySegmentIndex:0
), 0 meters (inDistance:0
) from the left side of the wall (fromSide:ESTLocationBuilderLeftSide
).
“左”或“右”理解为“我在房间中间,正对着墙;左边在我的左边,右边在我的右边”。
“第一堵墙”理解为您在 setLocationBoundaryPoints
中定义的前两点之间的墙。 “第二面墙”位于第二点和第三点之间,“第三面墙”位于第三点和第四点之间,最后的“第四面墙”——第四面和第一面。
看图片,你的信标实际上在墙的中间,所以你想将 inDistance
参数设置为 theWidthOfTheWall/2
,即“第一堵墙”,7.46/2 = 3.73
。在这种特定情况下,“左”或“右”并不重要。
下面是与图片匹配的代码:
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
atBoundarySegmentIndex:0
inDistance:3.73
fromSide:ESTLocationBuilderLeftSide];
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac2
atBoundarySegmentIndex:1
inDistance:3.8
fromSide:ESTLocationBuilderLeftSide];
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac3
atBoundarySegmentIndex:2
inDistance:3.73
fromSide:ESTLocationBuilderRightSide];
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac4
atBoundarySegmentIndex:3
inDistance:3.8
fromSide:ESTLocationBuilderRightSide];
关于ios - 无法使用 iOS Estimote Indoor SDK 手动创建位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30369615/