Sensor.TYPE_ROTATION_VECTOR returns null

When I call SensorManager.getDefaultSensor (Sensor.TYPE_ROTATION_VECTOR) on my device, it returns null. I know this is a virtual sensor (doing some clever maths to take values ​​from real sensors). I am returning null because my device does not have one of the hardware sensors necessary for ROTATION_VECTOR to work.

So my questions are:

  • what hardware sensors are needed for ROTATION_VECTOR to work.
  • What physical devices do this (for example, if I bought a tablet today and wanted the rotation vector sensor to work, which one would I have to buy)?
  • What parameters do I need to design device orientation without a ROTATION_VECTOR sensor?

Edit: We talked with Samsung about this and decided that the gyro sensor in the tablet was broken, and that’s why we came back as a rot_vector sensor.

+5
source share
1 answer

If you read the documentation about how to determine the coordinates for this sensor (find the section Sensor.TYPE_ROTATION_VECTOR:), then the required equipment is obvious: accelerometerand magnetometer, the gyroscope can also be used to get a more stable result (I have a link describing how this sensor works, but cannot find him).

+6
source

All Articles