Func indoorLocationManager(....didUpdatePosition position: is not invoked

Hi Guys,

i’m probably missing something here.
i am trying to setup an env for indoor sdk testing(its my first time…) so here it is below…,
but there are no position updates

class ViewController: UIViewController,EILIndoorLocationManagerDelegate {

    let locationBuilder = EILLocationBuilder()
    var roomDimensions:[EILPoint] = [EILPoint]()
    var locationManager = EILIndoorLocationManager()
    var location:EILLocation!


    override func viewDidLoad() {
....
        locationManager.mode = .Normal
        locationManager.delegate = self

        setupEnv()
        setupBeaconsEnv()
        locationManager.startPositionUpdatesForLocation(location)
    }

        // set room dimensions and orientation
    func setupEnv() {
        roomDimensions.append(EILPoint(x: 0, y: 0))
        roomDimensions.append(EILPoint(x: 0, y: 2.88))
        roomDimensions.append(EILPoint(x: 4.2, y: 2.88))
        roomDimensions.append(EILPoint(x: 4.2, y: 0))        
        locationBuilder.setLocationBoundaryPoints(roomDimensions)        
        locationBuilder.setLocationOrientation(162.0)
    }
            // set beacons locations and build into location (the bla bla is a real beacon identifier in my code...) 
    func setupBeaconsEnv() {
        locationBuilder.addBeaconWithIdentifier("bla bla", atBoundarySegmentIndex: 0, inDistance: 1.64, fromSide: .LeftSide)
        locationBuilder.addBeaconWithIdentifier("bla bla", atBoundarySegmentIndex: 1, inDistance: 0.71, fromSide: .LeftSide)
        locationBuilder.addBeaconWithIdentifier("bla bla", atBoundarySegmentIndex: 2, inDistance: 1.60, fromSide: .RightSide)
        locationBuilder.addBeaconWithIdentifier("bla bla", atBoundarySegmentIndex: 3, inDistance: 0.8, fromSide: .RightSide)        
        location = locationBuilder.build()!
    }

so to summarise things :

  1. delegate - check
  2. room dimension - check
  3. beacon location - check
  4. start pulling data - check
  5. no updates… check :wink:

so my question/needed help here is what am i missing here …
tried the following

  1. bluetooth turned off an on…, didnt help
  2. when i turn off the bluetooth while the app is running i get the
    func indoorLocationManager(manager: EILIndoorLocationManager,didFailToUpdatePositionWithError error: NSError) {
    print(“failed to update position: (error)”)
    }
    invoked !!!, so something is working here, but i still do not get any updates at all

Thanks

Hi Kobi_Mic!

The problematic line is probably this one along with the 3 other similar ones:

You should provide here proper identifier of the beacon that is physically in this place. (beacon identifier i.e. MAC address for Proximity beacon and public ID for Location beacon)
Neverless our SDK should be more informative in such a case! Thank you for reporting the issue we will look further into it.

Hi Marcin_Mycek, first thanks for the quick response but in my code i use a real identifiers aka mac addresses, i’ve just removed them in my post

the problem is happening with the real mac address, the real lines are

    ...Identifier("c5c0baf54084", atBoundarySegmentIndex: 0, inDistance: 1.64, fromSide: .LeftSide)
    ...Identifier("e23b6c5e0c22", atBoundarySegmentIndex: 1, inDistance: 0.71, fromSide: .LeftSide)
    ...Identifier("ca7426168540", atBoundarySegmentIndex: 2, inDistance: 1.60, fromSide: .RightSide)
    ...Identifier("d1407ea68f7a", atBoundarySegmentIndex: 3, inDistance: 0.8, fromSide: .RightSide)

Got it :slight_smile:

Few questions to help us debug:

  • What version of SDK are you using?
  • When turning on the app when more or less (x,y) are you standing?

Hi

SDK Version = 2.2.0 (April, 1, 2016)
(the April 1 should worry me… :slight_smile: )

I am sitting about (0.9, 1.3) ~ inside obviously
the beacons are at 2m height around me ( the room dimensions are about 4x3 meters )

Can you let us know what the error is?

Hi, sorry for the big delay
the error is an obvious one it says no bluetooth which is obvious since i turned it off

i’ve also tested the demo app itself (install from cocoapods) i’ve changed some lines but it also did not work!!!

here is the changed code from the indoor demo :

its just : creating walls, adding beacons , build it and start pulling updates…WHAT AM I MISSING HERE ?

class ViewController: UIViewController, EILIndoorLocationManagerDelegate {

let locationManager = EILIndoorLocationManager()
var location: EILLocation!
let locationBuilder = EILLocationBuilder()
var roomDimensions:[EILPoint] = [EILPoint]()

@IBOutlet weak var locationView: EILIndoorLocationView!

override func viewDidLoad() {
    super.viewDidLoad()

    roomDimensions.append(EILPoint(x: 0.0, y: 0.0))
    roomDimensions.append(EILPoint(x: 0.0, y: 2.88))
    roomDimensions.append(EILPoint(x: 4.2, y: 2.88))
    roomDimensions.append(EILPoint(x: 4.2, y: 0.0))
    
    
    locationBuilder.setLocationOrientation(162.0)
    locationBuilder.setLocationBoundaryPoints(roomDimensions)

    locationBuilder.addBeaconWithIdentifier("c5c0baf54084", atBoundarySegmentIndex: 0, inDistance: 1.64, fromSide: .LeftSide)
    locationBuilder.addBeaconWithIdentifier("e23b6c5e0c22", atBoundarySegmentIndex: 1, inDistance: 0.71, fromSide: .LeftSide)
    locationBuilder.addBeaconWithIdentifier("f9f0c7eaca3e", atBoundarySegmentIndex: 1, inDistance: 2.21, fromSide: .RightSide)
    locationBuilder.addBeaconWithIdentifier("ca7426168540", atBoundarySegmentIndex: 2, inDistance: 1.60, fromSide: .RightSide)
    locationBuilder.addBeaconWithIdentifier("ceb35b58b8a7", atBoundarySegmentIndex: 3, inDistance: 3.3, fromSide: .RightSide)
    locationBuilder.addBeaconWithIdentifier("d1407ea68f7a", atBoundarySegmentIndex: 3, inDistance: 0.8, fromSide: .RightSide)
    
    location = locationBuilder.build()
    
    self.locationManager.delegate = self

    // You will find the identifier on https://cloud.estimote.com/#/locations
    // let fetchLocationRequest = EILRequestFetchLocation(locationIdentifier: "<#my-location#>")
    // fetchLocationRequest.sendRequestWithCompletion { (location, error) in
        if let location = location {
            self.location = location

            // You can configure the location view to your liking:
            self.locationView.showTrace = true
            self.locationView.showWallLengthLabels = true
            self.locationView.rotateOnPositionUpdate = true
            // Consult the full list of properties on:
            // http://estimote.github.io/iOS-Indoor-SDK/Classes/EILIndoorLocationView.html

            self.locationView.drawLocation(location)
            self.locationManager.startPositionUpdatesForLocation(self.location)
    }
}

func indoorLocationManager(manager: EILIndoorLocationManager, didFailToUpdatePositionWithError error: NSError) {
    print("failed to update position: \(error)")
}

func indoorLocationManager(manager: EILIndoorLocationManager, didUpdatePosition position: EILOrientedPoint, withAccuracy positionAccuracy: EILPositionAccuracy, inLocation location: EILLocation) {
    var accuracy: String!
    switch positionAccuracy {
    case .VeryHigh: accuracy = "+/- 1.00m"
    case .High:     accuracy = "+/- 1.62m"
    case .Medium:   accuracy = "+/- 2.62m"
    case .Low:      accuracy = "+/- 4.24m"
    case .VeryLow:  accuracy = "+/- ? :-("
    case .Unknown:  accuracy = "unknown"
    }
    print(String(format: "x: %5.2f, y: %5.2f, orientation: %3.0f, accuracy: %@", position.x, position.y, position.orientation, accuracy))

    self.locationView.updatePosition(position)
}

And nothing happens, no position updates in the console
Another weird thing is that the image of the room does not scale to screen, i always see like 60% of the room (i see a cut off rectangle missing a wall)

Kobi, thank you so much for the detailed reports so far, and for your patience! We investigated the problem and thanks to your help (and a few other reports as well), we think we found the root cause of the problem. A fix is on the way, and in the meantime, moving:

self.locationManager.startPositionUpdatesForLocation(self.location)

from viewDidLoad to viewDidAppear should work around this.

Sorry for all the trouble, we really appreciate your help!

BTW, what use case do you have in mind for Indoor Location? We’re curious, so if you don’t mind sharing, we’d love to know!—and hopefully advise on the best practices, hints, etc. (If you prefer, feel free to ping me directly: piotr@estimote.com)

Hi, Thanks for for the update
I’ve tried it, but sorry it didn’t work

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)
    self.locationManager.startPositionUpdatesForLocation(self.location)
}

same effect, no updates.
in the mean time i think i should downgrade the sdk version and test again

testing 2.1.0 with the same code results an error :

failed to update position: Error Domain=com.estimote Code=1 “Can’t determine position outside the location.” UserInfo={NSLocalizedDescription=Can’t determine position outside the location.}

which is wrong, since i am inside the room

Hmm, thanks for checking that—looks like you’re not affected by this very bug, but by something else.

What iOS device are you using for tests? Can you see your beacons on the radar in the “regular” Estimote app?

My device is 6s ios 9.3.1

Thanks for your help

I’ve managed to make the demo app to work, so now i am “playing” with my setup params

Ha, cool, what was the problem, have you figured it you?

Hi can you please explain that how did you fix your problem.
Please help me out i am having the same problem.

Hi

it was a long time ago, but it was related to the sdk version, they had a bug (i think), try edit the pod file and start downgrade versions, or if you dont use cocoapods ,then download/checkout older versions to verify it

if you walk through the posts you would see, i started out with SDK Version = 2.2.0 (April, 1, 2016)
then 2.1.0, then 2.0.0