How to isolate gravity on the accelerometer

3

I'm developing an app where the user needs to shake the phone in all directions and the smartphone needs to maintain steady guidance in the meantime. The problem is that all forms of spatial orientation such as TYPE_ROTATION_VECTOR , TYPE_GEOMAGNETIC_ROTATION_VECTOR , and even getRotationMatrix() use the accelerometer together, and the moment the user moves the cell the direction of gravity changes due to forces sides.

Is there any kind of filter to isolate gravity? That is to isolate the movements of the user, so that the sensor only returns the direction of gravity to improve orientation.

There are several posts on how to remove gravity, but there is nothing about isolating it.

    
asked by anonymous 02.10.2014 / 05:25

2 answers

1

You can use the getInclination( float[] I ) function, it gives the slope only, in angle (radians). That is, it gives the slope in relation to the force of gravity.

float inclinacao = SensorManager.getInclination(inclinationMatrix);

So you can adjust the rotation of the screen according to the angle.

    
06.11.2014 / 15:01
0

I do not know if I understand the question.

The accelerometer does not measure gravity, it measures accelerations, including that of gravity. When you move the cell, gravity does not "change", the resulting vector changes.

If you can remove gravity, you can isolate the vector from the user's movements (which will be the total minus the severity). If you can isolate this vector, just subtract from the total you get the gravity.

    
06.11.2014 / 06:32