如何计算从X,Y,从iphonež加速度计读数行进的方向加速/减速加速度计、读数、方向、iphone

2023-09-11 06:14:25 作者:心一跳,爱就开始煎熬

我正在写一个iPhone / iPad应用程序。我需要计算在车辆中接近水平直线与不稳定的加速和减速行驶的行进方向上的加速和减速。我有从X,Y,Z正交的加速度计3次读数的序列。但是,iPhone / iPad的取向是任意的,并且加速度计读数包括车辆运动和重力的影响。结果应该是单一的加速度值,它们正或负根据车辆是否在减速或加速的序列。正和负方向是任意的,只要加速度具有相反的符号的减速。重力应被分解出来的结果。结果的变光滑一定量将是有益的。

I am writing an iPhone/iPad app. I need to compute the acceleration and deceleration in the direction of travel of a vehicle traveling in close to a straight horizontal line with erratic acceleration and deceleration. I have the sequence of 3 readings from the X,Y,Z orthogonal accelerometers. But the orientation of the iphone/ipad is arbitrary and the accelerometer readings include vehicle motion and the effect of gravity. The result should be a sequence of single acceleration values which are positive or negative depending on whether the vehicle is decelerating or accelerating. The positive and negative direction is arbitrary so long as acceleration has the opposite sign to deceleration. Gravity should be factored out of the result. Some amount of variable smoothing of the result would be useful.

的解决方案应该尽可能地简单,并且必须在计算上有效率。答案应该是某种伪code算法,C code或方程组序列可以很容易地转换为C code。在目标C iPhone的具体的解决方案将被罚款了。

The solution should be as simple as possible and must be computationally efficient. The answer should be some kind of pseudo-code algorithm, C code or a sequence of equations which could easily be converted to C code. An iPhone specific solution in Objective C would be fine too.

感谢

推荐答案

这实在是很难分开的重力和运动。它更容易,如果你可以分析数据以及陀螺仪和指南针的信号。

It is really tough to separate gravity and motion. It's easier if you can analyze the data together with a gyroscope and compass signal.

陀螺仪测量角旋转的速率。其积分是理论上的角度取向(加上一个未知的常数),但积分受到漂移,因此是在它自己的无用。加速度计测量角度方向加上重力加线性加速度。对于一些比较复杂的数学运算,可以隔离所有3的数量从2个传感器的价值观。添加指南针修复XY平面(其中Z是重力)为绝对坐标系。

The gyroscope measures the rate of angular rotation. Its integral is theoretically the angular orientation (plus an unknown constant), but the integral is subject to drift, so is useless on its own. The accelerometer measures angular orientation plus gravity plus linear acceleration. With some moderately complex math, you can isolate all 3 of those quantities from the 2 sensors' values. Adding the compass fixes the XY plane (where Z is gravity) to an absolute coordinate frame.

请参阅这的伟大presentation。

See this great presentation.