Android 使用加速度计计算速度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10921395/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using accelerometer to calculate speeds
提问by Monergy
I've been doing a bit of research on a problem we are trying to solve. I think this is the best approach but please add in your opinions
我一直在对我们试图解决的问题进行一些研究。我认为这是最好的方法,但请添加您的意见
We are trying to calculate reaction times in a real world driving scenario and would like to use a mobile phone as the data collection device. What we are trying to accomplish is how much acceleration and more importantly deceleration a driver exerts when exposed to certain prompts.
我们正在尝试计算现实世界驾驶场景中的反应时间,并希望使用手机作为数据收集设备。我们试图实现的是驾驶员在遇到某些提示时施加的加速度和更重要的减速度。
I found this paper that has allot of useful information Accelerometer physics
我发现这篇论文有很多有用的信息加速度计物理学
The problem is that we most likely will not have a calibration time to start at zero.. however it is assumed that the driver is starting at 0. We will use GPS positioning to locate the vehicle, tracking the time stamped location data we should calculate the time when the prompt took place then using the time stamped accelerometer data we should be able to calculate their reaction to the prompt.
问题是我们很可能没有从零开始的校准时间......但是假设驾驶员从 0 开始。我们将使用 GPS 定位来定位车辆,跟踪我们应该计算的带时间戳的位置数据提示发生的时间,然后使用带有时间戳的加速度计数据,我们应该能够计算出他们对提示的反应。
This is the best way I have found to solve the problem however I'm not sure if the accelerometer data will be rendered useless because of not being able to calibrate it and also the noise seen from vibrations may be too great to use the data... Has anyone tried or used these types of methods before?
这是我找到的解决问题的最佳方法,但是我不确定加速度计数据是否会因为无法校准而变得无用,而且从振动中看到的噪音可能太大而无法使用数据。 .. 有没有人试过或使用过这些类型的方法?
采纳答案by Ali
Interesting application.
有趣的应用。
You are missing an important point. You either have to implement the so-called sensor fusionyourself or use the sensor fusion provided on the platform you are using. Both Android and iPhone have one.
你错过了一个重要的点。您要么必须自己实现所谓的传感器融合,要么使用您正在使用的平台上提供的传感器融合。Android 和 iPhone 都有一个。
The TYPE_LINEAR_ACCELERATION
(Android, SensorManager) or userAcceleration
(iPhone) should be sufficient for you.
的TYPE_LINEAR_ACCELERATION
(机器人,到SensorManager)或userAcceleration
(iPhone)应该是够你用的。
As for the linked PDF, don't try integrating the acceleration, you will get very poor results. Even though that answer is about position, the velocity will already be inaccurate. I would try the GPS instead.
至于链接的PDF,不要尝试集成加速,你会得到很差的结果。即使答案是关于位置的,速度也已经不准确了。我会尝试使用 GPS。
回答by Hesam
I know it's very old question but since I am recently working on a similar project let me share what we did in our company. We simply used OBD-II dongleto get velocity of car. There are many API's that return information about vehicle.
我知道这是一个很老的问题,但由于我最近在做一个类似的项目,让我分享一下我们在公司做过的事情。我们只是使用OBD-II 加密狗来获取汽车的速度。有许多 API 可以返回有关车辆的信息。
PID010D returns speed of vehicle. I'm using this PID to calculate distance between points A and B since there is no PID to return Odometer :(
PID010D 返回车辆的速度。我正在使用这个 PID 来计算 A 点和 B 点之间的距离,因为没有 PID 可以返回里程表:(
There are few libraries on github that you can find easily by search. This mine. This is not library but after run on your device you can see how it works.
github 上很少有库可以通过搜索轻松找到。这个矿。这不是库,但在您的设备上运行后,您可以看到它是如何工作的。