[android-developers] Ignoring magnetic field sensor, calibrating the accelerometer

2011-04-23 Thread Socrates
I'm trying to use the accelerometer sensor for a game.

1) I am currently ignoring the magnetometer and using a static value
for the magnetic field vector. My reasoning is that the magnetometer
is subject to interference and will likely give more varied values
than the accelerometer, so I'd like to not use it if possible. I'm
also not sure that it is necessary for most motion-based game
control.  Does this make sense?

2) I'm attempting to get a baseline accelerometer value, but it
appears as if the sensor returns a junk/default value for a given axis
unless a change is detected along that axis. So it seems as if I can't
get an accurate baseline value while the phone is lying perfectly
still -- am I understanding this right? Is there any way to work
around this problem?

Thanks.

-- 
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


[android-developers] Re: Ignoring magnetic field sensor, calibrating the accelerometer

2011-04-23 Thread Socrates
Here's what I mean by a baseline value: I'm using
SensorManager.getOrientation() to determine the device's orientation.
I am only concerned with the difference in orientation relative to a
static orientation (which I'm referring to as the baseline value) at
any given time. The baseline value could be hard-coded, but I'd like
to have more flexibility and set this value based on the orientation
of the device when the application is started.

The problem I'm facing isn't noise per se; the initial values I get
from the sensor are consistently inaccurate, so I'm not sure how to
obtain a baseline orientation.

On Apr 23, 11:25 am, Igor Prilepov iprile...@gmail.com wrote:
 1. Yes, there are a lot of issues related to the magnetic sensor but people
 still use it for thousands years so the real question is do you need it or
 not.
 2. I don't know what does it mean baseline values. Accelerometer always
 returns noise values (as well as any other sensor) - this is a nature of any
 real data source.
 There is no work around this problem but there are many methods to filter
 noise out. All of them requires certain level of knowledge in math,
 statistics, etc. and they are very complicated. Take a look at Kalman filter
 on Wikipedia to get some feeling about this area.

-- 
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