无法使用 iOS Estimote Indoor SDK 手动创建位置

Can't create location manually using iOS Estimote Indoor SDK

无法手动创建正确的位置 - 它总是显示错误的位置。有人可以告诉我如何正确地做并显示我的代码中哪里有错误的值吗?谢谢

    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).

"Left" 或 "Right" 理解为 "I'm in the middle of the room, facing directly towards the wall; the left side is to my left and the right side is to my right".

"First wall" 理解为您在 setLocationBoundaryPoints 中定义的前两点之间的墙。 "Second wall"在第二点和第三点之间,"Third wall"在第三点和第四点之间,最后的"Fourth wall"——第四点和第一点。

看图片,你的信标实际上在墙的中间,所以你想 inDistance 参数设置为 theWidthOfTheWall / 2,即 "First wall" , 7.46 / 2 = 3.73.在这种特殊情况下,"left" 或 "right" 无关紧要。

这是与图片匹配的代码:

[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];