开发者

How to detect phone orientation relative to direction of movement

Problem: Consider an Android device mounted in a vehicle. We want to measure various things using the accelerometer. These measurements should be relative to the vehicle's coordinate system. Thus we need to figure out how the device is oriented in relation to the vehicle. The simple solution would be to just average the "early" acceleration after startup, but I'm worried that the first thing the driver will do is leave a parking lot or a turning left onto the road, thus describing a curve. It would be feasible to ask the user to start measuring after getting on th开发者_运维百科e road, but what if there is no acceleration at that point?

Question: Can someone suggest a strategy or an algorithm that would do a reasonable job of telling how the phone is oriented in relation to the vehicle? A pointer to some FOSS source that solves a similar problem would be even better.

Notes:

  • I do not want to use GPS for this as it would complicate things for the user.
  • We can interact with the user, for example by requesting that the user starts measurements before starting out.


The accelerometer alone would not provide sufficient information for your purpose, I would hazard: The vectors acting upon the device, besides vehicle acceleration, will be the vibration of the vehicle itself, road inclines, braking and centripetal force from turns.

The amount of data from sensors due to all those forces would be impractical to aggregate on a phone, hence moving averages or other cumulation approaches would not give even vaguely precise results.

Also, a lot of the acceleration data would be lost between sensor sampling times, even if you were to use the highest available sensor rate.

Recommendation: Use GPS or network positioning information, generate moving averages to account for minor aberrations, and use the result.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜