Maths behind the Android orientation calculation algorithm

by DD » Sun, 28 Mar 2010 13:30:33 GMT


Sponsored Links
 Hi,

I know Android calculates the orientation of the phone by fusing the
acceleration and magnetic field readings. The related APIs are
getRotationMatrix() and getOrientation(). I looked into the source
code of these two APIs
 http://www.netmite.com/android/mydroid/cupcake/frameworks/base/core/java/android/hardware/SensorManager.java 

But I couldn't really figure out where exactly the implementation came
from... Could anybody tell me where I can find the theory of this
algorithm and detailed mathematical background of it? I'm currently
implementing exactly the same algorithm offline in MATLAB, and trying
to write some mathematical analysis about it.

Thank you very much!

--



Other Threads

1. Android 1.5 (Cupcake) permissions on Location/GPS settings

FYI (not advocating any particular solution) you can just grab the
rc33 'full' update off any number of mirrors (not the patch version)
and apply it as an update.zip. You will probably have to downgrade the
radio also, but that should be available in the same place (or
possibly bundled in the same update.)






--~--~---------~--~----~------------~-------~--~----~

2. VerifyError on Custom View

I have setup remote crash reports for unhandled java exceptions.  I am
getting lots of users who are crashing right on startup, and I'm
seeing VerifyErrors that look like they are thrown right on startup.

I have tested this app extensively on 1.1 and 1.5 on many different
devices, but some phone just have this problem everytime,
unfortunately I haven't been able to get my hands on one that it
crashes on to see what else is happening in LogCat.

Anyways, the exception looks like this:

java.lang.VerifyError: com.tunewiki.lyricplayer.android.views.TopBar
       at java.lang.Class.getDeclaredConstructors(Native Method)
       at java.lang.Class.getConstructor(Class.java:401)
       at android.view.LayoutInflater.createView(LayoutInflater.java:
470)
       at android.view.LayoutInflater.createViewFromTag
(LayoutInflater.java:560)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:
613)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:403)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:316)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:272)
       at com.android.internal.policy.impl.PhoneWindow.setContentView
(PhoneWindow.java:227)
       at android.app.Activity.setContentView(Activity.java:1569)
       at
com.tunewiki.lyricplayer.android.library.MainLibraryActivity.onCreate
(MainLibraryActivity.java:21)
       at android.app.Instrumentation.callActivityOnCreate
(Instrumentation.java:1122)
       at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2103)
       at android.app.ActivityThread.startActivityNow
(ActivityThread.java:1988)
       at android.app.LocalActivityManager.moveToState
(LocalActivityManager.java:122)
       at android.app.LocalActivityManager.startActivity
(LocalActivityManager.java:335)
       at
com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setCurrentTab
(TabHostActivity.java:359)
       at com.tunewiki.lyricplayer.android.MainActivity.setCurrentTab
(MainActivity.java:687)
       at
com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setCurrentTab
(TabHostActivity.java:259)
       at
com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setDefaultTab
(TabHostActivity.java:67)
       at com.tunewiki.lyricplayer.android.MainActivity.onCreate
(MainActivity.java:268)
       at android.app.Instrumentation.callActivityOnCreate
(Instrumentation.java:1122)
       at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2103)
       at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2156)
       at android.app.ActivityThread.access$1800(ActivityThread.java:
112)
       at android.app.ActivityThread$H.handleMessage
(ActivityThread.java:1580)
       at android.os.Handler.dispatchMessage(Handler.java:88)
       at android.os.Looper.loop(Looper.java:123)
       at android.app.ActivityThread.main(ActivityThread.java:3742)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
       at dalvik.system.NativeStart.main(Native Method)

TopBar extends RelativeLayout.

Thanks,
Zach

--~--~---------~--~----~------------~-------~--~----~

3. Binder internals for IPC

4. PreferenceActivity, can a checkbox and a checkbox preference share?

5. How to know whether a table already exist in database?

6. Strange Layout Bug

7. Finish all previous Activities?