Rotation Vector Sensor Android – Gyroscope

After messing around with sensors for a while and tried to see what TYPE_ROTATION_VECTOR actually returned as values. The docs seemed pretty sparse to me!

But whenever I tried to run a simple program to display the sensor output the activity crashed….due to a null pointer exception. Read a few posts and none was very clear….some mentioned that a gyroscope was needed…

Found this post which implies the device needs a gyroscope to implement a Rotation Vector Sensor.

Not 100% but as much information as I can find online!

4 Responses

  1. Hardy Henneberg October 13, 2011 / 19:15

    I have tried to use the rotation-vector sensor in my app.

    My is a keyboard, where the display is a window moving over a big virtual keyboard. The window movement is controlled by the accelerometer and the gyro (if there is one). I use the sensor informations ( Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_GYROSCOPE) to calculate the pitch and roll angles. The accelerometer measures a combination of the gravity vector, which is can be transformed to pitch and roll, and the ‘linear acceleration’, which comes from a shaking hand and which is unwanted disturbance in my app. This disturbance can be filtered away, but that also makes the reactions to rotation slow – it causes an elastic effect. The gyro measures the angular velocity. It cannot measure absolute angles, so if I only had a gyro, the window would drift away. But a combination of accelerometer, the gyro, and some filtering makes reactions to rotation fast and without the shaking.

    Today I tried to use the rotation_vector ‘sensor’ in stead, because it seemed to provide the angles directly, without the need of all the calculations. And that actually worked quite well – at least for my app running on Nexus S. So I think the rotation-vector sensor is just some software doing some calculations on the values from the accelerometer, the gyro, and maybe the magnetic sensor.

    That would be very good, if calculations were optimized – but at least for my app, they are not. The window reacts faster to rotation, when I use my own calculation, and it also move more fluently with less flicker.

    Best Regards
    Hardy Henneberg

    • DCrowley October 18, 2011 / 11:00

      That is interesting! Hopefully when I get time and my own phone with a gyroscope I am gonna build an app to compare methods – it would be great if the rotation_vector worked – but if the response time is slow it kind of removes it usefulness in most of the applications I could see it being used in

    • Navigator February 9, 2012 / 11:59

      Hi Hardy,

      Is the TYPE_ROTATION_VECTOR is free from any gyro drift as it is common problem with gyro signal because it drift with time.
      You mean, some processing is already done to remove gyro drift while constructing ROTATION_VECTOR. Am i right?
      Plz comment


      • DCrowley February 9, 2012 / 12:01

        Generally to “remove” drift in both gyros and accelerometer sensors – they are used in conjunction to stop the drift in both


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.