Commit 62f298a5 authored by Marcel Kyas's avatar Marcel Kyas
Browse files

The rotation matrix was written incorrectly.

SensorManager.getRotationMatrix() was called with 4x4 matrixes,
but the 3x3 matrix result was stored, leading to constant 0 and
missing values. Also, the string of the matrix is built in a
StringBuffer instead of concatenating strings.
parent b31a17f2
...@@ -320,8 +320,8 @@ public class PhoneSensors extends MySensor implements SensorEventListener{ ...@@ -320,8 +320,8 @@ public class PhoneSensors extends MySensor implements SensorEventListener{
if (mGeomagnetic == null) {return;} if (mGeomagnetic == null) {return;}
// calculate rotationMatrix and orientation // calculate rotationMatrix and orientation
float[] R = new float[16]; float[] R = new float[9];
float[] I = new float[16]; float[] I = new float[9];
// derive rotation matrix from grav and geo sensors // derive rotation matrix from grav and geo sensors
boolean success = SensorManager.getRotationMatrix(R, I, mGravity, mGeomagnetic); boolean success = SensorManager.getRotationMatrix(R, I, mGravity, mGeomagnetic);
...@@ -343,16 +343,13 @@ public class PhoneSensors extends MySensor implements SensorEventListener{ ...@@ -343,16 +343,13 @@ public class PhoneSensors extends MySensor implements SensorEventListener{
// rotation matrix // rotation matrix
//Write the whole rotationMatrix R into the Listener. //Write the whole rotationMatrix R into the Listener.
String sb = String.valueOf(R[0]) + ';' + StringBugger sb();
R[1] + ';' + for (int i = 1; i < 8; i++) {
R[2] + ';' + sb.append(R[i]);
R[3] + ';' + sb.append(';');
R[4] + ';' + }
R[5] + ';' + sb.append(R[8]);
R[6] + ';' + listener.onData(SensorType.ROTATION_MATRIX, sb.toString());
R[7] + ';' +
R[8];
listener.onData(SensorType.ROTATION_MATRIX, sb);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment