Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:42:31+00:00 2026-06-05T19:42:31+00:00

If I have a simple web page and script that looks like this: <body>

  • 0

If I have a simple web page and script that looks like this:

<body>
    <div id="alpha">a</div>
    <div id="beta">b</div>
    <div id="gamma">g</div>
</body>

<script>
window.addEventListener('deviceorientation', function(event) {
    var alpha = event.alpha;
    var beta = event.beta;
    var gamma = event.gamma;

    document.getElementById("alpha").innerHTML = alpha;
    document.getElementById("beta").innerHTML = beta;
    document.getElementById("gamma").innerHTML = gamma;

}, false);
</script>

I can open it up in mobile Firefox for Android and it will output 3 numbers that look like the following:

89.256125
3.109375
0.28125

Where when I rotate the device, the numbers change based on the axis of rotation. I noticed the values for “alpha” are really noisy – they bounce around non-stop even if the phone is at rest on my desk, while the other two remain steady. I understand that alpha is my heading. I’m curious then, is it getting the “alpha” value from the compass (which has noise issues) and the other two from the gyroscope?

Another issue is when I change the pitch, for some reason the heading changes too, even if I don’t actually change the heading. I’m just curious why this is and how it can be corrected?

Also, since the gyroscope measures angular velocity, I presume this event listener is integrating it automatically – is the integration algorithm as good as any? Does it use the accelerometer to correct the drift?

In this google tech talk video, from 15:00 to 19:00, the speaker talks about correcting the drift inherent in the gyroscope by using the accelermoter, as well as calibrating the orientation with respect to gravity: http://www.youtube.com/watch?v=C7JQ7Rpwn2k
How would I go about doing this?

Thanks for any insights anyone may have.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:42:32+00:00Added an answer on June 5, 2026 at 7:42 pm

    The device orientation is obtained by sensor fusion. Strictly speaking, none of the sensors measures it. The orientation is the result of merging the accelerometer, gyro and magnetometer data in a smart way.

    I noticed the values for “alpha” are really noisy – they bounce around
    non-stop even if the phone is at rest on my desk, while the other two
    remain steady.

    This a common problem with the Euler angles, try to avoid them if you can.

    By the way, the Sensor Fusion on Android Devices: A Revolution in Motion Processing video you link to explains it at 38:25.

    Also, since the gyroscope measures angular velocity, I presume this
    event listener is integrating it automatically – is the integration
    algorithm as good as any? Does it use the accelerometer to correct the
    drift?

    Yes, the gyro drift is corrected with the help of the accelerometer (and magnetometer, if any) readings. This is called sensor fusion.

    In this google tech talk video, from 15:00 to 19:00, the speaker talks
    about correcting the drift inherent in the gyroscope by using the
    accelermoter, as well as calibrating the orientation with respect to
    gravity: http://www.youtube.com/watch?v=C7JQ7Rpwn2k How would I go
    about doing this?

    If you have orientation then somebody already did all this for you. You don’t have to do anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple jQuery code that runs on a web page that has
This is for a simple web-page assignment. I have a few pages on which
I have a script that I'd like to continue using, but it looks like
So I have simple html web page with one div with id=toFill on it.
This is a very simple form that I have found on the web (as
Okay so I have a bash script that simply downloads a web page, and
I have a simple image upload script that uses SimpleImage.php (http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/) to resize and
I have a simple web app: a web page with a form to submit,
I have made a simple web-page including a couple of static pages, a css
I have a problem with a web page. The introduction of a simple <base

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.