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:
+2
a source to share