如何检测手机相对于移动方向的方向
问题:考虑安装在车辆上的 Android 设备。我们想使用加速度计来测量各种东西。这些测量值应该相对于车辆的坐标系。因此,我们需要弄清楚设备相对于车辆的方向如何。简单的解决方案是对启动后的“早期”加速度进行平均,但我担心驾驶员要做的第一件事是离开停车场或左转进入道路,从而描述曲线。让用户上路后开始测量是可行的,但如果此时没有加速度怎么办?
问题:有人可以提出一种策略或算法来合理地判断手机相对于车辆的方向吗?指向一些解决类似问题的 FOSS 源的指针会更好。
注意:
- 我不想为此使用 GPS,因为这会让用户的事情变得复杂。
- 我们可以与用户交互,例如请求用户在开始之前开始测量。
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 the 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单独的加速度计无法为您的目的提供足够的信息,我敢说:作用在设备上的矢量,除了车辆加速度之外,还将是车辆本身的振动、道路倾斜、制动和转弯时的向心力。
由于所有这些因素,来自传感器的数据量在手机上聚合是不切实际的,因此移动平均值或其他累积方法甚至无法给出模糊的精确结果。
此外,即使您使用最高的可用传感器速率,在传感器采样时间之间也会丢失大量加速度数据。
建议:使用 GPS 或网络定位信息,生成移动平均值以考虑较小的偏差,并使用结果。
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.