Possible to calculate yaw,pitch,roll from x,y,z magnetic field values alone?

by RS » Mon, 12 Oct 2009 19:23:54 GMT

Sponsored Links
 DD, there are a few special cases that won't work:

If mag a sensor's first axis (say x) is already pointing mag north
exactly, the mag components on the other two axis (say y,z) would be

here your x axis is not just towards north but is exactly tangential
to one of the field lines connecting south-north.

The Earth and hence the mag field *curves* being too large in
comparison to the tiny sensor, this x axis is essentially parallel to
the local field *line* and not just tangential at a point.

While you continue to point the x axis to mag north if you try to
cause a roll alone (around the x axis here), the readings won't change
in any way. Also, the y,z components would continue to remain zero.

Combine it with another sensor and you are in luck. Android does these
internally already. Further there are APIs available to remap
coordinates, get rotation matrices etc.

You'll have to read the sensor related stuff on d.android.com for



Possible to calculate yaw,pitch,roll from x,y,z magnetic field values alone?

by DD » Sun, 18 Oct 2009 20:47:20 GMT

 Thanks R.S.  I think you are talking about the special case. But for
the time being, I feel this doesn't need to be considered that much.
so may I know exactly the physics formulas (or other methods) that can
be used to calculate yaw,pitch and roll solely based on the data given
by the magnetometer.

Yeah, you mentioned to combine the mag readings with other sensors and
to use the APIs in Android. Actually, this is just the reason why I
brought this question up. I have seen the APIs that actually calculate
yaw,pitch and roll by the mag AND the accelerometer. From my
experiments, I found that yaw,pitch and roll were strongly affected by
the acceleration, for example, if you move the phone horizontally with
a very big acceleration, the screen orientation is probably changed,
meaning the yaw,pitch and roll changes much as the accelerations

This is why I want to see if I can use the mag alone to get the
orientation(yaw, pitch, roll) so that the orientation readings are
independent on the accelerations.

Thank you very much.


Sponsored Links

Possible to calculate yaw,pitch,roll from x,y,z magnetic field values alone?

by Scott » Tue, 20 Oct 2009 01:42:24 GMT

 I'm afraid it's not mathematically possible to generate a full
attitude solution from a single vector observation (mag vector,
gravity vector, etc..). There simply isn't enough information there.
It doesn't matter if you're not pointed along the mag field, you will
still only get a partial attitude solution in the shape of a cone
centered around the mag field. This has been an issue in the aerospace
industry for a while now, and usually the problem is solved by
combining information from two or more sensors. In this case, the
Android API is probably using the mag field and what it assumes is a
gravity vector from the accelerometer (that's why the solution is
affected by external accelerations).

If you're interested in how to generate an attitude solution from two
vector observations, you should look up the TRIAD algorithm for
attitude determination.



Possible to calculate yaw,pitch,roll from x,y,z magnetic field values alone?

by DD » Sat, 24 Oct 2009 16:44:20 GMT

 Thanks Scott. Yes, you are right. the Android API is calculating the
orientation by using the mag and gravity(acceleration), and this is
why the orientation is affected (strongly affected) by the
acceleration. So just wondering if you have any idea to get the pure
acceleration data without gravity involved?meaning at any time the
phone only shows the net moving acceleration of the phone without G
added on. Thank you!


Other Threads

1. Singapura -- Mau Telepon Pakai Cokelat?

itu layar nya yang mana om?


2. Sudah ada yg coba flash plugin di eclair 2.1?

Iseng2 buka forumnya kang leshak, disana ada pemirsa yg sudah bisa membuka
web berbasis flash dg eclair 2.1.

Gw coba ikuti tutorialnya ternyata berhasil, bisa nonton video di youtube
dan bbrp web yg terkandung content flash, kayaknya cuma bs buka flash versi
9 kebawah

Berikut tutorialnya (utk HH rooted only):
1. Download file flashplayer_lib_app.zip (ada di forumnya kang leshak ato
minta bantuan om gugel)
2. Extract dan copy folder app dan lib ke /sdcard
3. Buka adb dan ketik command berikut :

remount rw
cat /sdcard/lib/libflashlite_jni.so > /system/lib/libflashlite_jni.so
cat /sdcard/lib/libflashlitepackage.so > /system/lib/libflashlitepackage.so
cat /sdcard/lib/libflashliteplugin.so > /system/lib/libflashliteplugin.so
cat /sdcard/app/FlashPlugin.apk > /system/app/FlashPlugin.apk
cat /sdcard/app/FlashSVGPlayer.apk > /system/app/FlashSVGPlayer.apk
cd /system/lib/
chmod 644 libflashlite_jni.so
chmod 644 libflashlitepackage.so
chmod 644 libflashliteplugin.so
remount ro

Setelah itu anda udah bs menyaksikan video berbasis flash di web yg
compatible dg flash v.9. Loadingnya agak lambat mmg, tapi lumayanlah drpd
harus nungguin froyo.

Spica 2.1 fw JD1 dg samdroid 1.0.3
Flash enabled

"Indonesian Android Community [id-android]" 

3. Start an App via the Web

4. Fix for OutofMemoryError: bitmap size exceeds VM budget

5. bluetooth transfer file

6. how to make the tab view which like ASTRO Filemanager

7. Disabling back button when the alert dialog box is on the screen