加速度计相对位置

发布于 2024-09-29 10:48:48 字数 588 浏览 11 评论 0原文

在我重新发明轮子之前,我想看看是否有人可以分享以下内容的代码或提示:

为了获得 iPhone 的相对位置,需要

  • 设置加速度计读取速率
  • 噪声滤波器加速度计响应
  • 将其转换为矢量
  • 低通过滤矢量以查找重力
  • 从原始读数中减去重力以查找用户引起的加速度
  • 过滤用户引起的加速度以获得您感兴趣的频率(可能是带通,具体取决于应用程序)
  • 积分以查找相对速度
  • 积分以查找位置

那又怎样我希望人们已经编写了上述部分或全部内容,并且可以提供提示,或者更好的代码。

有几个问题我还没有找到答案:

iPhone 加速度计的频率响应是多少?加速度计和模数转换器之间存在哪些硬件滤波器?

在不重复读取值的情况下可以调用加速度计委托的最快读取速率是多少?

不同手机的上述差异?

设计滤波器有什么好的技巧,例如分离重力和用户运动的截止频率吗?

有关集成步骤的任何代码或提示吗?有什么理由集成到笛卡尔坐标系而不是矢量中,反之亦然?

在实施此操作之前,还有其他应该了解的经验、技巧或信息吗?

Before I reinvent the wheel I wanted to see if anyone can share code or tips for the following:

In order to get relative position of the iPhone, one needs to

  • Set the accelerometer read rate
  • Noise filter the accelerometer response
  • Convert it to a vector
  • Low pass filter the vector to find gravity
  • Subtract gravity from the raw reading to find the user caused acceleration
  • Filter the user caused acceleration to get the frequencies you are interested in ( probably bandpass depending on the application)
  • Integrate to find relative speed
  • Integrate to find position

So what I'm hoping is that people have already written some or all of the above and can provide tips, or better yet code.

A few questions I haven't found the answer to:

What is the frequency response of the iPhone accelerometer? What hardware filters exist between the accelerometer and the analog to digital converter?

What is the fastest reading rate the accelerometer delegate can be called without duplicating reading values?

Differences in the above for the various phones?

Any good tips for designing the filters, such as cutoff frequency for separating gravity and user motion?

Any code or tips for the integration steps? Any reason to integrate in the cartesion coordinate system rather than as vector, or vise versa?

Any other experiences, tips, or information that one should know prior to implementing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抚你发端 2024-10-06 10:48:48

当我找到信息时,我会将其收集在这个答案中。

硬件

3GS 使用 ST LIS331DL 3 轴 ± 2g/±8g 数字加速度计。

iPhone 4 和 iPad 使用 ST LIS331DLH 3-轴±2g/±4g/±8g数字加速度计。

它们都能够以 100Hz 和 400Hz 的频率读取,但在 iPhone 3G(iOS 4.1 下)上,即使 setUpdateInterval 设置为更快的更新,加速度计代理的调用频率也不会超过 100Hz。我不知道该 API 是否允许在 iPhone 4 上进行更快的更新,Apple 的文档仅指出最大值由 iPhone 的硬件决定。 (待定)

A/D 转换器与 MEM 传感器位于同一硅片上,这有利于抗噪性。

DL 版本为 8 位 (3GS),而 DLH 版本为 12 位 (iPhone 4)。 DL 版本中的最大偏差(偏移)是 DLH 版本偏差的两倍(0.04g 与 0.02g)。

DLH 的数据表报告了加速噪声密度,但 DL 数据表中未报告该值。 DLH 的噪声密度相当低,为 218 μg/√Hz。

两种传感器都提供 100Hz 采样或 400Hz 采样速度,没有自定义速率。如果 iPhone 未以设置的采样率读取输出寄存器,则传感器会丢弃值。

DL传感器的“典型”满量程值为±2.3g,但ST仅保证其至少为±2g。

温度对传感器的影响是存在且可测量的,但不是非常显着。

TBD:

  • 硬件滤波器是否开启,滤波特性如何?
  • 加速度计电源的噪音有多大? (有人碰巧手边有 iPhone 原理图吗?)
  • 加速计使用内部时钟为采样率和 A/D 转换提供计时。数据表未表明该时钟的准确度、精确度或温度敏感性。为了进行准确的时间分析,iPhone 必须使用中断来感知样本何时完成并在中断中记录时间。 (是否这样做尚不清楚,但这是获得准确计时信息的唯一方法)

API

请求低于 100Hz 的采样率会导致获取选定的样本,同时丢弃其余样本。如果软件中要求的采样率不是 100Hz,则实际传感器读数之间的时间间隔不可能均匀。即使使用系数 100,Apple 也不保证采样率。

该 API 似乎不提供软件过滤。

API 确实将原始加速度计值缩放为代表 Gs 的双精度值。使用的缩放因子是未知的,并且每个电话的缩放因子是否不同(即校准)以及校准是否持续进行以解决传感器漂移也是未知的。在线报道似乎表明,当 iPhone 平放在表面上时,有时它确实会重新校准。

简单测试的结果表明,API 将 3GS 的传感器设置为 ±2g,这通常适合手持运动。

TBD:

  • Apple 是否会校准每个单元,以便 UIAccelerometer 将 1G 报告为 1G?苹果的文档特别警告不要将该设备用于敏感测量应用。
  • 报告的 NSTimeInterval 是否代表从加速度计读取值的时间,或者加速度计中断指示新值准备就绪的时间?

As I find information out, I'll be collecting it in this answer.

Hardware

The 3GS uses an ST LIS331DL 3-axis ±2g/±8g digital accelerometer.

The iPhone 4 and iPad use an ST LIS331DLH 3-axis ±2g/±4g/±8g digital accelerometer.

They are both capable of being read at 100Hz and 400Hz, although on the iPhone 3G (under iOS 4.1) the accelerometer delegate is not called more frequently than 100Hz even if setUpdateInterval is set for faster updates. I do not know if the API permits faster updates on the iPhone 4, and Apple's documentation merely states that the maximum is determined by the hardware of the iPhone. (TBD)

The A/D converter is on the same silicon as the MEM sensor, which is good for noise immunity.

The DL version is 8 bits (3GS) while the DLH version is 12 bits (iPhone 4). The maximum bias (offset) in the DL version is twice the bias of the DLH (0.04g vs 0.02g) version.

The data sheet for the DLH reports acceleration noise density, but that value is not reported on the DL datasheet. Noise density is reasonably low at 218 μg/√Hz for the DLH.

Both sensors give either 100Hz sampling or 400Hz sampling speeds, with no custom rate. The sensor discards values if the iPhone doesn't read the output register at the set sampling rate.

The "typical" full scale value for the DL sensor is ±2.3g, but ST only guarantees that it's at least ±2g.

Temperature effects on the sensor are present and measurable, but not very significant.

TBD:

  • Is the hardware filter turned on, and what are the filtering characteristics?
  • How noisy is the power supply to the accelerometer? (Anybody just happen to have the iPhone schematic laying around?)
  • The accelerometer uses an internal clock to provide timing for the sample rate and A/D conversion. The datasheet does not indicate the accuracy, precision, or temperature sensitivity of this clock. For accurate time analysis the iPhone must use an interrupt to sense when a sample is done and record the time in the interrupt. (whether this is done or not is unknown, but it's the only way to get accurate timing information)

API

Requesting lower than 100Hz sampling rates results in getting selected samples, while discarding the rest. If a sampling rate that is not a factor of 100Hz is requested in software, the time intervals between real sensor readings cannot be even. Apple does not guarantee even sampling rates even if a factor of 100 is used.

It appears that the API provides no software filtering.

The API does scale the raw accelerometer value into a double representing Gs. The scaling factor used is unknown, and whether this is different for each phone (ie, calibrated) and whether the calibration occurs on an ongoing basis to account fo sensor drift is unknown. Online reports seem to suggest that the iPhone does re-calibrate itself on occasion when it's lying flat on a surface.

Results from simple testing suggest that the API sets the sensor to ±2g for the 3GS, which is generally fine for handheld movements.

TBD:

  • Does Apple calibrate each unit so that the UIAccelerometer reports 1G as 1G? Apple's documentation specifically warns against using the device for sensitive measurement applications.
  • Does the reported NSTimeInterval represent when the values were read from the accelerometer, or when the accelerometer interrupt indicated that new values were ready?
塔塔猫 2024-10-06 10:48:48

我正在处理同样的问题。与您的方法的唯一区别是我不想依靠低通滤波器来找到重力。 (说实话,我不知道如何从加速度计读数中可靠地辨别重力矢量)
我现在正在尝试使用陀螺仪。

I'm just dealing with the same problem. The only difference to your approach is that I don't want to rely on the low pass filter to find gravity. (TBH I don't see how I can reliably tell the gravity vector from the accelerometer readings)
Am trying it with the gyros right now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文