I'm trying to map my movements with a android device into an OpenGL scene.
I've recorded accelerometer values for a simples movement: Moving the phone (lies flat on a table) 10cm forward (+x), and then 10cm backward (-x).
The problem is that this values when used to calculate velocity and position, makes only the opengl cube go forward. Seems like the negative acceleration recorded was not enough to reduce the speed and invert its movement.
What can be the problem?
This is my function that updates the velocity 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))));
}
This is the X,Y,Z accelerometer values over the entire captured time: