Can compass be used to separate linear acceleration from gravity with accelerometer?

by Dan » Fri, 04 Feb 2011 05:22:11 GMT

Sponsored Links

I want to be able to detect vertical movement (relative to the z-axis)
on an Android phone. This can be done with just the accelerometer with
some degree of accuracy. However, I see that in Android 2.3 there are
now separate Gravity and Linear acceleration "virtual sensors", that
apparently will use the gyroscope (when available) to separate
accelerometer data into gravity (useful for detecting orientation) and
linear acceleration (useful for detecting movement).

The phone I'm using does not have a gyroscope, but only an
accelerometer and compass. Is it at all possible to use the compass to
separate linear acceleration from gravity in the accelerometer signal?

High-pass filters are a bit simplistic for my intended use, because
they don't really help detect whether movement is up or down and using
raw accelerometer data leads to orientation changes looking very
similar to linear movements.


Other Threads

1. Grand Central, Android, Google

Does the Android platform tie-in with any of Grand Central's

I have not seen any announcements from Google about the relationship
between Grand Central
and Android.  Was Grand Central discussed at the Google I/O


2. bug in sample demoAPI - App/Notification/Notifying Service Controller

There's a bug in sample demoAPI - App/Notification/Notifying Service

Once that service starts, if u stop the service before the 4 iterations are
for (int i = 0; i < 4; ++i) {

                    Thread.sleep(5 * 1000);
                    Thread.sleep(5 * 1000);
                    Thread.sleep(5 * 1000);

The NotificationManager clears the status icon briefly, but the thread keeps
running until it reaches the end of the 4 iterations.
So you still see the thread runs to complete (changing status bar icons
every 5 seconds), while the service is already stopped.
I think this behavior is not the intended/expected behavior.  And thus, a
bug :)

To fix it, make a local boolean variable, and assign the service status, and
have the run() method check the variable.
boolean running = true;

in run():

while (running) {
 // showNotification(...)

in onDestroy() {
  running = false;



3. ActivityGroup

4. Question About AndroidManifest.xml and resources

5. File transfer with Android

6. File upload or synching with Android

7. Open source software license