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. MediaPlayer, AssetFileDescriptor and FileDescriptor doubt

Hi,

I was wondering why I needed to do this to play a single file in MediaPlayer:

[code]

FileDescriptor          audioFd = null;
AssetFileDescriptor assetFd = null;
String fileName = "audio/"+lang+"/"+String.valueOf(code)+".mp3";

System.out.println("AUDIO FILE NAME: "+fileName);

assetFd = ctx.getAssets().openFd(fileName);

System.out.println("assetFd.length(): "+assetFd.getLength());

audioFd = assetFd.getFileDescriptor();

mp = new MediaPlayer();

mp.setDataSource(audioFd, 0, assetFd.getLength());
mp.prepare();
mp.start();
mp.setLooping(true);

[/code]


If I do:

[code]
audioFd = ctx.getAssets().openFd(fileName).getFileDescriptor();
mp = new MediaPlayer();
mp.setDataSource(audioFd);
[/code]

The media player is filled with the files within the directory I open
the AssetFileDescriptor. I mean, It plays the first file, the second,
and so on. Althought, assetFd.getLength() returns the correct length
of the file, when I get the file descriptor with getFileDescriptor(),
the MediaPlayer plays ALL the files, so reading the API I found the
setDataSource() method with helps me to play correctly only one file:

 public void  setDataSource  (FileDescriptor  fd, long offset, long length)

Could someone explain me to this please?

Thanks in advance,
-- 
If you want freedom, compile the source.

Sebastin Treu
http://labombiya.com.ar

-- 

2. Titkle bar display

Hi,

Is it possible to disable title bar display dynamically after setting
the content view by setting the NoTitlebar theme?

All the posts I have read told that any title bar changes we can make
only before setContentView() call..

Thanks in advance,
Revathi

-- 

3. Handle Button Click

4. [WTA] .. skyp

5. Uploading large files - using setChunkedStreamingMode

6. Find the Current Address

7. Problem runnig Android on imx51 target