检测Android是否在车内
我正在尝试在 Android 上编写一个应用程序,该应用程序需要仅使用加速度计来检测 Android 当前是否在汽车中。基本上,该应用程序应该检测持有它的人是在走路还是在车里。对于步行,我刚刚检测到加速度计读数出现峰值,但我无法找到汽车的任何特征。我到底应该如何解决这个问题?
I am trying to write an application on Android which requires to detect whether the android is currently in a car or not, using only accelerometers. Basically the app is suppose to detect if the person holding it is walking or in a car. For walking I just detected spikes in the accelerometer readings but I am not able to find any characteristic of the car. How exactly should I approach this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,所提出的问题是无法解决的——如果你限制自己读取加速遥控器的读数,一部完全静止地放在停放的汽车中的手机(或者就此而言,匀速运行的一部手机)与放在桌子上的手机完全没有区别。
对于启发式方法,我只需去记录样本,然后在它们上磨练检测算法。我假设(城市)交通的特征是在几秒钟内几乎恒定的加速,总计达到约 10-20 m/s,并且在总速度大致相同的情况下出现更突然的减速。我不认为你能够很好地整合加速度计读数来准确跟踪类似汽车平稳加速到巡航速度,停留一个小时,然后在很长一段时间内滚动到静止状态的东西。
你想达到什么目的?
First of all, the problem as posed is unsolvable - a phone sitting perfectly still in a parked car (or, for that matter, one running at constant velocity) is completely indistinguishable from one sitting on a desk if you restrict yourself to acceleremoter readings.
For heuristics, I'd just go and record samples, then hone detection algorithms on them. I assume characteristics for (city) traffic would be bouts of near-constant acceleration over a few seconds totalling up to around 10-20 m/s and somehwat more abrupt decelerations of about the same total velocity. I don't think you'd be able to integrate accelerometer readings well enough to accurately track something like a car smoothly accelerating to cruise speed, staying there for an hour and then rolling to a standstill over a long stretch, though.
What are you trying to achieve?
显然,典型的最大差异是加速度和速度(也许还有持续速度)。我的建议是,构建一个分析应用程序,然后去享受各种类型的交通的乐趣。
Well obviously, the typical largest differences are acceleration and speed (and perhaps sustained speed). My suggestion, build a profiling application and go have some fun on various types of transportation.