SensorManager's getRotationMatrix() and getOrientation() methods are interesting to look at. You can see their implementation here: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/hardware/SensorManager.java;h=bf945ec7bae33525decaeed3067266719b977303;hb=donut-release#l1059 http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/hardware/SensorManager.java;h=bf945ec7bae33525decaeed3067266719b977303;hb=donut-release#l1272
Inputs are acceleration and magnetic readings for the first method and the results of it for the second. I wonder what the difference is between using those methods and using Sensor.TYPE_ORIENTATION, though. The docs note the former is more accurate, but not why: http://developer.android.com/intl/fr/reference/android/hardware/SensorEvent.html#values On Oct 5, 12:22 am, DD <daviddiaofri...@gmail.com> wrote: > Hi Rud, I just finished reading all on your blog. For your reply to my > first question, how Android computes the orientation from the > acceleration. I think only one article is sort of related to my > question, which is > > 13 July 2009 > Sensor - Accelerometer & Magnetics > > But...er...sorry, I can't really see how Android does the internal > calculation. What I want to know is not really how we later process > the orientation and acceleration, but how Android computes the > orientation readings in the first place, because I think there's no > such a seperate sensor to detect the orientation, right? Also, from my > data analysis, it shows that there is always a time mismatch between > change of acceleration and change of orientation, and it seems that > the change of orientation that corresponds to the change of > acceleration is always triggered after the change of acceleration. > > The reason why I need to know this is that I want to do the reverse > engineering to compensate the gravity decomposed onto x,y,z axis by > using the orientation at the same time instance and geometric > formulas, so that I could cancel out G, because the accelerometer > readings show that G is automatically decomposed when the phone is > tilted. My target now is just to get rid of G.... > > On Oct 5, 10:04 am, Rud <rudmerr...@gmail.com> wrote: > > > See my blog for code to do the > > processing:http://mysticlakesoftware.blogspot.com/ > > > Rud > > > On Oct 4, 7:57 am, DD <daviddiaofri...@gmail.com> wrote: > > > > Hi, > > > > It seems that for onSensorChanged(), the orientation readings > > > (yaw,pitch,roll) are not detected directly, but computed from the > > > acceleration readings. Does anybody know how they do this calculation? > > > is it by rotationmatrix..? May I know exactly the calculation process? > > > > Thanks!- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---