Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing accelerometer and gyrometer to track the phone movement independently from the orientation
    primarykey
    data
    text
    <p>I have been experimenting with the Coremotion APIS, with the goal of transforming the coordinates from the phone reference system to the "earth" reference system as the one that is stored in the CMAttitude object. What I tried till now is by getting the CMRotationMatrix</p> <pre><code>CMRotationMatrix r = motionManager.deviceMotion.attitude.rotationMatrix; </code></pre> <p>and do a matrix multiplication with</p> <pre><code>CMAcceleration a = motionManager.deviceMotion.gravity; </code></pre> <p>in the following way (typedef float vec3f[3])</p> <pre><code>vec3f accelerationInReferenceSystem; accelerationInReferenceSystem[0] = a.x * r.m11 + a.y * r.m12 + a.z * r.m13; accelerationInReferenceSystem[1] = a.x * r.m21 + a.y * r.m22 + a.z * r.m23; accelerationInReferenceSystem[2] = a.x * r.m31 + a.y * r.m32 + a.z * r.m33; </code></pre> <p>But, no luck. I am not that keen in 3D graphics, and there's not much documentation on how to use the various CMRotationMatrix, quaternions, etc. Before going this way, I have tried to log the values of d.attitude.pitch, d.attitude.roll and d.attitude.yaw. For what I have read, it's not the way to go, but besides that, I have found that the value returned by d.attitude.pitch spans just PI radians so I would need to include the yaw in the computation of the pitch angle from 0 to 2PI in order to understand where the head of the phone is heading. It seemed to me that using the rotation matrix would be the good way to go. Also, I wonder if I need to use a matrix that is the inverse of the current rotation matrix in order to take the coordinates into the system identified by r.attitude, thank you if you can help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload