When a user has a phone in his pocket, I want to be able to capture acceleration along XYZ in the user coordinate system. I say that users of the coordinate system for two reasons:
- The orientation of the device in the pocket should not matter and should give me the same XYZ acceleration values, regardless of orientation
- The direction of walking in relation to the world coordinate system should not matter, so the movement from west to east and movement from east to west should give me the same numbers.
My question is, what is the math needed to convert from acceleration based on user based devices?
I saw one similar thread on this: Android Convert the coordinate system of the device to the "user" coordinate system , but there is no answer, and, in addition, I would like to achieve this without the calibration phase (which allows another thread)
I also saw flows when converting from the device coordinate system to the world coordinate system: Accelerating the device coordinate system to an absolute coordinate system
I implemented this with the following:
float[] accelerometerMatrix = new float[3];
float[] accelerometerWorldMatrix = new float[3];
float[] gravityMatrix = new float[3];
float[] magneticMatrix = new float[3];
float[] rotationMatrix = new float[9];
<code to get and store the sensor values into the respective matrices>
SensorManager.getRotationMatrix(rotationMatrix, null, gravityMatrix, magneticMatrix);
accelerometerWorldMatrix[0] = rotationMatrix[0] * accelerometerMatrix[0] + rotationMatrix[1] * accelerometerMatrix[1] + rotationMatrix[2] * accelerometerMatrix[2];
accelerometerWorldMatrix[1] = rotationMatrix[3] * accelerometerMatrix[0] + rotationMatrix[4] * accelerometerMatrix[1] + rotationMatrix[5] * accelerometerMatrix[2];
accelerometerWorldMatrix[2] = rotationMatrix[6] * accelerometerMatrix[0] + rotationMatrix[7] * accelerometerMatrix[1] + rotationMatrix[8] * accelerometerMatrix[2];
This code, while it works for what it does, puts the XYZ accelerometer values into world space. Now I need to move from this to user space.
, , , , 2) . , , NorthEast, XYZ , SouthWest, , ""
? ,