Estimote / iOS-Indoor-SDK

Estimote Indoor SDK for iOS
MIT License
484 stars 136 forks source link

Can't create correct location using ESTLocationBuilder #9

Closed sashakid closed 9 years ago

sashakid commented 9 years ago

Hi, guys, I can't create correct location manually and have some questions about it. I draw picture to explain what location I want to build. I was looking for answers on my question in your manual and in comments for SDK code but I still can't understand some moments:

  1. What is ESTLocationBuilderSide? How can I implement correctly these values for my location?
  2. How to implement setLocationOrientation:? Is it value in degrees of my deflection from North when I stay face to my location top? (see my picture)

screenshot 2015-05-21 12 11 52

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

This is my code, please, tell me what am I doing wrong. Thanks :-)

mzygar commented 9 years ago
  1. What is ESTLocationBuilderSide? How can I implement correctly these values for my location?

In ESTLocationBuilder.h there's a comment saying it's: /** Side of the boundary segment as seen from inside of the location. */

I'm not sure about 2. but I think you get it right. Let's wait for Estimote's answer.

There is one more thing I see in your code:

[locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
                       atBoundarySegmentIndex:0
                                   inDistance:0
                                     fromSide:ESTLocationBuilderLeftSide];

In your case, Beacon1 is in the middle of the wall, so the value of paramter inDistance should equal 7.46/2= 3.73meteres from whichever side (left or right), as it is centered ;)

sashakid commented 9 years ago

@mzygar

  1. How can I understand it? I've read all comments) My walls are boundary segments, I have 4 walls and location's shape is rectangular. Which of my boundary segments are on left side and which on right side? Or should I use nil for top and bottom (the wall in front of me and the wall besides me) and ESTLocationBuilderLeftSide for only left side and ESTLocationBuilderRightSide for right?
  2. Oh, you want to say I've entered wrong parameters?
 * @param distance Distance from the beacon to the side of the boundary segment.

What is the boundary segment in that case? I thought it's wall in my loaction.

mzygar commented 9 years ago

Imagine you are standing in the middle of the room.

You take a look at the first wall (boundarySegmentIndex:0), the one with Beacon1 on it. You measure the distance between the beacon and right or left end of the wall. You put the result in [locationBuilder addBeaconIdentifiedByMac:MAC1 atBoundarySegmentIndex:0 inDistance:<YOUR DISTANCE HERE> fromSide:<LEFT OR RIGHT HERE>;] repectively. Then you turn and repeat the process for the remaining walls(changing boundarySegementIndex accordingly)

Does that make sense?

sashakid commented 9 years ago

Ok, I understand what you mean.

distance between the beacon and right or left end of the wall

In my case for 1st wall it will be:

[locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
                       atBoundarySegmentIndex:0
                                   inDistance:3.73
                                     fromSide:ESTLocationBuilderLeftSide];

So, I shouldn't repeat the same for right side?

mzygar commented 9 years ago

So, I shouldn't repeat the same for right side?

Nope, you measure once per beacon. If you measured the distance to the left side, there is no need to measure distance to the right(as the SDK can compute it). You just move on to the next beacon/wall.

sashakid commented 9 years ago

@mzygar thanks for explaining :-) Maybe someone could help me with 2nd question.

heypiotr commented 9 years ago

For the 2nd question: align yourself along the [0,1] vector. Looking at your floor plan, that'd be "facing the top". Then open the compass app, read the number it shows, punch it into the setLocationOrientation: method. Let us know if this solves your problem (:

Really appreciate you coming here with your issue, it tells us know our documentation still needs some work. Thank you! :bowtie: :tada:

BTW, in the future, consider posting on our forums instead: forums.estimote.com :wink:

sashakid commented 9 years ago

Thanks, it works )