Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compass heading from deviceorientation
Message
De
24/04/2014 08:21:43
 
 
À
24/04/2014 08:04:45
Information générale
Forum:
HTML5
Catégorie:
Problèmes de navigateur
Divers
Thread ID:
01598938
Message ID:
01598952
Vues:
24
>>>>>Maybe you should update the screen in steps to make it smooth
>>>>>
>>>>>
>>>>>for( x = oldPosition; x <= newPosition; x += 0.5 ) // degrees  ( or less than 0.5)
>>>>>   updateScreen();
>>>>>
>>>>
>>>>Hmm. The events come in fast enough - in fact, as in previous reply, I'm taking the opposite approach to *reduce* the number of screen updates (which draws an arrow on HTML5 Canvas)
>>>
>>>
>>
>>>The Nexus has a gyroscope ? Try this http://www.sundh.com/blog/2011/09/stabalize-compass-of-iphone-with-gyroscope/
>>
>>I believe the deviceorientation event must supply data using both the gyroscope and compass. IAC it's the only HTML5 API method of accessing the information.
>>But the device calibration (based on looking at an app such as 'Micro Spirit Level') is good.
>>
>>I should also probably clarify what I meant by 'flick':
>>
>>When rotating the device smoothly on a flat service the reading will increment smoothly to a certain point then jump a seemingly random amount (maybe 30 degrees, maybe more). Reversing the rotation direction slightly will then cause it to jump back by the same amount.
>
>Viv,
>Considering that
>(1) You get the updates pretty fast
>(2) on a flat service the reading will increment smoothly
>(3) to a certain point then jump a seemingly random amount (maybe 30 degrees)
>
>If there's no bug in your code, you may receive 'false' information
>
>I would try to ignore/skip an update if it's more than, say, 10 degrees or so different from the previous position.

I see what your saying but when it 'flicks' it doesn't seem to be a single (or even a few) 'spurious' results - i.e it doesn't 'flick' back until the motion is reversed.
No bug in the code - for testing I'm using the alpha value directly with no adjustment.

I'm thinking that when the device is sitting on a flat service there's a fine line between positive and negative y or z values. If one of those flips then maybe it upsets the alpha (x) reading. That's why I hoped that the code which takes all three vectors into consideration would help.

It would be nice it I could just find an example HTML5 page out there where this works ;-}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform