How to remove Gravity factor from Accelerometer readings in Android 3-axis accelerometer

后端 未结 7 1560
天命终不由人
天命终不由人 2020-12-29 08:16

Can anyone help on removing the g factor from accelerometer readings?

I am using SensorEventListener with onSensorChanged() method for getting Sensor.TY

相关标签:
7条回答
  • 2020-12-29 08:53

    Just subtract out g (~9.8m/s^2) times the z direction of the rotation matrix. Or to be more explicit about it, let

    a = your accelerometer reading,
    R = your rotation matrix (as a 9-long vector).
    

    Then what you want is

    (a[0]-g*R[6], a[1]-g*R[7], a[2]-g*R[8]).
    
    0 讨论(0)
提交回复
热议问题