0

I'm playing with accelerometer sensor on Android Wear. When I'm reading the values in listener it gives me an array of for example [-19,594337 -19,594337 19,594337]. I mean, really? 19 m/s^2 in all dimensions? Bet Mike Tyson can't do better. Can anybody explain me, if I'm doing something wrong?

The code is just

public void onSensorChanged(SensorEvent event){ ... event.values ...}

for TYPE_LINEAR_ACCELERATION listener.

Ivan Tamashevich
  • 291
  • 1
  • 5
  • 14

1 Answers1

0

There's nothing wrong with outout. The output you got is called raw output of sensors. That means gravitational force is not excluded from the output of TYPE_LINEAR_ACCELERATION. You need to exclude it yourself.

TYPE_LINEAR_ACCELERATION : Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), excluding the force of gravity.

Apurva
  • 7,871
  • 7
  • 40
  • 59
  • Could be, if the phone moves making same angle in all 3 directions – Apurva Oct 20 '15 at 07:59
  • Nope, subtract gravity from the sensor output first. – Apurva Oct 20 '15 at 08:04
  • And even if i exclude 1G, it still too much. 10 m/s^2. I read, that a pro boxer can show 14m/s speed. – Ivan Tamashevich Oct 20 '15 at 08:06
  • From the output it can be plotted that you are standing with phone in your hand in front of your chest and you put it on your desk which is on your left side, in front of you and height is also smaller than your hand's position's height – Apurva Oct 20 '15 at 08:07
  • "excluding the force of gravity" - I hope it's excluded already? – Ivan Tamashevich Oct 20 '15 at 08:08
  • @IvanTamashevich But android documentation says that 'gravity is not excluded'. And the value you posted of boxer's punch gives velocity, and velocity and acceleration both are different things – Apurva Oct 20 '15 at 08:13
  • @Apurva shouldn't that be *including* force of gravity? – Zharf Oct 20 '15 at 08:15
  • @Apurva But i read [here](http://developer.android.com/reference/android/hardware/SensorEvent.html) for Sensor.TYPE_LINEAR_ACCELERATION "A three dimensional vector indicating acceleration along each device axis, **not including gravity**. All values have units of m/s^2. The coordinate system is the same as is used by the acceleration sensor. The output of the accelerometer, gravity and linear-acceleration sensors must obey the following relation: **acceleration = gravity + linear-acceleration**" – Ivan Tamashevich Oct 20 '15 at 08:22
  • @Apurva Acceleration is a derivative for velocity (excuse my english, maybe using wrong word). Means if i got a 19mps2 for 1 second I'll got a 19m/s for my device. It's way to much to my mind. I got theese values just punching air) Can show a GoogleSheet with table of event.values. – Ivan Tamashevich Oct 20 '15 at 08:28
  • @IvanTamashevich Yeah the value seems so large, because suppose you move your hand 1 meter in 1 second, then your hand's velocity is 1m/s and acceleration is 1m/s2. If we include the gravity to your output, acceleration becomes about 9.7 m/s2 which sounds a large number of acceleration and I think that close to Lamborghini or Ferrari's acceleration – Apurva Oct 20 '15 at 08:58