Reputation: 2606
I'm testing the TYPE_LINEAR_ACCELERATION sensor on Android - I'm setting it up in the standard way I think:
acceleration = sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
...
sensorManager.registerListener(this, acceleration, kMotionUpdatePeriod);
...
public void onSensorChanged(SensorEvent event)
{
switch(event.sensor.getType())
{
case Sensor.TYPE_LINEAR_ACCELERATION:
Logger.info(this,"Linear Accel %.2f %.2f %.2f",event.values[0], event.values[1], event.values[2] );
break;
}
}
My understanding is that LINEAR_ACCELERATION is meant to be using sensor fusion to remove gravity from the accelerometer readings and produce the net acceleration the device is experiencing.
I've tested this on an Android Wear watch (Sony SWR50) running 5.1.1 and when the device is resting on the table I get these kinds of values:
03-04 09:58:58.309 Linear Accel -0.20 0.74 0.14
03-04 09:58:58.328 Linear Accel -0.20 0.70 0.14
03-04 09:58:58.341 Linear Accel -0.23 0.71 0.13
Also tested on a Galaxy S3 running 4.3 and I get:
03-04 09:48:22.307 Linear Accel -0.13 -0.11 -0.39
03-04 09:48:22.412 Linear Accel -0.11 -0.09 -0.34
03-04 09:48:22.507 Linear Accel -0.09 -0.11 -0.42
I'd expect a bit of an error on these - but these values seem way to high when the device is just sitting on the desk. The total acceleration works out to be around 0.7 m/s2 for the watch and 0.4 m/s2 for the Galaxy.
I'm also developing this on iOS and the userAcceleration figures I get from iOS devices when they are stationary are 0.01 m/s2 at the most which is what I think you'd expect.
Is there something I am missing when trying to use LINEAR_ACCELERATION?
Is anyone else getting figures more like I am getting from iOS on their Android devices?
Upvotes: 0
Views: 294
Reputation: 2606
OK so stupid mistake.
iOS is using units of G for its acceleration values, Android is using m/s2, hence a factor of 9.81 difference.
Upvotes: 1