0
votes

I would like to do some work based on the rotation vector. The problem is that the most of Android devices have not the gyroscope sensor (nor the rotation vector sensor). I think there is a way for calculating an approximation of the quaternion by using the accelerometer (for pitch and roll) and the magnetometer (for yaw). The problem is that their values are not limited by a maximum value (for pitch and roll I could use G=9.81 and try to filter the additional acceleration).

May someone help me to find an approximated solution?

1

1 Answers

1
votes
float[] rotationMatrix = new float[16];
float[] rotationMatrixRemapped = new float[16];
float[] accMagOrientation = new float[3];

SensorManager.getRotationMatrix(rotationMatrix, null, oldAccelerometerVals, oldMagnetometerVals);
SensorManager.remapCoordinateSystem(rotationMatrix, SensorManager.AXIS_MINUS_Y, SensorManager.AXIS_MINUS_X, rotationMatrixRemapped);
SensorManager.getOrientation(rotationMatrix, accMagOrientation);