android上的加速度计 [英] accelerometer on android

查看:211
本文介绍了android上的加速度计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..

如何使用Android加速度计功能测量手机从一只手移动到另一只手的距离?构建这种应用程序的最佳方法是什么

hello everybody..
How to use Android Accelerometer feature to measure the distance when phone is moved from one hand to another? What is the best way to build this kind of application

推荐答案

几乎不能:请参阅以下帖子'竞争对手'网站:如何使用加速计测量Android应用程序开发的距离 [ ^ ]。
You practically can't: please see the following thread at 'The Competitors' website: "How to use Accelerometer to measure distance for Android Application Development"[^].


我可以通过CPallini为正确答案添加一些解释。



加速度是坐标的二阶导数,也是运动唯一可测量的特征。根据伽利略相对论原理,不可能分辨出使用任何机械测量以不同速度移动和具有不同参考点的坐标系之间的差异。根据爱因斯坦的说法,没有任何物理现象可以用来说明,请参阅:

http:// en .wikipedia.org / wiki / Principle_of_relativity [ ^ ] ,

http://en.wikipedia.org/wiki/Galilean_invariance [ ^ ]。



理论上可以通过测量加速度来估算装置的位移(因此在初始坐标已知的情况下的坐标),但它需要加速度的永久双重积分(再次,加速度是坐标的二阶导数) 。很明显,所有错误都倾向于在集成期间累积。并且任何加速度计都是具有固有精度限制的设备:可以将其置于条件下(某些振动频率和加速度),这可能导致致命的精度损失。



有这里是一个非常重要的技术问题:测量和积分应该以规则的时间间隔不间断地进行,时间间隔不应超过某个最大采样率。换句话说,应该要求计算系统是实时系统或接近实时。我不认为Android与这样的系统有任何关系。另外,我不确定该设备的加速度计是真正的3D传感器。



请参阅:

http://en.wikipedia.org/wiki/Real-time_computing [ ^ ],

http://en.wikipedia.org/wiki/Real-time_operating_system [ ^ ]。



尽管如此,这个问题在火箭科学中已​​成功解决。但是,在开放空间中的运动比在地球上更加平滑和简单。我会说,在地球上这个问题几乎是无望的。



-SA
I can add some explanation to the correct answer by CPallini.

To acceleration is the second derivative of the coordinate and the only measurable characteristic of motion. According to Galilean relativity principle, it is impossible to tell the difference between coordinate systems moving with different speeds and having different reference point using any mechanical measurements. According to Einstein, no physical phenomena can be used to tell that, please see:
http://en.wikipedia.org/wiki/Principle_of_relativity[^],
http://en.wikipedia.org/wiki/Galilean_invariance[^].

It is theoretically possible to estimate the displacement (and thus coordinates in case initial coordinate are known) of a device by measurement of the acceleration, but it needs permanent double integration of the acceleration (again, acceleration is the second derivative of the coordinates). It is quite apparent that all the errors tend to accumulate during integration. And any accelerometer is a device with inherent accuracy limitations: one can put it under conditions (certain vibration frequencies and accelerations) which could cause fatal loss of accuracy.

There is a very important technical problem here: the measurement and integration should be performed non-stop with regular time intervals which should never exceed some maximum sample rate. In other words, the computing system should be required to be a real-time system or near real-time. I don't think Android is anything close to such system. Also, I'm not sure the device's accelerometer is a true 3D sensor.

Please see:
http://en.wikipedia.org/wiki/Real-time_computing[^],
http://en.wikipedia.org/wiki/Real-time_operating_system[^].

Nevertheless, such problem is successfully solved in rocket science. But motion in open space is much, much smoother and simpler than on the Earth. I would say, on Earth this problem is nearly hopeless.

—SA


我'在地球和火箭之前完成了这个。



地球开启,我看到最好的是德雷珀实验室的剑桥机器人。几十分钟后,他们有几厘米没有GPS的错误。

比电话更好的陀螺仪,加速度计和计时。



在户外天气好的情况下,使用GPS和滤波器比使用加速度计更容易获得分表。



固有的问题是:传感器有噪音,非线性和偏见,你不能足够快地采样或有足够的时间精度。

这并不意味着它无法解决,但它很难:)



看着1名传感器说左/右加速,我们称之为X。

注意x的实际值与测量:



Xmeasured =偏差+ guassianNoise + a0 * x + a1 * x ^ 2 + a2 * x ^ 3 + a3 * x ^ 3 ...



其中a0几乎为1,而a1-a几乎(不完全)为零,但对于大多数应用程序,你可以将它们视为零。

偏差(温度上的微小漂移)有些固定,你可以找到一个特定的传感器数据表,但它很小但不是零。



您可以使用低通/高通滤波器来抑制噪声和偏差(分别) ,或卡尔曼滤波器估计在几分钟内将其与GPS进行比较的偏差,但两者都不能很好地工作(我已经尝试过)。



当你整合时,你结束了整合所有这些错误。非常小的东西会造成误差。



当您旋转手机时,您还可以旋转坐标系,以便在房间中查找更新的GPS位置或位置通过陀螺仪误差和陀螺仪/磁力计如何更新。



这么多错误,这么多​​年来修复它:)



这是一个很难解决的问题,所以请不要完全气馁,但这不是你周末可以做的事情。



火箭科学更容易,但这是一个很难解决的问题,我花了一些时间。很有趣。



祝你好运:)
I've done this before on earth and in rocketry.

Earth bound, best I saw was a robot at Draper labs, cambridge. They had errors of a few cm without GPS after tens of minutes.
Much better gyros, accelerometers, and timing than on a phone.

Outdoors in good weather, it's easier to use GPS and filter to get submeter than using the accelerometers.

The inherent problems are: the sensor has noise, non-linearity and bias, AND you can't sample it fast enough or with good enough time precision.
That doesn't mean it can't be solved but it's hard :)

Looking at 1 senor say the acceleration going left/right, we'll call that "X".
Note how "x" real value is very different from the measured:

Xmeasured = bias + guassianNoise + a0*x + a1*x^2 + a2*x^3 + a3*x^3 ...

Where a0 is almost 1, and a1 - an are nearly (not quite) zero, but for most applications you could treat them as zero.
The bias (minor drift over temperature) is somewhat fixed and you can find it for a particular sensors datasheet, but its small but not zero.

You can use low pass / high pass filters to reject noise and the bias (respectively), or Kalman filter estimate the bias comparing it to GPS over a few minutes, but neither work very well (I've tried).

When you integrate, you end up integrating all those errors. Very small things cause meters of error.

Also when you rotate the phone, you rotate your coordinate system so finding the updated GPS position or location in a room is also compounded by the gyroscope errors AND how the gyroscope / magnetometer updates.

So many errors, so many years to fix it :)

This is a fantastic problem to try to solve, so please don't be completely discouraged, but it's not something you can do in a weekend.

Rocket science is easier, but this is a great problem to solve, one I've spent some time on. Lots of fun.

Good luck :)


这篇关于android上的加速度计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆