Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just trying to answer... correct me if i'm wrong.. </p> <p>1.Yes you are on the right track</p> <p>2.gravity in CM is already "isolated" from user gravity (gravity value caused by user acceleration) thats why there is two gravity, the "gravity" and "userAcceleration" its on apple CM documentation // Note : not entirely isolated // </p> <p>3. if you have a gravity 0 it mean that the coresponding axis is perpendicular with gravity. gravity.z is the iPhone screen thats why it -9.82m/s2 if you put on the desk with screen upright, actualy it hard to get 0 or maximum value of the gravity due to the sensor noise (it's normal, all sensor has a noise expecially cheap sensor).</p> <p>what i do on my apps is I will switch my reference axis to other axis (in your case may be x or y) for certain limits, how the strategy is depend on the purpose or which side is your reference. </p> <p>the other thing is, gyro is fast but its not stable, you need to re-calibrate the value for several interval. In my case every 5 second. I've experiment with gyro for calculating angle between two plane, i try with exacly 90 degree ruler and it will give an error about 0.5 degree every second try and keep increasing, but thats is mine, maybe others have a better method for avoid the error. </p> <p>below is my steps "</p> <ol> <li>Init</li> <li>Read gravity XYZ -> Xg Yg Zg </li> <li>Check if Xg &lt; 0.25 If TRUE try Yg then Zg // Note 1 = 1g = 9.82 m/s^2</li> <li>Read the compass and gyro</li> <li>Configure and calibrate the gyro using the compass and calulate based on which axis i use in point 3.</li> <li>If 5 second is pass then recalibrate, read the compass</li> <li>If the the difference with gyro reading is > 5 degree skip recalibartion the gyro. </li> <li>If the the difference with gyro reading is &lt; 5 degree calibrate the gyro using compass value</li> </ol> <p>Note: for number 7 : is to check if the phone affected with magnetic field or near huge steel such or high voltage electrical line or in noisy and heavy equipment in factory plant.</p> <p>Thats all... Hope this could help you... And sorry for my english.. </p>
 

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