adtile / Full-Tilt

Other
314 stars 71 forks source link

accuracy #11

Open jonnylevy opened 9 years ago

jonnylevy commented 9 years ago

Hi,

I have the following code in my web-app (Its a basic compass app):

var promise = FULLTILT.getDeviceOrientation({'type': 'world'});
promise.then(function(orientationControl) {
    orientationControl.listen(function() {
        var screenAdjustedEvent = orientationControl.getScreenAdjustedEuler();
        var heading = screenAdjustedEvent.alpha;
    });
});

What I am noticing is that for the first few seconds, the heading value is inaccurate. It moves around a few different values before becoming stable. I am guessing this is whilst the device is calibrating.

Is there a way I can detect when this has finished calibrating i.e. ready?

At the moment, I am just waiting a few seconds before doing my processing but i'm hoping there is something more accurate than that?

I am testing on Safari iOS 8.1 btw.

Thanks

dorukeker commented 9 years ago

Hi,

AFAIK if you are receiving any value the device is ready and already sending values. Meaning that is the point where your ready event is triggered :)

If you still see fluctuation in the values, I would suggest to use a timeout. Not the ideal way but it might solve the issue for you.

Also there is a check of sensors before you can get any value. It is in the /src/Utils.js Currently it is set to 50ms. Maybe you can play with this duration as well.

Cheers, Doruk