Are you low filtering the values? That can help. For example you can create
an array of 10 position, then each time the accelerometer/linear
acceleration gives you a value you do something like this:

accelVals = lowPass( currentEvent.values, accelVals );

where lowPass method is:

protected float[] lowPass( float[] input, float[] output ) {
    if ( output == null ) return input;

    for ( int i=0; i<input.length; i++ ) {
        output[i] = output[i] + ALPHA * (input[i] - output[i]);
    }
    return output;
}

and static final float ALPHA = 0.2f;

Can you please share how you handled 1)?

Right now I have a problem knowing if the device is with it's screen
looking up, to the user, or the opposite of those, and the
remapCoordinateSystem.
Please have a look at my question:

Hi all!
        What I'm trying to achieve is calculate if a runner is running,
stopping, etc. (and I can't use the GPS), where the runner can have the
device in different positions (portrait facing the user, portrait facing
the user, upside down, not facing the users, etc.

        I must know which axle is the one parallel to the floor in order to
check if there is any acceleration or deceleration and not check on other
axle and get an acceleretion/deceleration when the device is really just
"jumping" with the runner, meaning I checked the wrong axle.

        I'm trying to get the orientation of the device in every position
it might be. I'm not using the TYPE_ORIENTATION sensor as it is deprecated,
I'm using acceleration and magnetic sensor values or rotation_vector
sensor, in that way I can get the rotation matrix, Once I have it, if the
screen if facing the user I can get azimuth, pitch and roll remapping the
coordinate system, knowing the X and Y axles with this table:

 *ROTATION_0*

*X*

*Y*

*ROTATION_90*

-Y****

X****

*ROTATION_180*

-X****

-Y****

*ROTATION_270*

Y****

-X****

I get the rotation with getDefaultDisplay().getRotation()

Now, If the device if flat on the table, What will the getRotation
retrieve?  What if I rotate it while it's flat on the table? What should I
be sending to the the remapCoordinateSystem?

Is this ok?

 *ROTATION_0*

*X*

*Z*

*ROTATION_90*

Z****

-X****

*ROTATION_180*

-X****

-Z****

*ROTATION_270*

-Z****

X****

BTW, getRotationMatrix documentation says that I must send gravity values,
but everyone is sending accelerometer values (which are acceleration +
gravity),

If the device has TYPE_GRAVITY sensor, Should I send its values instead
TYPE_ACCELEROMETER sensor values?

Thanks in advance! Guillermo.

On Tue, Feb 14, 2012 at 4:05 AM, Dmitry Tupikin <[email protected]>wrote:

> I'm working on Android navigation app which uses complex of sensors to
> determine position changes. In some cases device cannot achieve GPS
> signal for a while (tunnel or multilevel parking) and I want to
> compensate these gaps using INS approach.
> Yes I know that there're another approaches like cell-id or data got
> from device's carrier, but currently I'm focused on sensors.
>
> Well, INS approach can be divided into two big tasks:
> 1. attitude determination (gyro or accelerometer + magnetometer or
> some combination)
> 2. velocity and distance calculation. Here I double integrate linear
> accelerometer values.
>
> Now I try to resolve the second task. I prepared all calculation and
> made contrastive analysis of data got from linear accelerometer on
> different Android devices: Sensation, Motorola Xoom and Nexus S. I put
> all devices on a platform and moved the platform on 8 meeters with an
> acceleration on Y axis.
> After that I built graphics and they really confused me - all 3
> graphics has the same amplitude but peak values are different.
> For example at the same moment I have 0.2 m/s^2 on Xoom and 1.2 m/s^2
> on Sensation.
> Hence after calculation I had a big difference in distance.
>
> Official documentation doesn't explain it. I surfed the web but didn't
> find any answer about that issue.
>
> So my question is: did someone faced to it? Or maybe you know an
> advice which will help me to solve it?
>
> In addition, android Sensor class has few parameters. I found that
> Sensation and Xoom has different RESOLUITON values -
> Sensor.getResolution().
> Sensation - 1.0
> Xoom - 0.009576807
>
> I'm stack with it, so any help will be really good! Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to