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 components by north/west/up axes and integrating them over time.
Would that work?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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?