Is it possible to calculate velocity by integrating accelerometer data over time?

前端 未结 3 1290
逝去的感伤
逝去的感伤 2021-01-05 22:03

I\'m wondering if I can use (linear) accelerometer and compass to calculate velocity without using location services. I want to do that by calculating acceleration component

相关标签:
3条回答
  • 2021-01-05 22:29

    Probably not, because if your moving with slow constant speed, I don't think that accelerometer detects anything.

    0 讨论(0)
  • 2021-01-05 22:42

    In theory, you could do this; in practice, no.

    You would have to assume you know an initial velocity, but assuming you start at 0 velocity isn't such a bad assumption.

    You would also have to know the actual orientation of the device throughout the whole period. Otherwise you can't differentiate change in acceleration due to actual acceleration versus just rotation the device.

    (Remember you have to take out the acceleration due to gravity from the readings!)

    Finally, the errors would add up over some time, not only because the measure of acceleration is imperfect, but because you only get discrete samples over time.

    Other than all those things, sure, it works! The API does tell you what units the readings are in (m/s^2). You can ask the sensor for very rapid updates. I think it would be interesting to see how (in)accurate it is by writing an app that does this and then putting the phone flat and then walking forward and stopping with it. How close to 0 is the reading then?

    0 讨论(0)
  • 2021-01-05 22:51

    In general, the accelerometer found on android devices is far too noisy to be able to integrate the signal and get the velocity. Further, you also need an almost perfect estimate of the device orientation and even using a gyroscope (which few devices have) is usually too noisy.

    The main problem is subtracting the gravity from the accelerometer signal, since the force of gravity is usually a very large component of the signal. With a phone orientation estimate that is slightly off, the gravity is subtracted in the wrong direction. This leaves components of acceleration in the wrong direction, and your velocity estimate quickly becomes useless.

    What's needed is basically a way to reset the velocity estimate regularly (once per second or so) when you know the device is not moving. One way to do this, provided the user of the device is walking, is to mount the device on a foot and try to detect when the foot is on the ground (velocity is zero in all directions). However, mounting the device on the foot of the user is usually a constraint too severe for practical use.

    There are other approaches one can take to track movement. For example, using step detection and a gyroscope I've been able to track a walking person for a minute or two, with an accuracy of a few meters.

    0 讨论(0)
提交回复
热议问题