Can anyone help on removing the g factor from accelerometer readings?
I am using SensorEventListener with onSensorChanged()
method for getting Sensor.TY
You can use a low-pass filter.
Do this for each of your sensor values:
g = 0.9 * g + 0.1 * v
Where v
is your current sensor value and g
is a global variable initially set to zero. Mind that you'll need as many g variables as you have axes.
With v = v - g
you can eliminate the gravity factor from your sensor value.