Vote count:
0
I am developing an application, in which i have used Accelerometer for sensing linear accelerations but after some time i get to know that Accelerometer does not show linear accelerations(also have gravity effect on it).
So for removing gravity i have tried some method and reach at conclusion that i must have to design a filter.
And for designing filter i have tried the following code
public void onSensorChanged(SensorEvent event)
{
// alpha is calculated as t / (t + dT)
// with t, the low-pass filter's time-constant
// and dT, the event delivery rate
final float alpha = 0.8;
gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];
linear_acceleration[0] = event.values[0] - gravity[0];
linear_acceleration[1] = event.values[1] - gravity[1];
linear_acceleration[2] = event.values[2] - gravity[2];
}
which is taken from Android Developers.
Now i have some problem in code shown above-
- What are alpha, t and dt ?
- How to get the value of t and dt and how to calculate them?
- Also let me know that the code i am using for getting linear accelerations will work or not?
asked 15 secs ago
Aucun commentaire:
Enregistrer un commentaire