Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent readings of alpha angle #21

Closed
Paultok opened this issue Jun 9, 2016 · 11 comments
Closed

Inconsistent readings of alpha angle #21

Paultok opened this issue Jun 9, 2016 · 11 comments

Comments

@Paultok
Copy link

Paultok commented Jun 9, 2016

I am using gyronorm.js on a Android 4.2.2 LG G2 smartphone with recent versions of Firefox and Chrome. I am unable to get consistent readings after some rotations. For example, after the first reading, if I keep rotating the phone 90° clockwise - on the z axis only - and then back to the original position, then the alpha angle at the original position constantly decreases with a rate of ~5° per "rotation cycle".

Do you know why this happens? Is there a way to fix this? Does it depend on the phone (e.g. is it old)?

EDIT: I forgot to mention that I also calibrated the sensor, of course.

@dorukeker
Copy link
Owner

Just to dobule check the issue is as follows:

Your device is lying on the table with the screen facing up. You start the Gyronorm and get the alpha value as 0. You rotate the phone around z-axis (screen still facing up). And after couple of rotations for the same position it starts to show slightly different value than 0.

Unfortunately I know the issue. In a native app the gyroscope values are super accurate. But in the web browser they are not. So they change over time. Gyronorm is build on top of the native values in the JavaScript so the results you get from Gyronorm is also shifting.

The amount of that shift differs depending on the phone model and the browser you use.

I gave some though on how to address this issue. I could not find any yet :) Any suggestions?

@greggman
Copy link

In a native app the gyroscope values are super accurate. But in the web browser they are not

If this is true on the same phone (and if this is Android/Chrome) could you please report the issue at http://crbug.com with the app that's accurate and simple web example that shows the issue?

I know the team would want to fix it

@dorukeker
Copy link
Owner

Thanks @greggman I will check it. Though I am not sure if it is the browser causing the issue; or the device passing the values to the browser like this. :) It sure worths to try.

@Paultok
Copy link
Author

Paultok commented Jun 11, 2016

@dorukeker It's exactly like that. However, I cannot confirm that a native app would not suffer from the accuracy problem though, as I do not know one to try at the moment. The javascript code I am using in the browser is as simple as it could be and actually directly comes from the Gyronorm examples.

If there's anything else I can do to help to understand or fix this issue, let me know.

@dorukeker
Copy link
Owner

@Paultok thanks for the info. As far as I have experienced the shift comes from the browser. Meaning even if you use low level JacvaScript API, you get this kind of behaviour. I will see if I can over come this.

@greggman btw the issue is not chrome only. The same thing happens on iOS as well. Also on the values on Safari shifts over time.

Since this is not a Gyronorm issue I am closing it. But I will go on researching if I can build something in Gyronorm to fix this.

@greggman
Copy link

greggman commented Jun 13, 2016

My point is if you have a native app where the values don't drift and the values in Safari or Chrome drift then you should file a bug on the browser. The browser teams will be very happy for a verifiable case and be happy to fix the issue.

@Paultok
Copy link
Author

Paultok commented Jun 13, 2016

@dorukeker I can confirm that the readings from browser - without using Gyronorm - suffer from the same problem. By the way, in your experience, do you know if this issue happens to some smartphone devices or android versions only or does it always happen? What are you thinking about to solve this problem?

@dorukeker
Copy link
Owner

@Paultok I have not made an extensive research on this. But I have noticed this happening regardless of the brand or OS version. Perhaps some more some less.

I will look into to see if other sensors data is available in the browser and can be used to avoid that drift.

What is your use case? Maybe we can think of a custom solution for you. Feel free to ping me on Twitter @dorukeker

@Paultok
Copy link
Author

Paultok commented Jun 15, 2016

@dorukeker my use case is very simple. I just need to read the angle on the z axis frequently (every 50ms is ok) and the read must be as precise as possible. The mobile phone can move to any position at any time. I need to do this in any browser, with the gyronorm.js or any other javascript code, but without installing any third-party plugin. It's really disappointing that modern browsers have this kind of problem while other native applications do not.

@greggman
Copy link

Just to reiterate

Provide proof native apps don't have this problem. File a bug on the
browsers. Issue will get fixed

On Wed, Jun 15, 2016 at 9:18 AM, Paultok notifications@github.com wrote:

@dorukeker https://github.com/dorukeker my use case is very simple. I
just need to read the angle on the z axis frequently (every 50ms is ok) and
the read must be as precise as possible. I need to do this in any browser,
with the gyronorm.js or any other javascript code, but without installing
any third-party plugin. It's really disappointing that modern browsers have
this kind of problem while other native applications do not.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAOVNK1O1zBDdYnQPKvfMjNPZyqb5vIjks5qL0S8gaJpZM4IyRw8
.

@Paultok
Copy link
Author

Paultok commented Jun 15, 2016

@greggman I do not know if this counts as a proof, but it was easy to find out one application that does not have this problem. it's called "Device Orientation" from Google Play. I made some tests and the value of the angle is the preserved as expected whenever the mobile is moved to the same position from any other position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants