Accelerometer Values ​​from Android / iPhone device

I am trying to map my movements to an android device in an OpenGL scene.

I wrote down the accelerometer values ​​for simple movement: Moving the phone (lying on the table) 10 cm forward (+ x) and then 10 cm backward (-x).

The problem is that these values ​​when calculating speed and position only make the opengl cube forward. It appears that the recorded negative acceleration was not sufficient to reduce the speed and invert its motion.

What could be the problem?

This is my function that updates the speed and position every time new data comes in:

void updatePosition(double T2) {
    double T = 0.005;
    Vec3 old_pos = position.clone(), old_vel = velocity.clone();

    velocity = old_vel.plus(acceleration.times(T));
    position = old_pos.plus(old_vel.times(T).plus(acceleration.times(0.5 * Math.pow(T, 2))));

}

      

These are the X, Y, Z accelerometer values ​​for the entire capture time:

alt text http://img25.imageshack.us/img25/7528/forces.jpg

+2


a source to share


1 answer


Does your function take a parameter T2, which I assume is the input to the accelerator? but you are using the T you declared as double T = 0.005; so your function will always run at static speed.



+1


a source







All Articles